|
From: creedon <icr...@us...> - 2005-09-16 02:41:29
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/suites/DuckTape In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20993 Modified Files: Tag: commercial_suite_project-branch getAete Log Message: reorg the code a bit remove now redundant grabbing appid from mac os x package code Index: getAete =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/suites/DuckTape/Attic/getAete,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** getAete 18 Aug 2005 16:28:58 -0000 1.1.2.1 --- getAete 16 Sep 2005 02:41:21 -0000 1.1.2.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:suites.DuckTape.getAete ! on getAETE (appPath, AETEAdr) { ÇChanges Ç8/8/05; 12:10:36 PM by TAC Çfor dynamic, if the application wasn't running then quit it after grabbing the aeteList Çminor script formatting tweaks local { name; scsz; dynamic = false; appID = file.creator (appPath); tbl}; Çif (string.nthField ((string.popTrailing (appPath, ":")), ".", 2) == "app") if (system.environment.isCarbon and file.isFolder (appPath)) { // Tue, Jul 2, 2002 at 1:11:34 PM by SE: OS X apps may be folders appID = string4 (string.mid (file.readWholeFile (appPath + "Contents:PkgInfo"), 5, 4)); dynamic = true}; if appID == "MACS" { dynamic = true}; if appID == "sevs" { dynamic = true}; if not dynamic { if rez.getNthResource (appPath, 'scsz', 1, @name, @scsz) { local (flags = long (binary (string.mid (string (scsz), 1, 4)))); dynamic = bit.get (flags, 31)}}; if dynamic { local (flQuit = false); if not (sys.appIsRunning (appID)) { launch.application (appPath); flQuit = true}; local (aeteList = appleEvent (appID, 'ascr', 'gdte', '----', 0)); if flQuit { required.quitApplication (appID)}; if typeof (aeteList) == listType { new (tableType, aeteAdr); local (ix); for ix = 1 to sizeof (aeteList) { aeteAdr^.["aete" + ix] = binary (aeteList[ix]); setbinaryType (@aeteAdr^[ix], 'aete')}} else { aeteAdr^ = binary (aeteList); setbinaryType (aeteAdr, 'aete')}} else { if !rez.getNthResource (appPath, 'aete', 1, @name, AETEAdr) { scriptError ("Couldn't find the resource.")}}}; Çbundle // testing Çon doOneAete (aeteAdr, index = "") Çlocal (f = "aete" + index + ".rsrc") Çif file.putFileDialog ("Workfile for aete", @f) Çfile.writeWholeFile (f, "", 'rsrc', 'RSED') Çrez.putResource (f, 'aete', 128, aeteAdr) Çtry {delete (@temp.aete)} ÇgetAETE (networksetup.appinfo.path, @temp.AETE) Çif typeof (temp.aete) == tableType Çlocal (ix) Çfor ix =1 to sizeof (temp.aete) ÇdoOneAete (@temp.aete[ix], ix) Çelse ÇdoOneAete (@temp.aete) \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:suites.DuckTape.getAete ! on getAETE (appPath, adrAete) { ÇChanges Ç9/6/05; 12:22:06 PM by TAC Çreorg the code a bit Çremove now redundant grabbing appid from mac os x package code Ç8/8/05; 12:10:36 PM by TAC Çfor dynamic, if the application wasn't running then quit it after grabbing the aeteList Çminor script formatting tweaks local (appID = file.creator (appPath), dynamic = false, name, scsz); case appID { 'MACS'; 'sevs' { dynamic = true}}; if not (dynamic) { if rez.getNthResource (appPath, 'scsz', 1, @name, @scsz) { local (flags = long (binary (string.mid (string (scsz), 1, 4)))); dynamic = bit.get (flags, 31)}}; if not (dynamic) { if system.environment.isCarbon and file.isFolder (appPath) { // Tue, Jul 2, 2002 at 1:11:34 PM by SE: OS X apps may be folders dynamic = true}}; if dynamic { try { local (flQuit = false); if not (sys.appIsRunning (appID)) { launch.application (appPath); flQuit = true}; local (aeteList = appleEvent (appID, 'ascr', 'gdte', '----', 0)); if flQuit { required.quitApplication (appID)}; if typeof (aeteList) == listType { local (ix); new (tableType, adrAete); for ix = 1 to sizeof (aeteList) { adrAete^.["aete" + ix] = binary (aeteList[ix]); setbinaryType (@adrAete^[ix], 'aete')}} else { adrAete^ = binary (aeteList); setbinaryType (adrAete, 'aete')}} else { dynamic = false}}; if not (dynamic) { local (fork = 1); try { if file.isFolder (appPath) { if file.type (appPath) == 'osax' { local (cp = re.compile ("<key>CFBundleExecutable</key>[ \n\r\t]*<string>([^<]*)</string>")); local (s = file.readWholeFile (appPath + "Contents:Info.plist")); local (t = re.extract (cp, s, {1})); appPath = appPath + "Contents:Resources:" + t [1] + ".rsrc"; if t == {} { scriptError ("Couldn't find the resource.")}; fork = 2}}}; if !rez.getNthResource (appPath, 'aete', 1, @name, adrAete, fork) { scriptError ("Couldn't find the resource.")}}}; Çbundle // testing Çon doOneAete (adrAete, index = "") Çlocal (f = "aete" + index + ".rsrc") Çif file.putFileDialog ("Workfile for aete", @f) Çfile.writeWholeFile (f, "", 'rsrc', 'RSED') Çrez.putResource (f, 'aete', 128, adrAete) Çtry {delete (@temp.aete)} ÇgetAETE (networksetup.appinfo.path, @temp.AETE) Çif typeof (temp.aete) == tableType Çlocal (ix) Çfor ix =1 to sizeof (temp.aete) ÇdoOneAete (@temp.aete[ix], ix) Çelse ÇdoOneAete (@temp.aete) \ No newline at end of file |