Windows Key Support - Keystroke?

Discuss RoboTask here
Post Reply
Vego
Posts: 12
Joined: Wed Dec 06, 2006 9:31 pm
Location: United States

Windows Key Support - Keystroke?

Post by Vego »

Hi Oleg, is there a way to send the windows key as a keystroke? I.e. windows key + D to minimize all windows?Thanks,Sam
Vego
Posts: 12
Joined: Wed Dec 06, 2006 9:31 pm
Location: United States

Windows Key Support - Keystroke?

Post by Vego »

Sorry to bump my question, how would I go about doing this Oleg?Thanks,Sam
mikronos
Posts: 21
Joined: Sat Oct 21, 2006 9:09 am
Location: France

Windows Key Support - Keystroke?

Post by mikronos »

Hi Sam.Actually I think that Robotask can't intercept the windows key.But there is way ( I use it !! ) to do that with a little part of basic programming.This is the basic code used for this:Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Sub Main    ' simul pressing key   keybd_event 91, 0, 0, 0 'win    keybd_event 68, 0, 0, 0 'D      Sleep (5)    ' now release key    keybd_event 68, 0, 2, 0 'D    keybd_event 91, 0, 2, 0 'win    Sleep(5)End SubThis little piece of code generate the appropriate event. Note that if you want to simul another key you just have to change the ascii code of this example. Here the number 68 is the ascii letter for 'D'I join the entire code here ( use import for use it in robotask ), I'm sure that what you want!!cheer, -Mikronos.;**********************;* RoboTask Task file *;* Do not edit!       *;********************** [Root]ActionAfterRun=INTEGER|0Actions=FOLDERAutomat=INTEGER|-1CatID=INTEGER|0ContinueOnError=INTEGER|0ExternalName=STRING|"Simul_WIN_D"Hide=INTEGER|0ID=INTEGER|1620541461Name=STRING|"Simul_WIN_D"Priority=INTEGER|3RunOnClose=INTEGER|0RunOnStartup=INTEGER|0ToLog=INTEGER|3[Actions]Action1=FOLDER[Actions\Action1]ActionID=STRING|"BASIC_SCRIPT"Enabled=INTEGER|-1Name=STRING|"Basic Script"Params=FOLDER[Actions\Action1\Params]line00001=STRING|"Declare Sub keybd_event Lib ""user32"" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)"line00003=STRING|"Declare Sub Sleep Lib ""kernel32"" (ByVal dwMilliseconds As Long)"line00006=STRING|"Sub Main"line00008=STRING|"    ' simul pressing key"line00009=STRING|"   keybd_event 91, 0, 0, 0 'win"line00010=STRING|"    keybd_event 68, 0, 0, 0 'D"line00011=STRING|"    Sleep (5)"line00013=STRING|"    ' now release the key"line00014=STRING|"    keybd_event 68, 0, 2, 0 'D"line00015=STRING|"    keybd_event 91, 0, 2, 0 'win"line00016=STRING|"    Sleep(5)"line00018=STRING|"End Sub"linecount=STRING|"19"source=STRING|"0"
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Windows Key Support - Keystroke?

Post by Oleg »

Great!
"Send keystrokes" is in need of improvement and doesn't support Win-key now.
Vego
Posts: 12
Joined: Wed Dec 06, 2006 9:31 pm
Location: United States

Windows Key Support - Keystroke?

Post by Vego »

That's great! Thank you Mikronos!Send keystrokes is one of the easier ways to automate basic work flow (for us not as programming centric folk) since I can watch the script working with the program after executing. Robotask has already saved me over 5 hours of work!~Sam
Post Reply