Re: If Statement Not Working
Re: If Statement Not Working
- Subject: Re: If Statement Not Working
- From: Matthew Smith <email@hidden>
- Date: Mon, 30 Jul 2001 08:49:45 +1000
on 30/07/2001 08:20, George Priggen at email@hidden wrote:
>
I have the following Applescript which does not perform the file switch when
>
employing the "If" statement.
>
>
tell application "Finder"
>
select {folder "PPBusiness" of folder "PP" of startup disk}
>
if {file "BCData.FP5" of folder "PPBusiness" of folder "PP" of startup
>
disk is in folder "PPBusiness" of folder "PP" of startup disk, file
>
"BCEmployee.FP5" of folder "PPBusiness" of folder "PP" of startup disk is in
>
folder "PPBusiness" of folder "PP" of startup disk} = true then
>
select {file "BCData.FP5" of folder "PPBusiness" of folder "PP" of
>
startup disk, file "BCEmployee.FP5" of folder "PPBusiness" of folder "PP" of
>
startup disk}
>
move selection to folder "NewPPEmail" of folder "Email Campaign" of
>
folder "PP" of startup disk
>
end if
>
end tell
>
>
What do I need to do to get the "If" statement to work in connection with
>
the second select section?
The evaluation of your if condition will be {true, true} = true, which does
not equate to being true. Maybe you want to do an "and" as in "if x and y
then...".
The condition:
file "BCData.FP5" of folder "PPBusiness" of folder "PP" of startup disk is
in folder "PPBusiness" of folder "PP" of startup disk
will always be true. Are you trying to test for the existence of the file?
You should use "exists".
Eg.
(file BCData.FP5" of folder "PBBusiness" of folder "PP" of startup disk)
exists
Also, you don't need to select anything.
Eg.
If file x exists then
move file x to folder y
End if
--
Matthew Smith