Re: Newbie Question
Re: Newbie Question
- Subject: Re: Newbie Question
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 10 Dec 2001 02:37:57 -0500
- Organization: [very little]
>
From: "Mike F." <email@hidden>
>
To: "AppleScript List" <email@hidden>
>
Subject: Newbie Question
>
Date: Sun, 9 Dec 2001 19:28:17 -0800
>
>
Hi all-
>
>
I'm new not only to this list, but to AppleScript as well. I'm trying to
>
create a script that will perform a few operations and I need a little help.
>
Here is what I want to do:
>
>
-look for a file in a specific folder on a server (file name will change a
>
bit)
>
-copy this file to a specific folder on the local drive
>
>
It seems pretty basic but I have a few questions.
>
>
1) When looking for a server, does the server's drive have to be mounted on
>
the desktop? If so, how do I (in the script) tell it to look for a path that
>
doesn't exist?
tell application "Finder"
if not (exists disk "serverVolumeName") then
activate
display dialog "The server volume's not there!" ,
buttons {"Cancel"} default button 1 with icon stop
end if
end tell
>
2) I noted the file name might change a bit -- for example, the file name
>
might be named 'File1.001' one day, but the next day it might be 'File1.002'.
>
Basically, the 'File1' will stay the same -- only the last 3 digits will
>
change. I currently have a dialogue box that asks for the three digits. I
>
want to take the 3 digits the user enters and use it to determine what file to
>
get.
display dialog "Please enter the file name extension:" default answer ""
set fileName to "File1." & (text returned of the result)
>
3)Lastly, I want to produce a non-trivial error message if the file doesn't
>
exist.
tell application "Finder"
if not (exists file "serverVolumeName" & ":" & fileName) then
activate
display dialog "The file's not there!" ,
buttons {"Cancel"} default button 1 with icon stop
end if
end tell
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[12/10/01 2:35:59 AM]