How to mock the background window to active state using VBscript?

后端 未结 1 747
失恋的感觉
失恋的感觉 2020-12-12 08:37

How to mock the background window to active state using VB script?

There is some keycode command I need to send to some background window(I known the related VB func

相关标签:
1条回答
  • 2020-12-12 09:04

    Yes there is, see this example

    Dim oShell
    Set oShell = CreateObject("WScript.Shell")
    'bring the window to front
    'title must be exactly what you see in the titlebar of the window
    oShell.AppActivate "title of your window" 
    WScript.Sleep 500 'give the window the time to activate, time is in miliseconds
    oShell.SendKeys "{ENTER}" 'you can send keystrokes to this window
    Set oShell = nothing
    

    if you want to minimize that window you can send keystrokes to do that, but this is language dependent so first try them manually. The following sends the keystrokes Alt (%) space and N from miNimize. Try in your window to push the Alt-Space keys to get the menu that controls this

    oShell.SendKeys "(% )N" 
    
    0 讨论(0)
提交回复
热议问题