AppleScripts that worked fine in OS9 might not work in OSX. This is one of several postings relating to various problems that I have resolved while transitioning OS9 scripts to OSX. This one is related to:
Open for access file "file" -- from the Standard Additions
To see a walkthrough of what works in OS 9 vs. what works in OS X, read the rest of the article...
SETUP: in SimpleText create a new file. Make sure that it's a plaintext file (Format -> Make Plain Text). Type the following line ... Viva [tab] el [tab] Che then save the file as Che.txt.
To open Che.txt in OS9 and read the results into a list (array), we can do the following:
Change the following lines and save yourself some pain:
Open for access file "file" -- from the Standard Additions
To see a walkthrough of what works in OS 9 vs. what works in OS X, read the rest of the article...
SETUP: in SimpleText create a new file. Make sure that it's a plaintext file (Format -> Make Plain Text). Type the following line ... Viva [tab] el [tab] Che then save the file as Che.txt.
To open Che.txt in OS9 and read the results into a list (array), we can do the following:
tell application "Finder"Beautiful! Trying the same lovely script in OSX, however, we see that it fails. The error message is: "Can't make file into a class <<fsrf>>"
set workingFileRef to file "Che.txt" of startup disk
set workingFile to (open for access workingFileRef)
set theContents to read workingFile using delimiter {ASCII character 9} as list before {ASCII character 13}
display dialog theContents as string
close access workingFile
end tell
Change the following lines and save yourself some pain:
set workingFileRef to "Mac OS X HD:Users:barrager:Documents:Che.txt" as textI suspect that what is going on here is that OS9 AppleScript was more forgiving that OSX AppleScript. Running the OSX AppleScript listed here in OS9 works fine!
set workingFile to (open for access file workingFileRef)
•
[4,838 views]

