• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: URL Access Scripting
  • Next by Date: Re: 9.2.2 Update effects on applescript
  • Previous by thread: Re: Newbie Question
  • Next by thread: Newbie question
  • Index(es):
    • Date
    • Thread