--Getting input file Using a dialog box
on showModalPanelinput_(sender)
set thePanel to current application's NSOpenPanel's openPanel()
tell thePanel
setMessage_("Choose the input file:")
setExtensionHidden_(true)
setShowsHiddenFiles_(false)
setTreatsFilePackagesAsDirectories_(false)
setCanChooseFiles_(true)
setCanChooseDirectories_(false)
setAllowsMultipleSelection_(false)
setResolvesAliases_(true)
--setAllowedFileTypes_(false) -- set types to allow selection of
set theResult to runModal() -- open, and wait here until it's finished
end tell
if theResult = current application's NSFileHandlingPanelOKButton then
set theURLs to (thePanel's |URLs|()) as list
repeat with aURL in theURLs
--log aURL's |path|()
set my input_file to aURL's |path|()
end repeat
else
-- cancel button
--log "Cancel pressed"
end if
end showModalPanelinput_
*** -[iBabelAppDelegate showModalPanelinput:]: item 1 of {file "Macintosh HD:Users:chrisswain:Desktop:Sample Files:caffeine.mol"} doesn’t understand the “path” message. (error -1708)
and the text box is not populated.
Cheers
Chris