I recently wanted to process a group of files that had been selected in the MacOS X Finder. (This is a Mac-specific post!) Obviously I wanted to do the work with newLISP. Here's a three-step reminder of how to do it.
First, enable the Script icon on the menubar, if it isn't already. (Many people have described how to do this; here's a good one.) The Script Menu shows both global scripts and the scripts that are designed for the application you’re running. Scripts to be run in the Finder should be in /Users/you/Library/Scripts/Applications/Finder/. You don’t have to use a special suffix for the file.
Secondly, save the Finder-related scripts in that folder, and don’t forget to make them executable first! Here's the basic idea:
#!/usr/bin/env newlisp
(set 'applescript
[text]
set rslt to {}
tell application "Finder"
set s to selection
repeat with i in s
set end of rslt to (POSIX path of (i as alias))
end repeat
end tell
rslt
[ /text])
(set 'file-list (parse
(first
(exec (string "osascript -e '" applescript "'" ))) ", "))
(dolist (f file-list)
(println f))
; printed output goes to the console
/usr/share/newlisp/guiserver.jar
/usr/share/newlisp/newLISP128.png
/usr/share/newlisp/modules/cgi.lsp
/usr/share/newlisp/util/newlisp.vim
Finally, enjoy working in newLISP rather than AppleScript! :)