Re: Li'l help with if, then, else
Re: Li'l help with if, then, else
- Subject: Re: Li'l help with if, then, else
- From: Nigel Garvey <email@hidden>
- Date: Fri, 2 Mar 2001 01:13:26 +0000
"T.J. Mahaffey" wrote on Fri, 02 Mar 2001 04:56:04 -0600:
>
Now, in my effort to streamline my script, I wanted to create a subroutine
>
of those three copy commands so I could call them more efficiently. Can
>
someone tell my why my subroutine isn't working? The script executes
>
seemingly ok, but never performs the copy commands assigned to the
>
subroutine.
>
>
tell application "Finder"
>
if folder "Utilities" of startup disk exists then
>
try
>
copyParts
Hi. There are two things about the call to the handler. Firstly, it
should have parentheses tacked onto the end, so that the compiler knows
you're calling the handler and not just mentioning it in passing.
Secondly, as the call's in a Finder 'tell' block and the handler belongs
to the script itself, the call should be preceded by 'my' (or followed by
'of me').
tell application "Finder"
if folder "Utilities" of startup disk exists then
try
my copyParts()
Have fun with the streamlining. If you'd like a couple of hints, there
are three long 'display dialog' commands which are all very similar
except for the text. Also, the Finder has the special terms 'preferences
folder' and 'extensions folder', which would save a few 'of's in the
'duplicate' commands.
duplicate file [blah blah blah ] ... to the preferences folder
NG