Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Shift Hold down Keyboard key KEYDOWN KEY_DOWN Keyboardstate
I am currently using version 2000C, DllVer 3.0 cbv. Is there anything like this in this version that I may be overlooking or is this something you can add to a future version?
Since you need the to hold the Shift key down. One thing you might try is using the MousePlay function. MousePlay accepts the WIL constants @SHIFT and @CTRL in the "buttons" parameter. You can combine these constants with a mouse button constant using the bitwise OR ('|') operator to duplicate holding down the Shift or Control key while performing a mouse drag-and-drop or button click.
While !WinExist("window Title") ;Holds SHIFT key down for 5 Seconds MousePlay( "", "", "", @SHIFT, 5) Endwhile
I need to send a Shift/Enter and then keep holding down the Shift key until the next window comes up. So this is my current code using the tip you gave me:
WinWaitExist("Host",-1) ;wait for the Hosts window to come up SendKeysTo("Host","menu") ;open the menu program and wait for the window to come up TimeDelay(2) ;wait SendKeysTo("Host","+{Enter}") ;open the menu program and wait for the menu login window to come up While !WinExist(menulogintitle) MousePlay( "", "", "", @SHIFT, 5) ;hold SHIFT key down for 5 Seconds Endwhile WinActivate(menulogintitle) SendKey(stuff) ;send the login string proceed.....
If I don't continue to hold down the shift key after sending Enter, then the menu login window will not come up. Once it does, I can let go of the Shift key and type in my next set of characters, etc.
When I suggested a "toggle" for Shift or Ctrl, I meant I would like a direct way to say HOLD DOWN SHIFT and LIFT UP SHIFT NOW. thus, iIn the above example, I wouldwrite ...
HOLD DOWN SHIFT SendKey ("{ENTER}") WinWaitExist ("menu login", -1) LIFT UP SHIFT NOW proceed.....
dll = StrCat(DirWindows(1), "user32.dll") DllCall(dll, void:"keybd_event", long:16, long:0, long:0, long:0); shift key down Delay(5) DllCall(dll, void:"keybd_event", long:16, long:0, long:2, long:0); shift key up
Let me know how it works out for you...
dll = StrCat(DirWindows(1), "user32.dll") DllCall(dll, void:"keybd_event", long:16, long:0, long:0, long:0); shift key down SendKeysTo("Host","+{Enter}") ;open the menu program and wait for the window to come up While !WinExist(menulogintitle) ;Wait for the menu login tilebar to appear Delay(1) Endwhile DllCall(dll, void:"keybd_event", long:16, long:0, long:2, long:0); shift key up
Thanks to you and the developer for your responsiveness. I like working with WinBatch people.
Article ID: W14603
Filename: Holding down a key.txt
File Created: 2006:07:05:10:58:34
Last Updated: 2006:07:05:10:58:34