Skip to content

Instantly share code, notes, and snippets.

@azu
Created June 25, 2010 18:45
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 azu/453264 to your computer and use it in GitHub Desktop.
Save azu/453264 to your computer and use it in GitHub Desktop.
プロセスを起動して落ちるのを待つだけ
// ==UserScript==
// @name process_run
// @namespace http://efcl.info/
// @description プロセスを起動
// @author azu
// @homepage http://efcl.info/
// @twitter https://twitter.com/azu_re
// ==/UserScript==
// 実行ファイル名がnotepad.exeなプロセスが無い場合、cmdでnotepad
if(!Process.find("notepad.exe")){
Process.create("notepad");
}
// プロセスが終わるまで待機する
var p = Process.waitExtinct("notepad.exe");
if(!p){
println("notepad is dead");
}else{
println("まだ生きてる")
}
/* 下みたいなイメージだったけど違った
if(!Process.find("notepad.exe")){
var p = Process.create("notepad");
}
var processEnd = p.waitForExit();
if(processEnd){
println("notepad is dead");
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment