Re: If Statement Not Working
Re: If Statement Not Working
- Subject: Re: If Statement Not Working
- From: George Priggen <email@hidden>
- Date: Sun, 29 Jul 2001 17:05:30 -0700
Matt or anyone -
I tried your suggestion [thanks for the help] and it looks like this:
tell application "Finder"
if file "BCData.FP5" of folder "PPBusiness" of folder "PP" of startup
disk exists then
move file "BCData.FP5" of folder "PPBusiness" of folder "PP" of
startup disk to folder "NewPPEmail" of folder "Email Campaign" of folder
"PP" of startup disk
end if
if file "BCEmployee.FP5" of folder "PPBusiness" of folder "PP" of
startup disk exists then
move file "BCEmployee.FP5" of folder "PPBusiness" of folder "PP" of
startup disk to folder "NewPPEmail" of folder "Email Campaign" of folder
"PP" of startup disk
end if
end tell
But if I try to connect to two if statements with an "and":
tell application "Finder"
if file "BCData.FP5" of folder "PPBusiness" of folder "PP" of startup
disk exists and file "BCEmployee.FP5" of folder "PPBusiness" of folder "PP"
of startup disk exists then
move ... etc
Applescript will not allow me to do it. Is there a way of combining to two
if statements?
Thanks,
George
>
From: Matthew Smith <email@hidden>
>
Date: Mon, 30 Jul 2001 08:49:45 +1000
>
To: AppleScript Users <email@hidden>
>
Subject: Re: If Statement Not Working
>
>
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
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users