Does running Applescript Objective-C natively in an Applescript script get easier in OS X 10.8+? I'm stuck in OS X 10.6 for now due to production reasons, but I'm hoping the state of things for executing ASObjC gets simpler, or is the ASObjC Runner my
best option to pass ASObjC snippets inside vanilla Applescript? If so, maybe this openPanel function could be added to it as native functionality? Shane?
on someHandler(theDir)
script
OpenPanelAcceptingFilesAndFolders
set
thePanel to current application's
NSOpenPanel's openPanel()
set
theDir to current application's
NSApp's passedValue() as
text
tell
thePanel
setMessage_("Please choose client files. Cmd-Click to select more than one file/folder.")
setTitle_("Client Files Collect")
setFloatingPanel_(true)
setShowsHiddenFiles_(false)
setTreatsFilePackagesAsDirectories_(false)
setDirectoryURL_(theDir)
setCanChooseFiles_(true)
setCanChooseDirectories_(true)
setAllowsMultipleSelection_(true)
set
returnCode to runModal()
end tell
set
returnCode to returnCode as
integer
set
theResults to {}
if
returnCode = (current application's
NSFileHandlingPanelOKButton) as integer then
set
theURLs to thePanel's
URLs() as list
repeat with
i from 1 to count of
theURLs
tell
item i of
theURLs to set thePosixPath to
|path|()
set
theResults to theResults &
thePosixPath
end repeat
end if
return
theResults
end script
set
x to {}
using terms from
application "ASObjC Runner"
set
runnerPath to (path to resource "ASObjC Runner-N.app") as
text
tell
application runnerPath
set
x to run the script {OpenPanelAcceptingFilesAndFolders}
passing
theDir with response
end tell
end using terms from
return
x
end someHandler