Imported from the Apple Support Forums via the Wayback Machine 🔗
I still don't know why this fails under Snow Leopard but the fix is as follows.
set pPath to POSIX path of "Macintosh HD:tmp:temp_invite.ics"
do shell script "open " & pPath
So using a shell script within AppleScript will still open a file. Bizarre.
0
red_menace·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Using your example with either the alias or file keywords works for me. Is there something in the code surrounding the tell statement that could be confusing things?
0
Andy Fragen·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I do have to say that when I initially upgraded to 10.6 I dismissed the dialog asking where 'System Events' was.
Here is the entire script.
*set thepath to (path to startup disk as string) & "tmp:temp_invite.ics"*
*tell application "iCal" to open alias thepath*
Here is the result that I consistently get.
Result:
*error "iCal got an error: AppleEvent handler failed." number -10000*
Changing alias to file doesn't help me. I've only gotten it to work by using +do shell script..+
0
red_menace·
Imported from the Apple Support Forums via the Wayback Machine 🔗
If AppleScript didn't/doesn't know where *System Events* is, it may also be having a problem with *Standard Additions*, which is where the path to command is. You should be able to see if there is a problem with that by looking at the contents of your thepath variable to see if the startup disk keyword is getting put in there.
0
Andy Fragen·
Imported from the Apple Support Forums via the Wayback Machine 🔗
+path to+ is being done correctly. Where I get the error is having iCal try to open an .ics file. The correct path is being sent to the +tell application "iCal" to open alias thepath+ command.
0
JLG89·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Same problem here. A script that ran fine under 10.5 fails under 10.6.
The script text is:
set icsfile to (path to desktop folder as text) & "iCalEvent.ics"
tell application "iCal"
activate
open file icsfile
end tell
And it fails with this error:
error "iCal got an error: AppleEvent handler failed." number -10000
Now, if I insert a "return icsfile," it returns the correct Macintosh path, so whatever it is that "knows" how to find the desktop is working properly.
0
JLG89·
Imported from the Apple Support Forums via the Wayback Machine 🔗
And, just to confirm:
do shell script ("open " & (POSIX path of icsfile))
Works.
0
Andy Fragen·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Exactly. But why?
open file icsfile
BTW, +open alias icsfile+ will fail similarly.
0
Andy Fragen·
Imported from the Apple Support Forums via the Wayback Machine 🔗
FWIW, here's the code I've inserted in my script to fix this.
tell application "iCal" to activate
try
tell application "iCal" to open alias thepath
on error
--Snow Leopard kludge
set tPath to POSIX path of thepath
do shell script "open " & tPath
end try
0
Hiroto·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hello
I'd first try -
tell application "iCal" to open (thepath as alias)
in lieu of -
tell application "iCal" to open alias thepath
The 'alias x' and 'x as alias' are technically two things.
Good luck,
H
0
Andy Fragen·
Imported from the Apple Support Forums via the Wayback Machine 🔗