• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
A Subtle Error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A Subtle Error


  • Subject: A Subtle Error
  • From: Luther Fuller <email@hidden>
  • Date: Sun, 16 Jan 2011 09:23:15 -0600

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?)

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: A Subtle Error
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: Top-posting [ was Variable names]
  • Next by Date: Re: A Subtle Error
  • Previous by thread: Re: Script Modification
  • Next by thread: Re: A Subtle Error
  • Index(es):
    • Date
    • Thread