Skip to content

Instantly share code, notes, and snippets.

@kujirahand
Last active Aug 29, 2015
Embed
What would you like to do?
Rhino/JavaScriptをMacアプリに仕上げる方法 ref: http://qiita.com/kujirahand/items/5a327970e0d0b60be14a
on main(input)
-- スクリプトの名前
set mainScript to "test.sh"
-- 親ディレクトリの取得
tell application "Finder" to set parentDirPos to parent of (path to me) as text
set parentDir to ((alias parentDirPos)'s POSIX path)
try
do shell script "cd " & parentDir & ";./" & mainScript & space & input
end try
end main
on open argv
repeat with aFile in argv
main(quoted form of POSIX path of aFile)
end repeat
end open
on run
-- ファイル選択を行う場合
-- main(quoted form of POSIX path of (choose file))
-- 引数をつけない場合
main({})
end run
#!/usr/bin/java -Dfile.encoding=UTF-8 -cp ./js.jar org.mozilla.javascript.tools.shell.Main
//
// ここに Rhino/JavaScriptのコードを記述
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment