Skip to content

Instantly share code, notes, and snippets.

@kujirahand
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kujirahand/9185581 to your computer and use it in GitHub Desktop.
Save kujirahand/9185581 to your computer and use it in GitHub Desktop.
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