Hi all,
This new ASOC is really baffling me sometimes. I’m trying to do something really simple and it just wont let me do it. I want to check if a file or folder exists
as an example here I’m trying to see if the desktop folder exists
on clicked_(sender)
try
tell application "Finder"
set imageFile to ":Users:keat:Desktop" as alias
display alert "Found"
end tell
on error
display alert "Not Found"
end try
end clicked_
But there is always an error and the Not Found alert is activated. The only way I can fix this is to make the file path “Macintosh HD:Users:keat:Desktop”. However I want this application to be as portable as possible so having Macintosh HD out the front really isnt good enough. This script works in AS editor but not Xcode. The strange thing is I have another app made with ASOC using the same kind of script to check if a file exists and it works fine!
Any ideas? Am I doing something ridiculously stupid?
Cheers
Model: MacBook
AppleScript: Xcode 3.2.1
Browser: Safari 531.21.10
Operating System: Mac OS X (10.6)