AppleScript: 'exists' returns true every time On every exists in AppleScript the result is true. For example:
set a to (POSIX path of (((path to home folder from user domain) as text) &amp; &quot;skfhshfkh:&quot; &amp; &quot;hfjhsfhsj:&quot;))
if exists a then
    display dialog &quot;AppleScript wrongly returns true ...&quot;
end if

The result is
tell current application
    path to home folder from user domain
        --&gt; alias &quot;Macintosh HD:Users:[User]:&quot;
end tell
tell application &quot;Script Editor&quot;
    exists &quot;/Users/[User]/skfhshfkh/hfjhsfhsj/&quot;
        --&gt; true
    display dialog &quot;AppleScript wrongly returns true ...&quot;
        --&gt; {button returned:&quot;OK&quot;}
end tell
Result:
{button returned:&quot;OK&quot;}

This path does not exist so where is the mistake? Is it my mistake or is it a bug in AppleScript?
Thanks for any help.
I am by no stretch of the imagination an Applescript expert, but this is what I have gleaned from my own fumbling over the years.
I'd appreciate corrections if there are any inaccuracies, or better methods.. but with some 'why it works' for newbies ;-)

What you're actually doing is asking Script Editor if the string "/Users/[User]/skfhshfkh/hfjhsfhsj/" exists… which it does, you just told it that it did ;-)
Script Editor doesn't know what a file is, nor how to look for one, so it's treating the string as a string not a path.

The simplest way to do this is use either the Finder or System Events which have their own 'exists' routine.

In this first example, you can input as either POSIX file or just file, &amp; adjust your syntax accordingly.

So, this should work, for a file… 

set msg to "No sign of it"
tell application "Finder"    
    --if exists POSIX file "/volumes/MacintoshHD/Users/[user]/Desktop/testFile.rtf" then
    --or
    --if exists file ((path to home folder as text) &amp; "Desktop:" &amp; "testFile.rtf") then
    --or
    --if exists file "MacintoshHD:Users:[user]:Desktop:testFile.rtf" then
    --but NOT
    --if exists POSIX file ((path to home folder as text) &amp; "Desktop:" &amp; "testFile.rtf") then
        set msg to "Yeah, found it!"
    end if
end tell

display dialog msg


Displaying the dialog outside the Finder tell prevents Finder coming to the front to just to present it.

Alternatively, you could set your path outside of the exists function itself.
This would be my preferred method, &amp; uses System Events instead of Finder...

set theFile to ((path to home folder as text) &amp; "Desktop:" &amp; "testFile.rtf")
set msg to "No sign of it."

tell application "System Events"
    if exists file theFile then
        set msg to "Yeah, found it!"
    end if
end tell

display dialog msg


Note that using System Events, you must put the dialog outside the tell, as System Events will not display the dialog itself.

In either of these examples, trying to start with a POSIX file &amp; attempting to concatenate the additional path by using &amp; "Folder:" &amp; "Filename" won't do what you expect.
This is one point on which I don't know why it doesn't, but it doesn't.

One last note - if you are looking for a file, then all the above works.
If you are looking for a folder, then use this…

set theFolder to ((path to home folder as text) &amp; "Desktop:" &amp; "testFolder:")
set msg to "No sign of it."

tell application "System Events"
    if exists folder theFolder then
        set msg to "Yeah, found it!"
    end if
end tell

display dialog msg