• 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: Syntax for Finder 'exists' command?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax for Finder 'exists' command?


  • Subject: Re: Syntax for Finder 'exists' command?
  • From: "Wallace, William" <email@hidden>
  • Date: Tue, 29 Mar 2005 11:02:49 -0600

First of all, line 1 and 2 do not work. Line 1 errors with the message "File
FooFolderfooFile wasn't found" because you have tried to create an alias
from a string which doesn't even resemble a file path. Try this (just make
sure there is actually a folder named fooFolder containing a file named
fooFile, on your desktop):

set desktopPath to path to desktop as string
set importFolder to "fooFolder"
set importFile to "fooFile"
tell application "Finder"
    set this_item to (desktopPath & importFolder & ":" & importFile) as
alias -- line 1
    set this_info to info for this_item -- line 2
    select (desktopPath & importFolder & ":" & importFile) -- line 3
    exists file (desktopPath & importFolder & ":" & importFile)  -- line 4
end tell

--> true

But then again since you already have a reference to fooFile stored in the
this_item variable, why not just do:

exists file this_item

--
St!ff M!ttens

Smash it up, tear it down... whatever.
http://www.destroyeverything.com


On 3/29/05 8:56 AM, "Dennis Jones" <email@hidden> wrote:

> I am trying to determine if a file exists after a Finder 'move'
> command prior to using the file.
>
> In the code below, line 1 and 2 work as expected to get the info for
> the file. Line 3 works as expected and selects the file in the finder.
>
> However, line 4 always returns 'false', when I would expect it to
> return true since I know the file exists.
>
> What is wrong with my syntax?
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Syntax for Finder 'exists' command? (From: Dennis Jones <email@hidden>)

  • Prev by Date: Re: Syntax for Finder 'exists' command?
  • Next by Date: Entourage, Photoshop and a Folder Action
  • Previous by thread: Syntax for Finder 'exists' command?
  • Next by thread: Re: Syntax for Finder 'exists' command?
  • Index(es):
    • Date
    • Thread