Re: script will error when nothing in a watched folder
Re: script will error when nothing in a watched folder
- Subject: Re: script will error when nothing in a watched folder
- From: Emmanuel <email@hidden>
- Date: Wed, 7 Mar 2001 23:07:08 +0100
>
it errors at:
>
>
tell application "Acrobat 4.0"
>
activate
>
open theFile as alias <----alias is the error highlighted
>
end tell
>
>
the error reads:
>
>
Can't make {} into a alias.
>
>
what should I do??
There is a special structure for that, the "try ... on error" structure.
If you encapsulate the possibly erroring line in such a structure, the
script will resume execution smoothly.
------------------------------
tell application "Acrobat 4.0"
activate
try
open theFile as alias
on error
-- do nothing, or beep
end try
end tell
------------------------------
(on recent systems, "on error" is optional if there is *really nothing*
between it and the "end try")
HTH
Emmanuel