Working on an Automator action. I’m having some trouble getting paths in the right format.
I’ve got this:
tell current application to set prefs_file to (the prefs_folder & "com.Automator.chit.plist") as unicode text
tell application "System Events"
set fileStatus to false
set fileStatus to exists disk item prefs_file
end tell
if fileStatus is false then
display dialog "You must have an Open command before you can Render."
return input
end if
Which is throwing this error:
Can't get «class posx» of "Macintosh HD:Users:wanderer:Library:Preferences:com.Automator.chit.plist". (error -1728)
prefs-file is a legit HFS path, I just can’t seem to get it coerced into something that works with the System Events exists call.
Are you sure about that? How do you define prefs_folder? If I define prefs_folder as “path to desktop”, which I think returns an hfs path, your code works fine.
on applicationWillFinishLaunching_(aNotification)
set the prefs_folder to (path to preferences folder from user domain) as Unicode text
tell current application to set prefs_file to (the prefs_folder & "com.apple.Safari.plist") as unicode text
tell application "System Events"
set fileStatus to false
set fileStatus to exists disk item prefs_file
end tell
log fileStatus
log prefs_file
if fileStatus is false then
display dialog "You must have an Open command before you can Render."
return input
end if
end applicationWillFinishLaunching_
I do get an error about “input” not being defined when my file is not found, but that’s another problem. If I substitute a file name that is in my preferences folder, then it works