MozTW 討論區
https://forum.moztw.org/

有沒有寫過windows script
https://forum.moztw.org/viewtopic.php?f=2&t=9137
1 頁 (共 1 頁)

發表人:  cs_yckad [ 2005-06-27, 22:51 ]
文章主題 :  有沒有寫過windows script

我想當沒有firefox 就會自動開啟,但找找不到firefox 的progid,
請各位幫忙

發表人:  cs_yckad [ 2005-06-28, 23:59 ]
文章主題 : 

已經成功了,那樣就會每10 分鐘看看有沒有firefox run 緊,沒有就開一個,方便家人用firefox,因為通常見到有個brower開著都不會開一個新的,便他們習慣用firefox, 大家都試試

Set WshShell = WScript.CreateObject("WScript.Shell")


dim min ,time
min= 10 'how many minutes you want to check
time = min*60*1000
While true
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set service = locator.ConnectServer()
Set props = service.ExecQuery("select name, description from Win32_Process where name = 'firefox.exe'") 'find there exist firefox running or not

If props.count = 0 Then
FF= WShShell.Run("firefox.exe",3,true)

End If
Wscript.Sleep time
Wend

1 頁 (共 1 頁) 所有顯示的時間為 UTC + 8 小時
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/