国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > VBScript > 正文

vbscript sendkeys實(shí)例代碼大全

2019-10-26 18:01:02
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

其使用格式為:object.SendKeys string 

“object”:表示W(wǎng)shShell對(duì)象 
“string”:表示要發(fā)送的按鍵指令字符串,需要放在英文雙引號(hào)中。 

1.基本鍵 

  一般來(lái)說(shuō),要發(fā)送的按鍵指令都可以直接用該按鍵字符本身來(lái)表示,例如要發(fā)送字母“x”,使用“WshShell.SendKeys "x"”即可。當(dāng)然,也可直接發(fā)送多個(gè)按鍵指令,只需要將按鍵字符按順序排列在一起即可,例如,要發(fā)送按鍵“happy”,可以使用“WshShell.SendKeys "happy"”。 

2.特殊功能鍵 

  對(duì)于需要與Shift、Ctrl、Alt三個(gè)控制鍵組合的按鍵,SendKeys使用特殊字符來(lái)表示: 

Shift---------WshShell.SendKeys "+" 
Ctrl---------WshShell.SendKeys "^" 
Alt---------WshShell.SendKeys "%" 

由于“+”、“^”這些字符用來(lái)表示特殊的控制按鍵了,如何表示這些按鍵呢? 

只要用大括號(hào)括住這些字符即可。例如: 

要發(fā)送加號(hào)“+”,可使用“WshShell.SendKeys "{+}"” 

另外對(duì)于一些不會(huì)生成字符的控制功能按鍵,也同樣需要使用大括號(hào)括起來(lái)按鍵的名稱,例如要發(fā)送回車鍵,需要用“WshShell.SendKeys "{ENTER}"”表示,發(fā)送向下的方向鍵用“WshShell.SendKeys "{DOWN}"”表示。 

Space---------WshShell.SendKeys " " 
Enter---------WshShell.SendKeys "{ENTER}" 
←---------WshShell.SendKeys "{RIGHT}" 
↑---------WshShell.SendKeys "{UP}" 
F1---------WshShell.SendKeys "{F1}" 

Tips:如果需要發(fā)送多個(gè)重復(fù)的單字母按鍵,不必重復(fù)輸入該字母,SendKeys允許使用簡(jiǎn)化格式進(jìn)行描述,使用格式為“{按鍵 數(shù)字}”。例如要發(fā)送10個(gè)字母“x”,則輸入“WshShell.SendKeys "{x 10}"”即可。 

實(shí)例: 
---------------------------------------------------- 
按下F5刷新桌面 

Dim WshShell,Path,i 
Set WshShell = WScript.CreateObject("WScript.Shell") 
WshShell.SendKeys "{F5}" 
---------------------------------------------------- 
電腦的自動(dòng)重啟 

set WshShell = CreateObject("WScript.Shell") 
WshShell.SendKeys "^{ESC}u" 
WshShell.SendKeys "R" 
---------------------------------------------------- 
啟動(dòng)任務(wù)管理器 

set WshShell = CreateObject("WScript.Shell") 
WshShell.SendKeys "^+{ESC}" 
---------------------------------------------------- 
QQ消息群發(fā) 

Dim WshShell 
Set WshShell= WScript.createObject("WScript.Shell") 
WshShell.AppActivate "bomb" 
for i=1 to 60 
WScript.Sleep 800 
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 宁远县| 平泉县| 都江堰市| 洪泽县| 崇义县| 蓬莱市| 仙居县| 那曲县| 汝南县| 新龙县| 宜良县| 海林市| 克什克腾旗| 松桃| 菏泽市| 芜湖县| 巴林右旗| 保亭| 互助| 贵阳市| 临泽县| 平陆县| 广平县| 江西省| 卢氏县| 文昌市| 克东县| 股票| 遂宁市| 乌苏市| 华坪县| 珲春市| 龙山县| 仲巴县| 定远县| 茌平县| 德州市| 仪陇县| 惠东县| 宁陕县| 双柏县|