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;








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.










share|improve this question
























  • 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












  • 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


















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.










share|improve this question
























  • 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












  • 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














0












0








0


1






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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 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












  • 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











  • 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

















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













1 Answer
1






active

oldest

votes


















1















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





share|improve this answer

























  • 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










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
);



);













draft saved

draft discarded


















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









1















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





share|improve this answer

























  • 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















1















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





share|improve this answer

























  • 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













1














1










1









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





share|improve this answer













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






share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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






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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현