vbs sendKeys 16進(jìn)制的結(jié)合使用(打開(kāi)IE,靜音,打開(kāi)播放器等)

字號(hào):


    看到demon.tw的文章,發(fā)現(xiàn)的sendkeys 16進(jìn)制的效果,非常的不錯(cuò),喜歡的朋友可以參考下。
    代碼如下:
    Dim WshShell
    Set WshShell = CreateObject("Wscript.Shell")
    下面的每一行都是一個(gè)不錯(cuò)的命令,請(qǐng)說(shuō)出運(yùn)行下列每個(gè)語(yǔ)句的效果。不要一次運(yùn)行全部,逐個(gè)看效果。
    '打開(kāi)IE
    'WshShell.SendKeys Chr(&H88AC)
    '系統(tǒng)靜音
    'WshShell.SendKeys Chr(&H88AD)
    'WshShell.SendKeys Chr(&H88AE)
    'WshShell.SendKeys Chr(&H88AF)
    'WshShell.SendKeys Chr(&H88B4)
    'WshShell.SendKeys Chr(&H88B5)
    'WshShell.SendKeys Chr(&H88B6)
    'WshShell.SendKeys Chr(&H88B7)
    結(jié)合使用打開(kāi)IE,輸入www.jb51.net 回車(chē)
    代碼如下:
    Dim WshShell
    Set WshShell = CreateObject("Wscript.Shell")
    WshShell.SendKeys Chr(&H88AC)
    Wscript.Sleep 2000
    WshShell.SendKeys "www.jb51.net"
    WshShell.SendKeys "{enter}"
    讓系統(tǒng)靜音的代碼,將下面的代碼保存為1.vbs,雙擊運(yùn)行即可。
    代碼如下:
    Dim WshShell
    Set WshShell = CreateObject("Wscript.Shell")
    WshShell.SendKeys Chr(&H88AD)
    剩下的自己研究吧,研究出來(lái)的朋友可以留言補(bǔ)充。
    一般來(lái)說(shuō)SendKeys并不可靠,因?yàn)榇翱诮裹c(diǎn)經(jīng)常難以預(yù)料和控制。AppActivate方法有時(shí)會(huì)導(dǎo)致窗口閃爍,然后無(wú)法再激活,且對(duì)未知窗口標(biāo)題的程序更是沒(méi)有辦法。