system

種類オブジェクト
書式 widget.system(コマンド,終了時の処理)
解説
MacOS Xのシステム(UNIXシェル)のコマンドを実行します。終了時の処理にnullを指定した場合、コマンドは同期モードで実行されます。この場合コマンドの処理が終了するまで他の処理に移ることはできません。終了時の処理を指定した場合(コマンド実行終了時のイベントハンドラ)、処理はバックグランドで行われ、処理が終了した場合にハンドラが呼び出されます。また、このsystemコマンドを実行するにはplist.infoでAllowSystemでtrueを指定するか、AllowFullAccessでtrueを指定する必要があります。
サンプルコード
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<style type="text/css"><!--
body { margin:0px; }
form { position:absolute; top:10;left:10px; }
--></style>
<script type="text/javascript"><!--
window.onload = function()
{
cmdObj = widget.system("/bin/ls -la",null);
result = cmdObj.outputString;
document.getElementById("txtField").value = result;
}
// --></script>
</head>
<body>
<img src="Default.png">
<form>
<textarea id="txtField" rows="7" cols="32"></textarea>
</form>
</body>
</html>
実際のスクリプトをダウンロード