Re: Newbie Question
Re: Newbie Question
- Subject: Re: Newbie Question
- From: has <email@hidden>
- Date: Tue, 11 Dec 2001 03:19:16 +0000
Robert Kyle wrote:
>
set theSuffix to text returned of (display dialog "Enter a three-digit
>
number" default answer "000")
>
set thePath to "disk:folder:File1." & theSuffix
>
tell application "Finder"
>
if not (exists file thePath) then
>
display dialog "File1." & theSuffix & " does not exist!"
>
else
>
--clever things happen here!
>
end if
>
end tell
>
>
I suspect that there might be a better way to handle the file-exists test. By
>
the time this comes back in the digest, better ways might be posted.
Here's a technique that doesn't need the Finder:
try
get alias thePath
on error
--file doesn't exist: get user to remedy this
end
--file exists: do something with the file
Also, when getting the suffix code from the user, try:
set theSuffix to text -3 thru -1 of "000" & (text returned of (display
dialog "Enter a three-digit number" default answer "000"))
That saves you from having to type any leading zeros, e.g. entering "1"
will give you "001".
HTH
has