欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Windows 腳本宿主  

Sleep 方法

在指定的時(shí)間長度內(nèi)將腳本執(zhí)行掛起,然后繼續(xù)執(zhí)行。

object.Sleep(intTime) 

參數(shù)

object
WScript 對(duì)象。
intTime
表示腳本過程處于不活動(dòng)狀態(tài)的時(shí)間間隔(毫秒)的整數(shù)值。

說明

運(yùn)行腳本的線程被掛起,釋放它所占用的 CPU。超過指定的時(shí)間間隔后,腳本繼續(xù)執(zhí)行。如果您運(yùn)行異步操作和多過程,或者您的腳本中包括由事件觸發(fā)的代碼,Sleep 方法就尤其有用。要由事件觸發(fā)腳本,則腳本必須始終處于活動(dòng)狀態(tài)(已執(zhí)行完的腳本肯定檢測不到事件)。腳本所處理的事件仍將在休眠階段執(zhí)行。

注意   賦予 Sleep 方法 0 或 –1 不一定會(huì)導(dǎo)致腳本掛起。

示例

下面的示例演示如何將一個(gè) .wsf 文件用于以不同腳本語言(VBScript 和 Jscript)寫成的兩個(gè)作業(yè)。兩個(gè)作業(yè)的功能相同 — 每個(gè)作業(yè)都運(yùn)行 Windows 計(jì)算器并將它發(fā)送給鍵擊以執(zhí)行簡單的計(jì)算。

<package>
   <job id="vbs">
      <script language="VBScript">
         set WshShell = WScript.CreateObject("WScript.Shell")
         WshShell.Run "calc"
         WScript.Sleep 100
         WshShell.AppActivate "Calculator"
         WScript.Sleep 100
         WshShell.SendKeys "1{+}"
         WScript.Sleep 500
         WshShell.SendKeys "2"
         WScript.Sleep 500
         WshShell.SendKeys "~"
         WScript.Sleep 500
         WshShell.SendKeys "*3"
         WScript.Sleep 500
         WshShell.SendKeys "~"
         WScript.Sleep 2500
      </script>
   </job>

   <job id="js">
      <script language="JScript">
         var WshShell = WScript.CreateObject("WScript.Shell");
         WshShell.Run("calc");
         WScript.Sleep(100);
         WshShell.AppActivate("Calculator");
         WScript.Sleep(100);
         WshShell.SendKeys("1{+}");
         WScript.Sleep(500);
         WshShell.SendKeys("2");
         WScript.Sleep(500);
         WshShell.SendKeys("~");
         WScript.Sleep(500);
         WshShell.SendKeys("*3");
         WScript.Sleep(500);
         WshShell.SendKeys("~");
         WScript.Sleep(2500);
      </script>
   </job>
</package>

請(qǐng)參閱

運(yùn)行腳本 | WScript 對(duì)象