Unable to send commands to unfocused window.
Moderators: Dorian (MJT support), JRL
Unable to send commands to unfocused window.
So I plan on purchasing the lite version of this software but I figured I would try the 30 day trial to see if it would work for me first.
I am glad I did. This is one serious tool and I am oblivious as to how to get it to do what I want. So here I am looking for a hand.
I run a multiple monitor desktop, and on one screen I run my game where I just need to press 1 then wait 1.1 seconds then press 2 then wait 1.1 seconds, and then press 3 and wait 0.5 seconds and then recycle (I have the recycle down by the way).
The problem is that I need to be able to work on my second monitor while the macro runs on the first not interrupting my work. So I tried the "Send Keys to Object Wizard" but the game doesn't have an object to send the key to. I just need the key to be sent to the game.
So to sum this up, how do I send "1" then "2" then "3" to an unfocused window that does not have an object in the window to focus on?
I am glad I did. This is one serious tool and I am oblivious as to how to get it to do what I want. So here I am looking for a hand.
I run a multiple monitor desktop, and on one screen I run my game where I just need to press 1 then wait 1.1 seconds then press 2 then wait 1.1 seconds, and then press 3 and wait 0.5 seconds and then recycle (I have the recycle down by the way).
The problem is that I need to be able to work on my second monitor while the macro runs on the first not interrupting my work. So I tried the "Send Keys to Object Wizard" but the game doesn't have an object to send the key to. I just need the key to be sent to the game.
So to sum this up, how do I send "1" then "2" then "3" to an unfocused window that does not have an object in the window to focus on?
-
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
This is fairly straight forward, but it might not do what you want...
The code to send the information, pause, send, etc. is easy.
In this example, Test.txt is my 'work' file, and MyGame is the game.
If I understand your descriptiton, you want to keep working on your other monitor while this script does some of the game actions for you.
The problem is that when the focus moves to the other window for the Send command you might end up typing in that window. It wont happen often, but it could.
Hopefully this will get you started...
The code to send the information, pause, send, etc. is easy.
In this example, Test.txt is my 'work' file, and MyGame is the game.
Code: Select all
//Give me time to start typing in Test.txt
SetFocus>Test.txt*
wait>5
SetFocus>MyGame*
Send>1
SetFocus>Test.txt*
Wait>1.1
SetFocus>MyGame*
Send>2
SetFocus>Test.txt*
Wait>1.1
SetFocus>MyGame*
Send>3
SetFocus>Test.txt*
Wait>0.5
The problem is that when the focus moves to the other window for the Send command you might end up typing in that window. It wont happen often, but it could.
Hopefully this will get you started...
-
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
Here is a similar conversation that may give you some more info as replies come in...
http://www.mjtnet.com/forum/objectsend ... 7390.html
http://www.mjtnet.com/forum/objectsend ... 7390.html
-
- Macro Veteran
- Posts: 267
- Joined: Mon Sep 27, 2010 8:57 pm
- Location: Seattle, WA
Are you using the window title or handle?
The handle is more precise, but will be different every time you run the program. Your script will have to capture the handle each time the script runs.
GetWindowHandle>window title goes here,WinHandle
The WIN_USEHANDLE variable must be set to 1 for SetFocus to accept a handle.
Can you add a MessageModal call and see that the handle is a 7 digit number?
Can you post the few lines of code where you are capturing the handle and calling SetFocus?
The handle is more precise, but will be different every time you run the program. Your script will have to capture the handle each time the script runs.
GetWindowHandle>window title goes here,WinHandle
The WIN_USEHANDLE variable must be set to 1 for SetFocus to accept a handle.
Can you add a MessageModal call and see that the handle is a 7 digit number?
Can you post the few lines of code where you are capturing the handle and calling SetFocus?
So I have tried everything, and have been working on this for days. I just need something like this:
So basically I need to to get the handle of the window and set it to the variable, then I need to be able to send key stroke "1" to that variable being the game window. and then wait 1.1 seconds and then send 2 to the same game window, and then wait 1.1 seconds and then reset and go back to 1 and repeat.
"The Secret World" is the name of the game that I would like to be able to run the macro on while I can do my work on the second monitor. Having to stop the macro setup on my G510 keyboard and then to jump over to the chat and watch my character die while I chat with a customer is very depressing.
I have contacted their support to see if they have any support for macroing, and they only thing they could tell me is that macro'ing is ok, just not unattended macroing and that they should have their own macro system in place in the next few patches, but no ETA.
Currently if I don't shut off the macro then the client gets "1" then "2" and it keeps going till I can shut it off
Code: Select all
GetWindowHandle>The Secret World,gamewindow
1
send 1 "gamewindow"
wait 1100 (milsec)
send 2 "gamewindow"
wait 1100 (milsec)
2
goto 1
"The Secret World" is the name of the game that I would like to be able to run the macro on while I can do my work on the second monitor. Having to stop the macro setup on my G510 keyboard and then to jump over to the chat and watch my character die while I chat with a customer is very depressing.
I have contacted their support to see if they have any support for macroing, and they only thing they could tell me is that macro'ing is ok, just not unattended macroing and that they should have their own macro system in place in the next few patches, but no ETA.
Currently if I don't shut off the macro then the client gets "1" then "2" and it keeps going till I can shut it off