Re: How to tell if "Save" failed
Re: How to tell if "Save" failed
- Subject: Re: How to tell if "Save" failed
- From: Matt Neuburg <email@hidden>
- Date: Sun, 11 Sep 2005 10:05:38 -0700
On Fri, 9 Sep 2005 20:20:45 -0700 (PDT), email@hidden said:
>This must be obvious, but how can I tell if a "Save" failed?
>
>I have a script that makes a copy of a movie, changes the copy, saves the
>copy, deletes the original, and saves the copy in place of the original.
>I'd like to be able to tell along the way if the "saves" have succeeded or
>failed.
>
>I thought that I could do this with a try/on error, but I can't figure out
>how to make that work. In the following shortened script, I have set
>"replacementPath" to a folder that doesn't exist. The script fails to
>"save self contained movie 1 in file (replacementPath)" but I don't get
>the display dialog ("Error 2") message.
>
>-- START SAMPLE SCRIPT
>set replacementPath to "hd:noSuchFolder:testMovie.mov"
>
>tell application "QuickTime Player"
> activate
> try
> open (choose file)
> on error
> display dialog ("Error 1")
> end try
> try
> save self contained movie 1 in file (replacementPath)
> on error
> display dialog ("Error2")
> end try
> try
> close movie 1
> on error
> display dialog ("Error 3")
> end try
>end tell
>--END SAMPLE SCRIPT
Offhand, I would describe this as a bug in the implementation of the Save
command. Different apps seem to respond differently. Try it with TextEdit
and you'll see a different sort of misbehavior. In fact "save" and "save
self contained" behave differently from one another within QuickTime Player.
Your expectation that you should hear about success or failure is perfectly
reasonable. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden