• 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: If Statement Not Working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: If Statement Not Working
      • From: George Priggen <email@hidden>
References: 
 >If Statement Not Working (From: George Priggen <email@hidden>)

  • Prev by Date: If Statement Not Working
  • Next by Date: Re: how to return to app ?
  • Previous by thread: If Statement Not Working
  • Next by thread: Re: If Statement Not Working
  • Index(es):
    • Date
    • Thread