How would i go about simulating direct input to an inactive window?Simulate Python keypresses for controlling a gameHow do you run a Python script as a service in Windows?How to remove the border highlight on an input text elementHow to remove focus border (outline) around text/input boxes? (Chrome)How do I install pip on Windows?How do I get the value of text input field using JavaScript?Simulate Python keypresses for controlling a gamePython active window loggerHow to simulate keys in game with pywinautoPython Mouse Click For Game (Direct Input)Direct Input in Euro Truck Simulator not working
Are sweatpants frowned upon on flights?
Is it good practice to speed up and slow down where not written in a song?
Get contents before a colon
Why can't miners meet the difficulty by picking a low number for the block hash?
Under GDPR, can I give permission once to allow everyone to store and process my data?
How to differentiate between two people with the same name in a story?
Do manacles provide any sort of in-game mechanical effect or condition?
How do you say "half the time …, the other half …" in German?
How to save money by shopping at a variety of grocery stores?
RAID0 instead of RAID1 or 5, is this crazy?
Are spot colors limited and why CMYK mix is not treated same as spot color mix?
Did the Apollo Guidance Computer really use 60% of the world's ICs in 1963?
Spicing up a moment of peace
Should I use the words "pyromancy" and "necromancy" even if they don't mean what people think they do?
What is this "opened" cube called?
Pen test results for web application include a file from a forbidden directory that is not even used or referenced
Do universities maintain secret textbooks?
'Horseshoes' for Deer?
How can I improve my formal definitions
What is the purpose of Strength, Intelligence and Dexterity in Path of Exile?
Group riding etiquette
What should be done with the carbon when using magic to get oxygen from carbon dioxide?
How to handle inventory and story of a player leaving
Journal published a paper, ignoring my objections as a referee
How would i go about simulating direct input to an inactive window?
Simulate Python keypresses for controlling a gameHow do you run a Python script as a service in Windows?How to remove the border highlight on an input text elementHow to remove focus border (outline) around text/input boxes? (Chrome)How do I install pip on Windows?How do I get the value of text input field using JavaScript?Simulate Python keypresses for controlling a gamePython active window loggerHow to simulate keys in game with pywinautoPython Mouse Click For Game (Direct Input)Direct Input in Euro Truck Simulator not working
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to send direct input to a (possibly) inactive window in python.
So far i have found a solution to send direct input via ctypes and i have a solution to simulate input to a window, which doesn't work with some games as the one i am testing with (GTA V) is using direct input, using postMessage()
via py32win.
So how would i now go about simulating those direct inputs while the target window is possibly not active? Is this even possible?
I would think it should be, because AutoHotkey for example can manage to send direct in such a case.
If you would like to experiment yourself i can provide the postMessage() version, otherwise i would like to keep the question code-free.
python input keyboard pywin32 simulate
add a comment |
I want to send direct input to a (possibly) inactive window in python.
So far i have found a solution to send direct input via ctypes and i have a solution to simulate input to a window, which doesn't work with some games as the one i am testing with (GTA V) is using direct input, using postMessage()
via py32win.
So how would i now go about simulating those direct inputs while the target window is possibly not active? Is this even possible?
I would think it should be, because AutoHotkey for example can manage to send direct in such a case.
If you would like to experiment yourself i can provide the postMessage() version, otherwise i would like to keep the question code-free.
python input keyboard pywin32 simulate
I'm not an expert on these things, but I think they would be accomplished throughwin32gui
,win32con
modules right? I know you can find handles for windows likehwnd = win32gui.FindWindow(None, 'GTA V')
or something similar, and would imagine that once you have the window handle you could just send keys to it? IDK I've never done it before
– Reedinationer
Mar 27 at 23:14
Well that's my problem. I technically got it working the way you said but since GTA V in this case for example expects direct input , it just ignores the keystrokes that are being sent to it viapostMessage(hwnd, WM_KEYDOWN, wparam, lparam)
Thus i am looking for a way to simulate direct input, which it expects
– DJSchaffner
Mar 28 at 1:13
Oh I see so this is the same problem I ran into trying to do a project. I'll try (again) to solve it for the both of us :)
– Reedinationer
Mar 28 at 3:07
So you are saying that the game requires scan codes like shown at stackoverflow.com/questions/14489013/… and you have already implemented a solution like this that works for an active window and just need to figure a method to send them to an inactive window?
– Reedinationer
Mar 28 at 6:08
Thats correct. I'd like to send those direct inputs to a specific window. Appreciate your help!
– DJSchaffner
Mar 28 at 12:02
add a comment |
I want to send direct input to a (possibly) inactive window in python.
So far i have found a solution to send direct input via ctypes and i have a solution to simulate input to a window, which doesn't work with some games as the one i am testing with (GTA V) is using direct input, using postMessage()
via py32win.
So how would i now go about simulating those direct inputs while the target window is possibly not active? Is this even possible?
I would think it should be, because AutoHotkey for example can manage to send direct in such a case.
If you would like to experiment yourself i can provide the postMessage() version, otherwise i would like to keep the question code-free.
python input keyboard pywin32 simulate
I want to send direct input to a (possibly) inactive window in python.
So far i have found a solution to send direct input via ctypes and i have a solution to simulate input to a window, which doesn't work with some games as the one i am testing with (GTA V) is using direct input, using postMessage()
via py32win.
So how would i now go about simulating those direct inputs while the target window is possibly not active? Is this even possible?
I would think it should be, because AutoHotkey for example can manage to send direct in such a case.
If you would like to experiment yourself i can provide the postMessage() version, otherwise i would like to keep the question code-free.
python input keyboard pywin32 simulate
python input keyboard pywin32 simulate
asked Mar 27 at 22:09
DJSchaffnerDJSchaffner
481 silver badge7 bronze badges
481 silver badge7 bronze badges
I'm not an expert on these things, but I think they would be accomplished throughwin32gui
,win32con
modules right? I know you can find handles for windows likehwnd = win32gui.FindWindow(None, 'GTA V')
or something similar, and would imagine that once you have the window handle you could just send keys to it? IDK I've never done it before
– Reedinationer
Mar 27 at 23:14
Well that's my problem. I technically got it working the way you said but since GTA V in this case for example expects direct input , it just ignores the keystrokes that are being sent to it viapostMessage(hwnd, WM_KEYDOWN, wparam, lparam)
Thus i am looking for a way to simulate direct input, which it expects
– DJSchaffner
Mar 28 at 1:13
Oh I see so this is the same problem I ran into trying to do a project. I'll try (again) to solve it for the both of us :)
– Reedinationer
Mar 28 at 3:07
So you are saying that the game requires scan codes like shown at stackoverflow.com/questions/14489013/… and you have already implemented a solution like this that works for an active window and just need to figure a method to send them to an inactive window?
– Reedinationer
Mar 28 at 6:08
Thats correct. I'd like to send those direct inputs to a specific window. Appreciate your help!
– DJSchaffner
Mar 28 at 12:02
add a comment |
I'm not an expert on these things, but I think they would be accomplished throughwin32gui
,win32con
modules right? I know you can find handles for windows likehwnd = win32gui.FindWindow(None, 'GTA V')
or something similar, and would imagine that once you have the window handle you could just send keys to it? IDK I've never done it before
– Reedinationer
Mar 27 at 23:14
Well that's my problem. I technically got it working the way you said but since GTA V in this case for example expects direct input , it just ignores the keystrokes that are being sent to it viapostMessage(hwnd, WM_KEYDOWN, wparam, lparam)
Thus i am looking for a way to simulate direct input, which it expects
– DJSchaffner
Mar 28 at 1:13
Oh I see so this is the same problem I ran into trying to do a project. I'll try (again) to solve it for the both of us :)
– Reedinationer
Mar 28 at 3:07
So you are saying that the game requires scan codes like shown at stackoverflow.com/questions/14489013/… and you have already implemented a solution like this that works for an active window and just need to figure a method to send them to an inactive window?
– Reedinationer
Mar 28 at 6:08
Thats correct. I'd like to send those direct inputs to a specific window. Appreciate your help!
– DJSchaffner
Mar 28 at 12:02
I'm not an expert on these things, but I think they would be accomplished through
win32gui
, win32con
modules right? I know you can find handles for windows like hwnd = win32gui.FindWindow(None, 'GTA V')
or something similar, and would imagine that once you have the window handle you could just send keys to it? IDK I've never done it before– Reedinationer
Mar 27 at 23:14
I'm not an expert on these things, but I think they would be accomplished through
win32gui
, win32con
modules right? I know you can find handles for windows like hwnd = win32gui.FindWindow(None, 'GTA V')
or something similar, and would imagine that once you have the window handle you could just send keys to it? IDK I've never done it before– Reedinationer
Mar 27 at 23:14
Well that's my problem. I technically got it working the way you said but since GTA V in this case for example expects direct input , it just ignores the keystrokes that are being sent to it via
postMessage(hwnd, WM_KEYDOWN, wparam, lparam)
Thus i am looking for a way to simulate direct input, which it expects– DJSchaffner
Mar 28 at 1:13
Well that's my problem. I technically got it working the way you said but since GTA V in this case for example expects direct input , it just ignores the keystrokes that are being sent to it via
postMessage(hwnd, WM_KEYDOWN, wparam, lparam)
Thus i am looking for a way to simulate direct input, which it expects– DJSchaffner
Mar 28 at 1:13
Oh I see so this is the same problem I ran into trying to do a project. I'll try (again) to solve it for the both of us :)
– Reedinationer
Mar 28 at 3:07
Oh I see so this is the same problem I ran into trying to do a project. I'll try (again) to solve it for the both of us :)
– Reedinationer
Mar 28 at 3:07
So you are saying that the game requires scan codes like shown at stackoverflow.com/questions/14489013/… and you have already implemented a solution like this that works for an active window and just need to figure a method to send them to an inactive window?
– Reedinationer
Mar 28 at 6:08
So you are saying that the game requires scan codes like shown at stackoverflow.com/questions/14489013/… and you have already implemented a solution like this that works for an active window and just need to figure a method to send them to an inactive window?
– Reedinationer
Mar 28 at 6:08
Thats correct. I'd like to send those direct inputs to a specific window. Appreciate your help!
– DJSchaffner
Mar 28 at 12:02
Thats correct. I'd like to send those direct inputs to a specific window. Appreciate your help!
– DJSchaffner
Mar 28 at 12:02
add a comment |
1 Answer
1
active
oldest
votes
As far as I can tell you cannot do this. A workaround (found at https://www.reddit.com/r/Python/comments/5wpxtt/automation_in_inactiveunfocused_window/) would be
- get a VM on your machine
- load the game and your script onto the VM
- run game and have your script interact with active window (on VM)
- minimize the VM window of your main machine
Mh yes, maybe there is no way to do it. However thats a good workaround you found, unfortunately i believe it's not practical to use because a VM is just too slow for such a game, especially since i would want to actually play when the bot is not active :D Have an upvote
– DJSchaffner
Mar 29 at 1:43
@DJSchaffner I'll take it :)
– Reedinationer
Mar 29 at 4:55
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387230%2fhow-would-i-go-about-simulating-direct-input-to-an-inactive-window%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As far as I can tell you cannot do this. A workaround (found at https://www.reddit.com/r/Python/comments/5wpxtt/automation_in_inactiveunfocused_window/) would be
- get a VM on your machine
- load the game and your script onto the VM
- run game and have your script interact with active window (on VM)
- minimize the VM window of your main machine
Mh yes, maybe there is no way to do it. However thats a good workaround you found, unfortunately i believe it's not practical to use because a VM is just too slow for such a game, especially since i would want to actually play when the bot is not active :D Have an upvote
– DJSchaffner
Mar 29 at 1:43
@DJSchaffner I'll take it :)
– Reedinationer
Mar 29 at 4:55
add a comment |
As far as I can tell you cannot do this. A workaround (found at https://www.reddit.com/r/Python/comments/5wpxtt/automation_in_inactiveunfocused_window/) would be
- get a VM on your machine
- load the game and your script onto the VM
- run game and have your script interact with active window (on VM)
- minimize the VM window of your main machine
Mh yes, maybe there is no way to do it. However thats a good workaround you found, unfortunately i believe it's not practical to use because a VM is just too slow for such a game, especially since i would want to actually play when the bot is not active :D Have an upvote
– DJSchaffner
Mar 29 at 1:43
@DJSchaffner I'll take it :)
– Reedinationer
Mar 29 at 4:55
add a comment |
As far as I can tell you cannot do this. A workaround (found at https://www.reddit.com/r/Python/comments/5wpxtt/automation_in_inactiveunfocused_window/) would be
- get a VM on your machine
- load the game and your script onto the VM
- run game and have your script interact with active window (on VM)
- minimize the VM window of your main machine
As far as I can tell you cannot do this. A workaround (found at https://www.reddit.com/r/Python/comments/5wpxtt/automation_in_inactiveunfocused_window/) would be
- get a VM on your machine
- load the game and your script onto the VM
- run game and have your script interact with active window (on VM)
- minimize the VM window of your main machine
answered Mar 28 at 19:52
ReedinationerReedinationer
4,0801 gold badge4 silver badges27 bronze badges
4,0801 gold badge4 silver badges27 bronze badges
Mh yes, maybe there is no way to do it. However thats a good workaround you found, unfortunately i believe it's not practical to use because a VM is just too slow for such a game, especially since i would want to actually play when the bot is not active :D Have an upvote
– DJSchaffner
Mar 29 at 1:43
@DJSchaffner I'll take it :)
– Reedinationer
Mar 29 at 4:55
add a comment |
Mh yes, maybe there is no way to do it. However thats a good workaround you found, unfortunately i believe it's not practical to use because a VM is just too slow for such a game, especially since i would want to actually play when the bot is not active :D Have an upvote
– DJSchaffner
Mar 29 at 1:43
@DJSchaffner I'll take it :)
– Reedinationer
Mar 29 at 4:55
Mh yes, maybe there is no way to do it. However thats a good workaround you found, unfortunately i believe it's not practical to use because a VM is just too slow for such a game, especially since i would want to actually play when the bot is not active :D Have an upvote
– DJSchaffner
Mar 29 at 1:43
Mh yes, maybe there is no way to do it. However thats a good workaround you found, unfortunately i believe it's not practical to use because a VM is just too slow for such a game, especially since i would want to actually play when the bot is not active :D Have an upvote
– DJSchaffner
Mar 29 at 1:43
@DJSchaffner I'll take it :)
– Reedinationer
Mar 29 at 4:55
@DJSchaffner I'll take it :)
– Reedinationer
Mar 29 at 4:55
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387230%2fhow-would-i-go-about-simulating-direct-input-to-an-inactive-window%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I'm not an expert on these things, but I think they would be accomplished through
win32gui
,win32con
modules right? I know you can find handles for windows likehwnd = win32gui.FindWindow(None, 'GTA V')
or something similar, and would imagine that once you have the window handle you could just send keys to it? IDK I've never done it before– Reedinationer
Mar 27 at 23:14
Well that's my problem. I technically got it working the way you said but since GTA V in this case for example expects direct input , it just ignores the keystrokes that are being sent to it via
postMessage(hwnd, WM_KEYDOWN, wparam, lparam)
Thus i am looking for a way to simulate direct input, which it expects– DJSchaffner
Mar 28 at 1:13
Oh I see so this is the same problem I ran into trying to do a project. I'll try (again) to solve it for the both of us :)
– Reedinationer
Mar 28 at 3:07
So you are saying that the game requires scan codes like shown at stackoverflow.com/questions/14489013/… and you have already implemented a solution like this that works for an active window and just need to figure a method to send them to an inactive window?
– Reedinationer
Mar 28 at 6:08
Thats correct. I'd like to send those direct inputs to a specific window. Appreciate your help!
– DJSchaffner
Mar 28 at 12:02