Getting code to work correctly in two different versions of OS X can sometimes pose problems and considerable testing. But, if it works in Snow Leopard, then surely it will work in Leopard. Right? Wrong!
I have a script that writes a report of applications and versions in my Applications folder. Yesterday, I updated it with a new feature. This code, considerably simplified, works correctly in Snow Leopard (10.6.6) ...
on scanApplications(folderRef, indent, leaders, fileRefNr, folderPath) tell application "Finder" -- -- get a list of applications in applList -- if (count items of applList) > 0 then write folderPath to fileRefNr -- <<<<<<<<<<<<<<<<<<< set folderPath to "" repeat with theItem in applList indent & (displayed name of theItem) as text my writeAppl(theItem, the result, leaders, fileRefNr) -- also ... write someText to fileRefNr end repeat end if -- -- get a list of sub-folders in folderList -- repeat with theFolder in folderList -- my scanApplications(theFolder, indent & spaceTab, leaders, fileRefNr, folderPath) -- end repeat end tell end scanApplications -------------------------
I wanted to write the same report for Leopard, so, I restarted to my external Leopard (10.5.8) disk. When I ran the script, I was surprised to always get an error at ...
write folderPath to fileRefNr -- <<<<<<<<<<<<<<<<<<<
I wasted a couple of hours trying to understand and fix the problem. Finally, I read the handler code carefully, again, and fixed the problem with ...
tell me to write folderPath to fileRefNr -- <<<<<<<<<<<<<<<<<<<
Snow Leopard Finder understands 'write ...', but Leopard Finder does not. But, which system version has the problem? (Where's the bug?)
|