I’m using this as a loose guide: http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.09.htm
So, I use open-panel to have the user select either a directory or a file.
Then I want to test their choice, if file get path to parent directory.
Sooo, following the above linked example. I
on choose menu item theObject
if the name of theObject = "openFile" then
set can choose directories of open panel to true
set can choose files of open panel to true
display open panel in directory (system attribute "HOME")
set inputFile to item 1 of (path names of open panel as list)
set item_info to info for inputFile
display dialog fileType
set title of window "main" to "Input File: " & inputFile
show window "main"
end if
end choose menu item
I don’t even get to the next step as “set item_info to info for inputFile” prodcues an error:
Applescript Error
File /Users/username/chosendirectory wasn’t found (-43)
I’ve done tons of searches (google and otherwise) for “file type” “file test” “ste type” and searched apple docs for type, set. Can’t find any examples >.<
edit for clarification I don’t care what kind of file it is, only that it is not a directory.