Last active
August 29, 2015 13:56
-
-
Save kujirahand/9185581 to your computer and use it in GitHub Desktop.
Rhino/JavaScriptをMacアプリに仕上げる方法 ref: http://qiita.com/kujirahand/items/5a327970e0d0b60be14a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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