Created
June 25, 2010 18:45
-
-
Save azu/453264 to your computer and use it in GitHub Desktop.
プロセスを起動して落ちるのを待つだけ
This file contains 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
// ==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