on fileExists(_path) # Takes a path as input - HFS, Posix, or ~/Posix
try
if _path starts with "~/" then
set _path to (POSIX path of (path to home folder as text)) & text 3 thru -1 of _path
end if
if _path contains ":" then
alias _path
else if _path contains "/" then
alias POSIX file _path
end if
return true
on error
return false
end try
end fileExists
------------------------------------------------------------------------------------------------
set f1 to ((path to desktop as text) & "Python Example.scpt")
set _flagHFS to fileExists(f1) # ~ 0.0007 sec
set f2 to POSIX path of ((path to desktop as text) & "Python Example.scpt")
set _flagPosix to fileExists(f2) # ~ 0.0007 sec
set fileName to "Python Example.scpt"
set f3 to "~/Desktop/" & fileName
set _flagPosixUser to fileExists(f3) # ~ 0.001 sec