set msg to "no"
tell application "Finder"
if exists POSIX file "/applications/My Progs/iDrive.app" then
set msg to "yes"
end if
end tell
display dialog msg
set AppInstall to (path to applications folder as text) & "Utilities:Terminal.app"
if exists application AppInstall then --you can remove"application" as it'll start running
say "Hello"
else
say "Doh"
end if
end
two problems:
¢ the correct “shortcut” to /Applications is path to applications folder
¢ only System Events or the Finder knows about the existence of a file reliably
set AppInstall to (path to applications folder as text) & "MyProg:iDrive.app"
tell application "Finder" to set iDriveExists to (exists file AppInstall)
if iDriveExists then
say "Hello"
else
say "Doh"
end if
@Hans-Gerd: your script will throw an error, if the file doesn’t exist
set AppInstall to ((path to applications folder as string) & "MyProg:iDrive.app")
tell application "Finder"
if exists AppInstall then
say "Hello"
else
say "Daoh"
end if
end tell
Finder is the only application that will handle checking files from string.
P.S. I changed “Doh” to “Daoh” for pronunciation.
EDIT:
I just noticed Stefan said the same thing I did.