Re: Broken scripts in Panther
Re: Broken scripts in Panther
- Subject: Re: Broken scripts in Panther
- From: Walter Ian Kaye <email@hidden>
- Date: Mon, 8 Dec 2003 09:13:14 -0800
At 04:11p +0000 12/08/2003, Mr Tea didst inscribe upon an electronic papyrus:
In Jaguar I used a script (adapted from something posted here by John
Delacour) to save the contents of Safari's front window to the desktop.
After extracting a sensible file name from the page's title and writing it
to the variable 'n', the script went on like this...
set f to POSIX path of ("" & (path to desktop) & n & ".html")
tell application "Safari" to save front document in f as text
I'm surprised that worked in the first place!
AppleScript uses Mac-style paths.
POSIX paths are for sending commands to Unix, not to AppleScriptable apps.
After installing Panther, the pages were still saved, but not to the
desktop. Instead, the files were saved at the root level of the startup
disk, and the path to the desktop, in slash delimited form, was included as
part of the file name. Messy.
Fortunately, the problem was easily resolved by adding another line:
set f to POSIX path of ("" & (path to desktop) & n & ".html")
set f to POSIX file f
That's rather Rube Goldberg-like. How about simply this:
set f to file ((path to desktop as string) & n & ".html")
tell application "Safari" to save front document in f as text
....but why did the original version stop working?
It shouldn't have ever worked. I would consider it an error for a Mac
app to accept a Unix path. That error was probably corrected!
JD likes to use somewhat unique constructs in his code. If you don't
fully understand them when they work, you won't understand them when
they don't. ;)
-boo
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.