Re: Error-trapping alias properties
Re: Error-trapping alias properties
- Subject: Re: Error-trapping alias properties
- From: Andy Wylie <email@hidden>
- Date: Fri, 29 Mar 2002 11:49:47 +1200
on 29/3/02 9:17 AM, Paul Skinner at email@hidden wrote:
>
Funny thing, I tried to test this and found a...bug?
>
OS X 10.1.3 / AS 1.8.1. What OS / ASv are you using?
>
>
--Script saved as an application
>
property someFile : ""
>
try
>
someFile as alias
>
on error
>
set someFile to choose file
>
end try
>
display dialog someFile as text
>
--end script
>
>
This asks you to choose a file then stores an alias to the file in the
>
property.
>
It then displays the current path to the file in a dialog.
>
If you move the file then run the script again it shows you the new path.
>
>
cool so far.
>
>
Now I trashed the file and ran the script again and...
>
No error!
>
And it displays the original path from the Choose File assignment!
>
WTF?
>
--tested 8.6
-----------------------
property someFile : missing value
try
(get someFile as string) as alias
on error
set someFile to choose file
end try
display dialog someFile as text
-----------------------
on 29/3/02 2:48 AM, Paul Berkowitz at email@hidden wrote:
>
Andy, please go back and read my message again. You're not "getting" it.
I wasn't clear and the examples were wrong sorry. The key seems to be 'as
string'
-----------------------
property someFile : missing value
if (get exists file (someFile as string) of application "Finder") = false
then
set someFile to choose file
end if
display dialog someFile as text
-----------------------
property someFile : missing value
display dialog someFile as text
try
(get exists file someFile of application "Finder")
on error number n
if n = -1700 then set someFile to choose file
return
end try
_____________________________ Andy
_______________________________________________
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.