How To Send Inputs to Multiple Windows / Minimized Windows with Python. Or Die Trying

  Рет қаралды 73,573

Learn Code By Gaming

Learn Code By Gaming

Күн бұрын

Пікірлер: 222
@NobungaGames
@NobungaGames 2 жыл бұрын
Please Don’t stop uploading!!! You have probably the most helpful AI videos I’ve found so far! Please keep going
@marceloviana7622
@marceloviana7622 3 жыл бұрын
hey bro, please dont quit, the most pleasure content of yours is how to make bots, so you should focus on that. Your audience will increase easily, focus on various types of games.
@vitordomingos8569
@vitordomingos8569 3 жыл бұрын
yoooooo, felt actually that we were " Learning" and exploring together XD amazing man,
@compinerd732
@compinerd732 Жыл бұрын
the way you teach and show how you go about solving a problem and give us tools at hand and show us how you figure out stuff is exceptional. i thank you for all the work you've put in your videos so far.
@jinnie7882
@jinnie7882 3 жыл бұрын
I found your channel just recently and gotta say your little series on writing a bot got me back into coding and I'm having a lot of fun! :) So thank you kind sir
@umapessoa6051
@umapessoa6051 3 жыл бұрын
Hi, you don't upload videos in a while, hope you're fine, your videos are pretty helpful, please if you're reading this, we need more content like yours, make more videos when you can.
@pabloortega1569
@pabloortega1569 2 жыл бұрын
I came here to say almost the same. I hope you're doing fine. Your videos have been helping me a lot. You're amazing!!! Thanks a lot for all the videos you've made.
@Kanjas19
@Kanjas19 2 жыл бұрын
I'll leave another comment to support this. This channel is way too useful to learn anything. I hope someday you comeback man.
@cesarpadilla8358
@cesarpadilla8358 2 жыл бұрын
cant let this comment die
@SapienciaEstoica
@SapienciaEstoica 2 жыл бұрын
just notice he didn't upload anything in one year. I really hope hes okay, his channel is a hidden gem. He can explain everything so simple yet so full of useful information.
@DanielXavierDosReis
@DanielXavierDosReis 2 жыл бұрын
Came here too to show support to Ben! Please update us about you, hope you're doing fine
@aarongill1075
@aarongill1075 3 жыл бұрын
Subscribed when you said "I don't know lets figure it out." Thanks for these videos
@juliopeguero5665
@juliopeguero5665 3 жыл бұрын
lol same, really cool to see
@realhippohenry
@realhippohenry Жыл бұрын
Don’t know if you stopped making videos but, just found your channel and learnt so much useful stuff that I’ve always wanted to figure out! Thanks for the great info and I hope to see new videos from you in the future.
@kentalontaga6850
@kentalontaga6850 3 жыл бұрын
Thank you!! ive been waiting for your uploads
@CommentFrom
@CommentFrom 3 жыл бұрын
You got any plans for more videos? Really loved everything you've uploaded so far
@SaituV2
@SaituV2 2 жыл бұрын
Subscribed to you some time ago. Never regretted it. Hope you are well.
@ByteBeacon9660
@ByteBeacon9660 2 жыл бұрын
I was trying to do this for a browser game that I was automating. In the middle of trying this I found a solution specific to browsers. You can use playwright or selenium to automate a browser. This includes sending mouse and keyboard inputs on specific elements and/or coordinates of canvases. These libraries include a screenshot function which you can pair up with opencv and do image recognition. This can all work in the background. The browser doesn't have to be maximized.
@brandonesqueda4469
@brandonesqueda4469 2 жыл бұрын
Do you have an example? I just need to have 1 button be pressed in 2 browser's
@thiagosilvaferreira5725
@thiagosilvaferreira5725 3 ай бұрын
Interesting
@keklmao
@keklmao 2 жыл бұрын
I just wanted to come to your newest video to let you know i love the way you teach , and have been learning alot! thank you!
@ktc50222
@ktc50222 Жыл бұрын
Bro your content is the best python content I have ever had the pleasure to watch. I have learned so much from you in like 4 videos. I know you haven't uploaded in a while but I hope you're doing well. All the best my man, cheers!
@Alexandurs
@Alexandurs 3 жыл бұрын
This was very enlightening, thanks!
@LearnCodeByGaming
@LearnCodeByGaming 3 жыл бұрын
Thanks Alex! 😀
@Linda-mj2cz
@Linda-mj2cz 3 жыл бұрын
Love the new hairstyle :$ Great video!
@baquant
@baquant 3 жыл бұрын
I hate how I can recall those stack overflow pages.
@LearnCodeByGaming
@LearnCodeByGaming 3 жыл бұрын
lol
@mzmahid1212
@mzmahid1212 3 жыл бұрын
is it possible to input mouse clicks too while the window is minimized or inactive.
@VaticansAssasian
@VaticansAssasian 2 жыл бұрын
@@mzmahid1212 yes there is an example at object detecting playlist
@espvolt4833
@espvolt4833 3 жыл бұрын
abandoned looking for something like this for months this is sick
@gbitencourt
@gbitencourt 3 жыл бұрын
Man, the level of this content is so high.
@張修瑋-d2s
@張修瑋-d2s 2 жыл бұрын
Hey, just want to say thank you for making these videos! They are so much helpful :)
@gm4984
@gm4984 3 жыл бұрын
I think that writeprocessmemory might just be the solution. In theory there's a 1byte or 4byte value that determines if the window is active or not. This value is then used to allow/disallow inputs, if the value is flipped to a 1 then it will start reading keyboard inputs. I worked a lot with assembly and many applications prevent custom inputs, but they do still allow modified Xinput inputs, and that can also be an alternative.
@gerooqelvis3466
@gerooqelvis3466 2 жыл бұрын
could you elaborate more on this?
@lotto5883
@lotto5883 3 жыл бұрын
This is way too specific but its exactly what I'm looking for... Thanks for uploading
@kex0
@kex0 2 жыл бұрын
Specific? The amount of people asking how to do this would suggest the opposite.
@dariusz4434
@dariusz4434 11 ай бұрын
This was really helpful, great work!! Hope you are doing well!:)
@kyubi2uzumaki
@kyubi2uzumaki 3 жыл бұрын
Personally I use both post/send message for my bot but I also have find out that Autoit is also really powerful and can do things that send and post message cannot. In the end I settled on using a mix of both of them for my bot by using the pyAutoit module. This results in my bot being blazing fast and consistent for multiple windows even when unfocused.
@LearnCodeByGaming
@LearnCodeByGaming 3 жыл бұрын
PyAutoIt looks cool
@DaKrucial
@DaKrucial 3 жыл бұрын
Yup I just pyAutoit. It was the quick and easiest way to solve this problem.
@_claud
@_claud 3 жыл бұрын
Would you mind uploading it to Github or anywhere else to see how you did it? Would be interesting to see. I just ran my bots in VMs. Running them natively would be much better. xd
@Hemoplaguer
@Hemoplaguer 3 жыл бұрын
I would love some more information on how you accomplish this. I, as well as probably many others who came to this video, are still searching for a way to send input to inactive windows. Please get back to me if you care to elaborate. Discord: Chai#5765
@nicholashammond6638
@nicholashammond6638 3 жыл бұрын
@@DaKrucial It looks like autoit (and thus any bindings for it) uses PostMessage internally
@359w
@359w 3 жыл бұрын
Thanks a lot for all your videos. You have helped me a lot with deeper understanding of some of the subjects. THANKS A LOT!
@thangdinh4838
@thangdinh4838 2 жыл бұрын
You have the most interesting coding instruction channel
@canal_conectando
@canal_conectando 2 жыл бұрын
Where are you? Show up again! I love your videos! Your channel is one of the best around here.
@secretarybailey770
@secretarybailey770 2 жыл бұрын
love your work bro haircut looking wicked too
@ethanstephanis4034
@ethanstephanis4034 3 жыл бұрын
Man I’m glad you made this video I would have been going down the rabbit hole trying to do this for hours lol. I instead spent the entire day trying to get modded minecraft to run in a VM and finally got it to run at around 10 FPS which is good enough for my code to do it’s thing
@kan8602
@kan8602 3 жыл бұрын
2b2t?
@ethanstephanis4034
@ethanstephanis4034 3 жыл бұрын
@@kan8602 nah fishing in a pixelmon server. Ended up getting banned lol
@OlofMemester
@OlofMemester 3 жыл бұрын
Hey I know you probably won't see this but I am trying to write a bot for Minecraft as well and for some reason when I try to input the keys it doesn't release them. Did you encounter this issue and do you know how to fix it?
@ethanstephanis4034
@ethanstephanis4034 3 жыл бұрын
@@OlofMemester dang I replied but for some reason it didn't go through. To sum up what I said in my previous reply that I didn't acutally post There's multiple ways to simulate key presses and I think I used pydirectinput for my script. You should be able to pip install pydirect input, import it, and put pydirectinput.press('esc') I can't check that I used pydriectinput or that that works so if for some reason it gives the same bug you could try pydirectinput.keydown('esc') pydirectinput.keyup('esc') kzbin.info/www/bejne/gneneJp8h9aJf9U&ab_channel=LearnCodeByGaming video on pydirectinput
@Currychicken5
@Currychicken5 3 жыл бұрын
Oh my god. This is what I needed THANKS 😀
@nazalaMV
@nazalaMV Жыл бұрын
Hi, I'm grateful for your video. It explained well the limitation usage using python that I'm also have the same issue as yours. I can't get around to make my python program to run through a minimized window. But anyway, thanks a lot for your explanation. I'm hoping to get new updates either from this channel or this comment section for how to using python and doing automated on a minimized apps.
@jtvalente
@jtvalente 2 жыл бұрын
Great video, this helped me automate key presses in a ps4 game (using remote play linked with my computer)
@theonecallednick
@theonecallednick 3 жыл бұрын
Where were you when I was struggling to do all of these? XD I guess i wasn't looking hard enough so that was my fault. Love the video though and learn a lot of things!
@theonecallednick
@theonecallednick 3 жыл бұрын
Well I'm still struggling to do it xD. I just did some workarounds accepting slme comprises lol
@lussindo
@lussindo Ай бұрын
We need you, comeback legend!
@simonsmaster12
@simonsmaster12 3 жыл бұрын
Thanks for the informations. Now i can start my project.
@cesarpadilla8358
@cesarpadilla8358 2 жыл бұрын
hey bro, hope you are ok pretty thankful with the vids you uploaded
@funktionone821
@funktionone821 10 ай бұрын
We didn not see you since long time, I have a great video suggestion for you, make a video about how to connect a custom trained YoloV8 model to any game window. The current version is V8 which has so many options, for Detection ,Tracking, Segmentation and so on, now it is even easier deploying implementing for custom projects. Reply
@s_e_t_z3248
@s_e_t_z3248 2 жыл бұрын
Where have you been man? I love your videos, they got me into coding and I cannot thank you enough.
@snowmanstan3933
@snowmanstan3933 3 жыл бұрын
You should do a series about ML playing a video game. That would be pretty dang cool
@SkuldVi
@SkuldVi Жыл бұрын
best code channel
@Vylerr
@Vylerr 3 жыл бұрын
i have ran into this problem too and have been on all of those stack overflow pages. damn
@dc22199x
@dc22199x 3 жыл бұрын
You need coroutine to do that rather than blocking each window, or create a json file where it contains the lists of PIDs used so you can run the main.py multiple times, thus you dont need to have that forloop
@Kanjas19
@Kanjas19 2 жыл бұрын
this is really helpfully.thank you so much.
@emiliomota2459
@emiliomota2459 3 жыл бұрын
dang you are a genius bro
@jjang_won
@jjang_won 3 жыл бұрын
Thank you for the tutorials! This is exactly what I looking for. However, I struggle with one more problem. Could you help me if you don’t mind? I want to assign hotkeys to start/pause/reload/exit macro in Python. The macro is infinite loop, like AutoHokey code below. F1:: Loop { DoSomething() } Return F2::Pause F3::Reload F4::ExitApp
@bmfs348
@bmfs348 3 жыл бұрын
Not sure if you figured it out, but the easiest way is probably to have two different threads
@guimauve522
@guimauve522 3 жыл бұрын
I would look into creating virtual keyboard and mouses. I know that there used to be one app on windows that was able to do just that but apparently it isn't working as good since some windows updates.. It was created so people would be able to connect multiple mouses to a pc so they could all work from the same machine; this would let you do most of what you want I believe
@piorprogramadorbr9481
@piorprogramadorbr9481 2 жыл бұрын
Ppjoykey?
@kosmonautofficial296
@kosmonautofficial296 Жыл бұрын
hey man hope you are doing well I miss this amazing videos!
@messto531
@messto531 11 ай бұрын
he is dying Rest In peace i guess
@zosyn320
@zosyn320 2 жыл бұрын
Hey man, hope you're doing well, love your videos, hope you come back and post some more ! :)
@Hemoplaguer
@Hemoplaguer 3 жыл бұрын
Ah, so still no solution... I was really hopeful. I got excited when I read your title.
@SixtySixVideo
@SixtySixVideo 3 жыл бұрын
same
@7up340
@7up340 3 жыл бұрын
I'm not a python guy but this was interesting and entertaining for me
@lethanhphong7812
@lethanhphong7812 2 жыл бұрын
8 months now still :( i hope you okay
@foxpro9524
@foxpro9524 3 жыл бұрын
Your fan from Vietnam. Hello, could you make a video about "Detect custom object using HOG cascade training". Thanks a lot.
@alexsalgado-developeradvoc2886
@alexsalgado-developeradvoc2886 10 ай бұрын
congrats!! Does it works for MacOS?
@erykadolphson9491
@erykadolphson9491 3 жыл бұрын
Thank you!!
@saw6053
@saw6053 Жыл бұрын
Hey man, how are you? Have you stopped making youtube content? Hope all is good with you. Cheers and thanks for the great content.
@WholesomeContentForYou
@WholesomeContentForYou 3 жыл бұрын
love the videos keep it up!
@Sockheadrps
@Sockheadrps 2 жыл бұрын
keep it up, im subbing!
@TheFormerTeam
@TheFormerTeam 3 ай бұрын
I found in auto hot key that this works quite well to send to a background window but if you're trying to do multiple copies of the same window then it doesn't work so well. ControlSend, , {input here}, *windowTitle
@Erotukas
@Erotukas Жыл бұрын
Scripting program called uopilot as well as autoit can do it easily. Maybe Python is limited in that sense, or libraries needs to be created to make it work with unfocused windows
@00Jannis00
@00Jannis00 2 жыл бұрын
This is exactly what I am looking for :) is this also possible for macOs?
@Processador_DE_BaixaQualidade
@Processador_DE_BaixaQualidade 2 жыл бұрын
Hey i'm new here,i actually can't understand nothing that he's saying in the video,what i need to know to do the exactly thing that he did in the video?
@frazz2k4
@frazz2k4 3 жыл бұрын
Bro when you coming back with more videos, we miss you!
@taoufikidrissi835
@taoufikidrissi835 3 жыл бұрын
Would it be possible to make a series about Man In The Middle bots MITM in Python of course, seeing how to read the signals. hooking, sockets all that good stuff . Also I made a first bot using your series for another video game and IT WORKS WONDERS !
@abdallahazme3737
@abdallahazme3737 3 жыл бұрын
Excuse me Ben, is this mean you cannot use the bot you have build for Alibion online on more than window?
@ebadaniba0
@ebadaniba0 2 жыл бұрын
Sir, do you have some content about identify a image in window and move to it using WASD? i saw you videos about opencv, but i cant find nothing about WASD moving to detected object.
@promisedid4571
@promisedid4571 3 жыл бұрын
que daora, irei ver todos vídeos.
@s1dev
@s1dev 3 жыл бұрын
man, you are just awesome. I am having trouble with pyautogui when importing from a different .py file and it just didn't work. also, I wanted to know if I could resize a window(resize x,y) and position it on my screen with code?
@poepew417
@poepew417 2 жыл бұрын
i am a developer who uses MacOs. Which libraries should I choose for handling windows?
@farfalleus8568
@farfalleus8568 2 жыл бұрын
Do you think you could use multithreading to press two keys at once?
@ryanthompson1326
@ryanthompson1326 3 жыл бұрын
You could put the bot in it's own vm and have it view an rdp window from the host.
@dharmatejasingampalli6480
@dharmatejasingampalli6480 Жыл бұрын
Is it possible to send multiple inputs of same to single application...like example I want to mimic ctrl+c on multiple text box in a desktop application at once or having tab key work on two or more text boxes at once....is there any approach or idea on this
@Diduty
@Diduty 7 ай бұрын
really helpfull tks u alot
@lilyannabalowaara11
@lilyannabalowaara11 3 жыл бұрын
My biggest flex, this is my uncle
@usto4361
@usto4361 2 жыл бұрын
Is he doing well?
@lyricsms5448
@lyricsms5448 3 жыл бұрын
I love this but I wanted to know something. So how easy is it for Anti-cheats to detect that your mouse clicks or mouse movement comes from a program or hardware? Like if I send the mouse movement command via program would that be easy for them to detect? Would it be harder to detect if its hardware?
@XXnlcodXX
@XXnlcodXX 3 жыл бұрын
They are just gonna see what inputs you did/do, not the source that is sending the inputs. So if you make the movement consistent , they will detect it fast. No way a human is following exact same pixels/pathing every time, or move crazy fast etc etc. The trick is getting it to randomise and act "human like".
@w0lm7b97
@w0lm7b97 Жыл бұрын
hope you are doing well wherever you are!
@pizza88
@pizza88 2 жыл бұрын
Hi I used AutoHotkey which actually has send keys function, you may try that with python associated?
@SRFxVideos
@SRFxVideos 3 жыл бұрын
Hello, why don't you upload anything?
@IARENOBODY
@IARENOBODY 3 жыл бұрын
Can you do a video on detecting sounds from a game?
@schindlerjahudisi9837
@schindlerjahudisi9837 3 жыл бұрын
Thank youu
@SonsuzPotansiyel
@SonsuzPotansiyel 3 жыл бұрын
Can you take a video for how to use metin2 fish bot
@LearnCodeByGaming
@LearnCodeByGaming 3 жыл бұрын
I haven't heard of that game, I'll check it out
@SonsuzPotansiyel
@SonsuzPotansiyel 3 жыл бұрын
@@LearnCodeByGaming appreciate you
@harique9204
@harique9204 3 жыл бұрын
@@SonsuzPotansiyel Simple thing just search for title of numbers for space clicks or if there is image apearing over your head that s waaay easier.
@piorprogramadorbr9481
@piorprogramadorbr9481 2 жыл бұрын
Am trying to create a bot for a game, but I wanna do mouse clicks in a minimize window
@richardking6980
@richardking6980 2 жыл бұрын
Out of interest, why can we not use pyautogui and just select the windows when broadcast the inputs?
@tonyr0xx
@tonyr0xx Жыл бұрын
do you now how to set workwindow by mouse position ? i need to send keys like 1, 2, 3, to a game.exe in minimized window, this window must be captured by a mouse positon, by PID and set PID to workwindow.
@nafisarkar3587
@nafisarkar3587 3 жыл бұрын
Man you are awesome.
@mzmahid1212
@mzmahid1212 3 жыл бұрын
is it possible to input mouse clicks too while the window is minimized or inactive.
@ИванИванов-ш1ш1й
@ИванИванов-ш1ш1й Ай бұрын
man where are u? we need u!!
@ineverchangemyplayericon3016
@ineverchangemyplayericon3016 3 жыл бұрын
This video reminded me of the pain in win32. I even made a SO post about windows messages and it was down voted by an ex MS employee because I was asking something that is not possible. Idk if Linux has a better window message architecture for user inputs. The answer is probably just use a better OS. But it may be possible to rewrite windows message architecture, but probably not worth it.
@グルイズビオ
@グルイズビオ 9 ай бұрын
any way to send mouse click? the video does explain for key and it works, but idk what for mouse click
@sak.4001
@sak.4001 7 ай бұрын
Ahk lib?
@nossasaude241
@nossasaude241 Жыл бұрын
Make a video of how get position of sprites in game by memory address.
@dharmatejasingampalli6480
@dharmatejasingampalli6480 2 жыл бұрын
Hai..is there any possible ways to record keyboard strocks and repeat it when we call a method...
@Dannybeasted
@Dannybeasted 3 жыл бұрын
hey, can you do more javascript stuff? great content!
@LearnCodeByGaming
@LearnCodeByGaming 3 жыл бұрын
Thanks! Yeah I plan on doing more javascript stuff. Anything in particular you'd like to see?
@Dannybeasted
@Dannybeasted 3 жыл бұрын
Learn Code By Gaming maybe how to work with APIs from game companies such as riot games and display the data somewhere
@Dannybeasted
@Dannybeasted 3 жыл бұрын
Learn Code By Gaming or making a browser based game, spin the wheel or blackjack/ chess
@AhmedMusrin
@AhmedMusrin 3 жыл бұрын
@@LearnCodeByGaming I loved the runescape scripting series. Maybe something similiar:D
@iapeiro4077
@iapeiro4077 3 жыл бұрын
Is there a way to find a new opened window? For example, I want my bot to open 2 windows at a time for 30 minutes then open another 2, and windows will have the name (window1,window2,window3,etc)
@sciencekhuong
@sciencekhuong 2 жыл бұрын
if you can put bot and game run in raspberry pi or server, run 24/7 it will be very cool
@RainDevs
@RainDevs 3 жыл бұрын
lmao I died trying and went with running the game in a VM lol.
@LearnCodeByGaming
@LearnCodeByGaming 3 жыл бұрын
lol nice
@LearnCodeByGaming
@LearnCodeByGaming 3 жыл бұрын
@PurpleToast good tip! I'll need to try that
@hollijohnson
@hollijohnson 3 жыл бұрын
🤣 RIP
@beeasy247
@beeasy247 Жыл бұрын
Any solution for sending a mouse click to a specific part of the window (without taking the mouse or focus away from whatever the user is doing)
@oma6393
@oma6393 Жыл бұрын
win32gui.PostMessage() will work,for keyboard you need send to pids
@BillyGamerTH
@BillyGamerTH 10 ай бұрын
where are u sir
@tetteykn110
@tetteykn110 2 жыл бұрын
im nob in Python and this stuff, can you create me 4 keyboard keys to send to game? for example i want to press "E then Z then Shift then Space" i want to create script like when i press F8 it sends that inputs when im playing a game.
@kalopseeia1617
@kalopseeia1617 3 жыл бұрын
Please Make Tutorial for Tensorflow,
@lordraphi
@lordraphi 2 жыл бұрын
Can you come back and show us some more cool stuff? Thank you :)
@CoderKid12
@CoderKid12 3 жыл бұрын
Nice Content
@ohFoou
@ohFoou 2 жыл бұрын
Why did you stop uploading
I tried to make a Valorant AI using computer vision
19:23
River's Educational Channel
Рет қаралды 1,5 МЛН
How I make bots using python (educational)
17:12
Kian Brose
Рет қаралды 563 М.
Thank you Santa
00:13
Nadir Show
Рет қаралды 54 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 51 МЛН
Hacking a Game From 2000 To Run On Windows 11
16:22
Nathan Baggs
Рет қаралды 72 М.
This tiny computer changes EVERYTHING
15:57
Jeff Geerling
Рет қаралды 726 М.
Fast Window Capture - OpenCV Object Detection in Games #4
30:48
Learn Code By Gaming
Рет қаралды 241 М.
2 Python Developers VS $1000
15:04
PolyMars
Рет қаралды 1,8 МЛН
My thoughts on framework after daily driving it for 2 years
16:34
Louis Rossmann
Рет қаралды 725 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 736 М.
Every Softlock in Portal
43:08
Marblr
Рет қаралды 1 МЛН
I made Games with Python for 10 Years...
28:52
DaFluffyPotato
Рет қаралды 371 М.
How to make advanced image recognition bots using python
15:01
Kian Brose
Рет қаралды 1,4 МЛН
FastAI learns to play Fall Guys - Undetectable Fall Guys bot.
12:13
ClarityCoders
Рет қаралды 799 М.