1

So, im playing this silly game on which when you press the key 'e' you grab all the itens nearby. First i was just using this command so it did it "automatically".

@echo off  
pause  
:loop   
nircmd wait 3000
nircmd sendkeypress e
goto loop

but this implies that the game window always have to be on the top of all windows, but sometimes i want to grab these itens with the window minimized so i tried using this line

@echo off
:loop
nircmd wait 3000
nircmd win sendmsg ititle "gamename" 0x45 0 0
goto loop

In case you never heard of it, nircmd is a little cmd-addon you can download. The 'win sendmsg' command reference says this: Send a message to the specified window. The 3 values in [Additional Parameters] specifies the message parameters: Msg, wParam, lParam.

But, it isn't working and I have no idea why. Is there any way i can do it just using cmd?

I'll link here the Nircmd - Command Reference in case I didn't made it clear

Sabir Khan
  • 9,826
  • 7
  • 45
  • 98
  • 1
    cant you set the needed window on focus? – npocmaka Jan 07 '17 at 17:01
  • 1
    try [sendKeys.bat](https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/sendKeys.bat) . It accepts the window name as a first argument and the second is the keys you want to send.It can be used for programs that are not on focus. – npocmaka Jan 07 '17 at 17:06
  • 1
    Sendmsg will talk to the win api, IIRC to send keystrokes you need 0x102 and wparam the dec ascii val lower case e being 101. So try `nircmd win sendmsg ititle "gamename" 0x102 101 1` –  Jan 07 '17 at 19:25
  • How is this question linked to tag [tag:spring-batch]?? – aschipfl Jan 09 '17 at 14:35
  • OOh thanks a lot. did work – Adriano Araujo Jan 09 '17 at 20:51

0 Answers0