very simple applescript fails
-
- Posts: 0
- Joined: Wed May 23, 2012 4:25 pm
very simple applescript fails
I am just starting to make some applescripts for GraphicConverter, however, I am having trouble opening an image file. With the following script, choosing the file and opening the image works fine, but opening the image with the file path constructed gets an error. "GraphicConverter got an error: File some object wasn't found." My problem is that both are the same file with the exact same path. I have used "display dialog theFile as text" to check the second path. They are exactly the same. If this was working correctly, I believe the second open command would cause nothing to happen, since the file is open. I can remove the "open TheFile" command and get the same error. tell application "GraphicConverter" tell application "Finder" to set theFile to (choose file with prompt "Choose an image file:'") open theFile open "Mac HD 120:Users:tonystark:Documents:Smack:xpod test:KEN1_3.jpg" tell window 1 -- main hide tools end tell end tell
-
- Posts: 0
- Joined: Wed Dec 07, 2011 7:53 pm
Re: very simple applescript fails
Am 23.05.2012 um 15:23 schrieb drillbit_99: ... > open "Mac HD 120:Users:tonystark:Documents:Smack:xpod > test:KEN1_3.jpg" IIRC rewriting this as open ("Mac HD 120:Users:tonystark:Documents:Smack:xpod test:KEN1_3.jpg" as alias) should to the trick. -karsten
-
- Posts: 0
- Joined: Wed May 23, 2012 4:25 pm
Re: very simple applescript fails
That works! Thanks.
-
- Posts: 0
- Joined: Sat Jun 19, 2004 11:47 pm
Re: very simple applescript fails
On May 23, 2012, at 08:23, drillbit_99 wrote: My problem is that both are the same file with the exact same path. I have used "display dialog theFile as text" to check the second path. They are exactly the same. ______________________________________________________________________Hey There,Works fine for me with the latest beta.------------------------------------------------------------------------set theOtherFile to "Thor:Users:chris:test_directory:Image.jpg"# set theOtherFile to alias "Thor:Users:chris:test_directory:Image.jpg"tell application "GraphicConverter" set theFile to choose file with prompt "Choose an image file:'" open theFile open theOtherFile tell window 1 -- main hide tools end tellend tell------------------------------------------------------------------------Note that choose file is a Standard Addition and does not need the Finder tell.GraphicConverter correctly interprets the designated HFS path, although many applications will not.Using alias "path" is pretty bomb-proof.--Best Regards,Chris