PyAutoGUI not working? Use DirectInput

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 พ.ย. 2024

ความคิดเห็น • 447

  • @itsBenjamon
    @itsBenjamon 4 ปีที่แล้ว +168

    Dude literally nowhere else explained why pyautogui doesn't work sometimes. You are my hero. Literally I'm so glad I finally found this.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +10

      Glad to help!

    • @luigiesposito2481
      @luigiesposito2481 2 ปีที่แล้ว

      @@LearnCodeByGaming hello friend please Luigi I'm Italian I don't understand English would you give me a hand? to install the program?

    • @maybelindow3906
      @maybelindow3906 2 ปีที่แล้ว +1

      @@luigiesposito2481 hi did you use Google translate to type that ( out of curiosity 👀 )

    • @ninjedi6710
      @ninjedi6710 ปีที่แล้ว +1

      @@LearnCodeByGaming what would be a recommended approach to record mouse movements in FPS games?
      im having a problem where the script thinks that the mouse is always at the center of the screen.

    • @yoursps
      @yoursps ปีที่แล้ว

      @@ninjedi6710 Faced with a similar problem. The cursor coordinates are determined centered (x=960, y=540), but the application reads them as (0, 0). This would not be a problem, but move(0, 0) transmits some wrong signal and activates the camera movement.
      Due to an error with zero translation in coordinates, the camera can only move diagonally.
      If you have a similar problem and you have found a solution, I would be grateful if you let me know.

  • @emiryassin877
    @emiryassin877 4 ปีที่แล้ว +18

    I got bored of playing games “the normal way” and I wanted to automate the boring stuff . Suddenly stumbled upon one of your videos one day , now i’m learning python (day 6)

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +4

      Awesome, have fun!

    • @deadpopcorn8523
      @deadpopcorn8523 ปีที่แล้ว

      ​@@LearnCodeByGaming pydirectinput kind of skips the duration function, please can you fix it?????
      my god it took forever to find what was wrong

  • @benjaminwilliams5116
    @benjaminwilliams5116 4 ปีที่แล้ว +53

    You are the greatest human ever.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +5

      lol, thanks!

    • @TheAmazingXizde
      @TheAmazingXizde 4 ปีที่แล้ว +1

      DANG DUDE IT WORKS, TY SO MUCH!

    • @mrweb9087
      @mrweb9087 3 ปีที่แล้ว +1

      In Windows 8.1
      pyautogui.keyDown('alt')
      pyautogui.keypress('tab')
      Time.sleep(1)
      pyautogui.keyUp('alt')
      This is not working for switching the windows
      Please help me to solve this problem
      I also try hotkey
      Please tell me the solution if anyone knows 🙏🙏

    • @lorenzo1479
      @lorenzo1479 3 ปีที่แล้ว +2

      @@mrweb9087 try pyautogui.hotkey(‘alt’, ‘tab’) function, it works, I use it since hotkey isn’t implemented in pydirectinput

    • @mrweb9087
      @mrweb9087 3 ปีที่แล้ว +1

      @@lorenzo1479 thanks✨

  • @jeremytwomey7167
    @jeremytwomey7167 3 ปีที่แล้ว +9

    Dude you are awesome! I spent a couple weeks wracking my brain on how to improve my simple bots and this was exactly what I needed! Keep up the good work.

  • @how2eatanapple975
    @how2eatanapple975 4 ปีที่แล้ว +12

    Dude thank you so much! Now I can create my evil robot of destruction in minecraft. The cost will be many lives because of this. You have given me... ULTIMATE POWER!! Seriously thanks I was stuck!
    Edit: also there is not a hotkey command but I can just use keyDown and keyUp fine

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +3

      Haha, glad to help! Yeah it doesn't have any other way to do key combos right now.

    • @deadpopcorn8523
      @deadpopcorn8523 2 ปีที่แล้ว

      @@LearnCodeByGaming i play a 3d game called "planet of cubes" i havent tested it on other 3d games but any clicking command from pydirectinput is read as holding, but when i open my inventory its all good. My theory is that is outdated

  • @Limofeus
    @Limofeus 3 ปีที่แล้ว +5

    Thanks a lot! I have a long story with this, so this was incredibly useful for me! I have tried to create simple macros for some video games about a year ago and i have tried a lot of different macro applications, different input libraries for python and NONE of them worked for any game, but what was even stranger to me is that all the inputs worked for in-game chat or any other text boxes. So i thought that all the inputs i was sending DO work, but for so little amount of time that the game could only handle them with text boxes. And this led me to spending hours and hours trying to figure out why the librarys can't hold keys but only press them for so little. And only now i found this incredibly simple, but amazingly useful video. Thank you a lot once again!

  • @yarx1922
    @yarx1922 3 ปีที่แล้ว +19

    New to python, and this tutorial is very easy and very helpful. Thank you very much!

  • @Med_Sel
    @Med_Sel 4 ปีที่แล้ว +9

    ty so much man i had to do press and hold for an amount of time before and now the presses=number of presses works which saved me a lot of lines

  • @hourz
    @hourz 4 ปีที่แล้ว +35

    For anyone that still has problems try the following:
    1)- Open CMD as Administrator
    2) - Open game up as administrator
    3) - Run the py file
    4) - focus on the game window, and watch the magic happen.
    Hope this helped :)
    (please don't make spamming/scamming chat bots thats not cool man)

    • @joseaugustodossantossilva1149
      @joseaugustodossantossilva1149 4 ปีที่แล้ว +4

      still not working

    • @krikukiks
      @krikukiks 4 ปีที่แล้ว +4

      Worked for me.
      It also worked when I ran my IDE (PyCharm) as administrator.

    • @Sergey-xf9gw
      @Sergey-xf9gw 3 ปีที่แล้ว +1

      Thank you so much I already wanted to give up on finding libraries. You're the best

    • @bakugameplays
      @bakugameplays 3 ปีที่แล้ว

      Ty king

    • @aamirnafis4139
      @aamirnafis4139 3 ปีที่แล้ว

      i wanr to spam myself previously not working now a 2nd chance

  • @Spee2k12
    @Spee2k12 4 ปีที่แล้ว +6

    YES! Thank you! This has made my Factorio repetitive task application/script work perfectly, you sir are a star, I shall be following you from now on!

    • @cavalfou
      @cavalfou ปีที่แล้ว +1

      automating in an automation game, genius XD ... though it does not work in some steam game still.

  • @psmith5573
    @psmith5573 3 ปีที่แล้ว +2

    I liked 20+ on the comments to express my emotion to this effort. The world is better with the people like you!

  • @doubleHLabs
    @doubleHLabs 4 ปีที่แล้ว +4

    This is awesome. I installed it with pip in pyCharm and tested it out. Worked first try. Now to start automating!

  • @Wavened
    @Wavened 3 ปีที่แล้ว +7

    You prevented me from getting a migraine, thank you so much!

  • @zxdvbvzdfbzdfgdg
    @zxdvbvzdfbzdfgdg 3 หลายเดือนก่อน

    Our saviour! I've been trying to set up a simple macro to automate video games so when I'm not able to play I can run my macro on a raspberry pi. While in my attempt to do this I noticed that mouse interactions would only work if I was moving the mouse around. Thank you so much!

  • @recepciftci2642
    @recepciftci2642 3 ปีที่แล้ว +1

    After all this struggle with not using pyautogui or similar libraries in the game, your solution worked. Thank you so much. You are great man.

    • @arescharles1674
      @arescharles1674 8 หลายเดือนก่อน

      click api is not working, did u use this api?

  • @Gamebito
    @Gamebito 2 ปีที่แล้ว +1

    Thanks! Discord wasn't recognizing any custom keybinds I set (in the discord settings) when using pyautogui, but using your pydirectinput works!

  • @AyaanKumar-mo7fx
    @AyaanKumar-mo7fx ปีที่แล้ว

    Genuinely thank you so much! I had been trying to fix an issue for ages and nowhere else said why pyautogui wasn't working

  • @universe6578
    @universe6578 4 ปีที่แล้ว +9

    whoa thank you so much i was struggle with this for fkn *4 hours*

  • @SimonPrefontaineGames
    @SimonPrefontaineGames 4 ปีที่แล้ว +7

    You just saved me a lot of headache! Thank you :)

  • @Alexandurs
    @Alexandurs 4 ปีที่แล้ว +3

    You should have more subscribers sir, your content is top-notch.

  • @JamBear
    @JamBear 4 ปีที่แล้ว +8

    You seem like a genuinely nice guy.

  • @raulalejandrofuentesblanco8975
    @raulalejandrofuentesblanco8975 2 ปีที่แล้ว +4

    To anyone who is having problems because your code only runs the first time, be sure that you are also doing a keyUp when your doing a keyDown.

  • @hotz5589
    @hotz5589 3 ปีที่แล้ว

    Idk if you still read through this but THANKS. I always had problem with keyboard input and this library just WORKS. Thank you so much

  • @laniakea8147
    @laniakea8147 2 ปีที่แล้ว

    Thanks to this movie, I succeeded to automate “Lightning Dodger” that is famous extremely-hard side quest of Final Fantasy X. ありがとう😊

  • @Vse8311
    @Vse8311 4 ปีที่แล้ว +5

    Thx for creating pydirectinput. Its working great!

  • @anmolsaxena3832
    @anmolsaxena3832 3 ปีที่แล้ว +1

    Found no other video that solves this problem . Thank u very much

  • @SRFxVideos
    @SRFxVideos 4 ปีที่แล้ว +2

    BROOO! YOUR LIB IS WORKING! GOOD JOB!!!! THANK YOU!
    Just launch your scripts with Administrator.

  • @joethumbsup5266
    @joethumbsup5266 3 ปีที่แล้ว +2

    man, you're awesome! i admire you professionalism!

  • @paulonascimento3461
    @paulonascimento3461 3 ปีที่แล้ว

    Dude you're the best human in the world, you just save a brazilian life and time.

  • @whxmpy56
    @whxmpy56 2 ปีที่แล้ว +1

    BRO I M GOING TO CRY THANK YOU SOOOO MUCH YOU ARE A LIFE SAVER.

  • @zuccthe4thttv887
    @zuccthe4thttv887 4 ปีที่แล้ว +3

    Thanks man! youve earned your 1000th sub!

  • @kasoa.thourcans124
    @kasoa.thourcans124 3 ปีที่แล้ว +1

    You're a genius, my hero, thank you so much, it works perfectly

  • @camvel869
    @camvel869 ปีที่แล้ว

    A big shout out to you in 2023! Thanks for helping me keep building a solution to use a coin acceptor over arduino. As my arduino can definitely not be flashed to hid so that it sends direct keyboard presses, I linked it to python where I ask it to send a key press that should insert a coin credit in mame. Problem is that the default keyboard library in python is not direct input based. This library helped a lot and then instructing mame.ini to use direct input finally made mame recognize python command. All of this would have been much simpler with arduino Leonardo but I didnt want to give up until I played with coding and thought of solutions with my arduino uno. Thanks.

  • @patta3213
    @patta3213 3 ปีที่แล้ว +12

    First of all: Great Work!!
    But I would like to ask you if there is a way to send keystrokes to an inactive window with a handle or something, so I can use this in background.

    • @LearnCodeByGaming
      @LearnCodeByGaming  3 ปีที่แล้ว +10

      Hi thanks! I'm working on a video about that right now actually. Should be out in about a week.

    • @kvnei
      @kvnei 3 ปีที่แล้ว +2

      I have the same question, really looking forward to your video!

    • @kvnei
      @kvnei 3 ปีที่แล้ว

      do you mind to share the basic idea so that I can try it first?

    • @stead2767
      @stead2767 ปีที่แล้ว

      @@LearnCodeByGaming hi teacher~~~where can I find the tutor viedo you makes~~~thank~~very a lot !!!

  • @tobagheorgheirinel703
    @tobagheorgheirinel703 4 ปีที่แล้ว +3

    One of the best video again mate👍👍👍

  • @k15e15
    @k15e15 ปีที่แล้ว

    Thank you!! You're a genius!! I'm from Russia. I have been looking for a solution to the problem for a long time and there was no information about it. But I came across your video! I've stumbled upon gold!! thank you very much for making such an addition to the library!!! You're the best! Subscribe and like! You deserve more!

  • @greedsloth1516
    @greedsloth1516 4 ปีที่แล้ว +3

    Thank you Ben! I am almost sure but i just had to ask are you a developer by career?

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +2

      I am! I've been doing it for 12 years, and since last year I've been working as an independent consultant.

  • @ЯнМатвеев-г9я
    @ЯнМатвеев-г9я ปีที่แล้ว

    tysm! i tried ALOT of libs and none of them worked, but this one did :)
    i was trying to do wave auto skip for TDS in Roblox

  • @theengineer9910
    @theengineer9910 3 ปีที่แล้ว

    THANK YOU, i have an esp32 and im making a capacitive touch usb controller for someone and this is the only program to work with the snes9 emulator !

  • @rafaelap.6193
    @rafaelap.6193 ปีที่แล้ว

    Muito obrigado, passei horas tentando arrumar isso e não achava solução em lugar nenhum, estava nas ultimas tentativas antes de desistir.

    • @ericsein
      @ericsein ปีที่แล้ว

      Bom dia, ainda funciona pra voce? pra mim ainda não funciona...
      Pode me dizer por favor qual foi a solução?

  • @aamirnafis4139
    @aamirnafis4139 3 ปีที่แล้ว

    mansood bhai tum bhuut accha kaam kartteh ho

  • @gnooox
    @gnooox 2 ปีที่แล้ว

    wow this is what i looking for upto now. it works perfectly thanks so much. subscribed before text. thanks a lot

  • @intrer8601
    @intrer8601 3 ปีที่แล้ว +1

    wow, thanks a lot! I'm really glad I found this

  • @automaticmonkTV
    @automaticmonkTV ปีที่แล้ว

    Thanks for making pydirectinput you rock

  • @__hazelnut
    @__hazelnut 3 ปีที่แล้ว +2

    You are an absolute legend tysm!

  • @eb941
    @eb941 4 ปีที่แล้ว +1

    Super Helpful! You the man

  • @normandas9647
    @normandas9647 2 ปีที่แล้ว

    omg thank you so much man after hours of searching for solutions i found this❤

  • @cristiankaz2264
    @cristiankaz2264 2 ปีที่แล้ว +3

    Very well explained and done :) I tried to use this for a game called metin2 but it still didn't work tho :( any ideas why? I tried rocket league and it works just fine. Thank you for the content

  • @ericsarason9099
    @ericsarason9099 3 ปีที่แล้ว +1

    Any idea if this will help avoid detection in games? (namely, League of legends)
    Also can I just say how much I love this channel, I recently watched all of your Albion Online videos and it was the first time I've genuinely enjoyed watching a programming tutorial.

  • @WaterWayProduction
    @WaterWayProduction 3 ปีที่แล้ว +1

    That helps a lot! Thank you
    A question that i have is: How does a anti cheat program recognize cheats and can a anti cheat program in a game recognize PyAutoGui?

  • @bulwark3371
    @bulwark3371 3 ปีที่แล้ว +1

    Great library! Thank you!

  • @decqyd
    @decqyd 3 ปีที่แล้ว +3

    do you know how i can get the mouse functions to work with looking around minecraft bedrock? ive tried using both pyautogui and pydirectinput but they dont seem to work

  • @steve7878
    @steve7878 3 ปีที่แล้ว +1

    brother this is good work, thank you for sooo much!

  • @thzeroucken
    @thzeroucken 3 ปีที่แล้ว

    holy thanks! you the only one who helped me

  • @eshdon5677
    @eshdon5677 4 หลายเดือนก่อน

    Thanks! That actually works!

  • @thiagopinheirolima7430
    @thiagopinheirolima7430 3 ปีที่แล้ว

    Bro thank you, I was getting same problem and wondering "whhhhyyyyy?"

  • @socondisk9239
    @socondisk9239 3 ปีที่แล้ว

    thanks a lot dude :), this helps me a lot. Anyway i'm new to python and i want to ask about the mouse input. Can i use float type number as the input instead of int ?

  • @yasam3780
    @yasam3780 2 ปีที่แล้ว +1

    How can I perform a click action while a directx game is running?
    I tried pyautogui, pydirectinput, pywinauto, autoit.
    None of the above modules were able to click anywhere on the both game or desktop or browser while the directx game is running.

  • @suleyk4063
    @suleyk4063 3 ปีที่แล้ว +1

    I have a question. Your library seems to work with the game Rainbow Six Siege, but the mouse movement is erratic no matter what values I put for the movement. Do you know why this might be the case? I think it might have to do with the game grabbing the mouse to the screen. I'm not sure how to go about a work-around.

  • @diekk7033
    @diekk7033 3 ปีที่แล้ว

    FINALLY I FOUND WHAT I WAS LOOKING FOR

  • @thoup9956
    @thoup9956 2 ปีที่แล้ว +1

    I wish I could donate money to you man this was so helpful

  • @splinterun9005
    @splinterun9005 4 ปีที่แล้ว +1

    I tried this library for fallout:new vegas which is a directx 9 game, as well as running the script from an administrator command prompt, however no mouse movements or keyboard inputs would work. Do you know anything else that would work?

  • @lyricsms5448
    @lyricsms5448 3 ปีที่แล้ว +2

    I love these videos but i wanted to ask you a question you might know a lot about.
    So I know that some people say that programs or anti cheats can detect a program using code to send keystrokes or button presses.
    What makes clicking the mouse button yourself over just having a program do it? Like is it true it's really more detectable that way?

  • @sameer1234ification
    @sameer1234ification 2 ปีที่แล้ว

    I've been using "mouse" python library for a while to move cursor programmatically; and I recently stumbled upon the issue that it does not get recognized by video games such as call of duty ... I noticed in the morning that "mouse" library uses the same mouse events utilized by PyAutoGUI; So I modified my code to use your library instead and i am currently in the testing process .. I hope it works

  • @alsaihati1ify
    @alsaihati1ify 4 ปีที่แล้ว +3

    Thanks you ^^ lifesaver :D

  • @lucasfarias2432
    @lucasfarias2432 4 ปีที่แล้ว

    Thank you for the pieces of information.

  • @arhamcodes
    @arhamcodes 4 ปีที่แล้ว

    Awesome work men!! I appreciate it.

  • @playastheoriginal
    @playastheoriginal 8 หลายเดือนก่อน

    You saved my day!!! Thank you very much!!!

  • @transcoreano
    @transcoreano ปีที่แล้ว +1

    YOU ARE A GENIUS

  • @gyeovanne
    @gyeovanne 3 ปีที่แล้ว

    your save my life bro, thanks

  • @omtodkari2736
    @omtodkari2736 2 ปีที่แล้ว

    Thank you very much! I wish I had seen this video earlier

  • @AhmedKamel-ol6qv
    @AhmedKamel-ol6qv 4 ปีที่แล้ว +2

    Thanks for the great work. Can I input more than key simultaneously?

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +2

      Yes you can. The only issue I know of is if you press arrow keys at the same time as an alphanumeric key, it acts like shift is being held down. I plan to correct that at some point, but it's still a bug right now.

    • @AhmedKamel-ol6qv
      @AhmedKamel-ol6qv 4 ปีที่แล้ว

      @@LearnCodeByGaming I am confused of how to did this. can you show me?, thanks a lot. when I write it like this, they got pressed in series.
      pydirectinput.keyDown('k')
      pydirectinput.keyDown('u')
      time.sleep(2.00)
      pydirectinput.keyUp('k')
      pydirectinput.keyUp('u')

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +1

      @@AhmedKamel-ol6qv I think I misunderstood your original question. PyDirectInput isn't able to send multiple keyDown (or keyUp) inputs at exactly the same time. You can do it if you drop down to using ctypes.windll.user32.SendInput directly.

    • @AhmedKamel-ol6qv
      @AhmedKamel-ol6qv 4 ปีที่แล้ว

      ​@@LearnCodeByGaming Thanks a lot for your help. I am trying to build my first game Bot using Reinforcement Learning to play Pro Evolution Soccer. I have almost fair background in python, but i am quit familiar with RL as part of my research in Transportation. your videos helped me in my first steps. wish you all the best.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +1

      @@AhmedKamel-ol6qv Awesome that sounds sweet, wishing you the best too!

  • @eliebordron5857
    @eliebordron5857 2 ปีที่แล้ว

    works very well with The witcher 3. problems with french keyboard though

  • @haoranjiang6866
    @haoranjiang6866 3 ปีที่แล้ว

    hi
    I am creating an automation tool to move the mouse which can adjust the camera position in a game created by `UE engine`. Trying to use `pydirectinput` and `pywinauto` to control the mouse, but if moving the mouse to a coordinate which has a negative number like:
    ```
    pydirectinput.moveTo(-100,540) or pywinauto.mouse.move(coords=(-100,540))
    ```
    the camera position in the game will not be changed. wt should I do

  • @McMettie
    @McMettie 4 ปีที่แล้ว +1

    thanks, this helped me out a lot!

  • @anAlokDubey
    @anAlokDubey 3 ปีที่แล้ว +1

    Great work. 🙏

  • @Lea-ww9hf
    @Lea-ww9hf 2 ปีที่แล้ว

    Hello I have a problem, when I press a key, it don't work ingame, but when I try it in a notepad it work. I used pyautogui and pydirectinput. Neither worked

  • @maiconjogos
    @maiconjogos 3 หลายเดือนก่อน

    Well, I was trying to auto a task on Nemu Player, a Emulator for cellphone, but none pyAutoGUI, pyDirectInput or pyWin32 worked.

  • @cayman1021
    @cayman1021 2 ปีที่แล้ว

    Thank you for the video! Saved my day! 😆

  • @pharaohx7k358
    @pharaohx7k358 2 ปีที่แล้ว

    Is there any library that will send inputs to controllers? Like moving left stick up..

  • @hostgrady
    @hostgrady 4 ปีที่แล้ว +1

    I'm going to criticize the pip in this comment just to be distinct from the other thread. I have noticed the "write" function is quite slow in comparison to autogui's version. On top of that the interval function doesnt really function at all. Idk if this is known but it would be cool to communicate via a bot using this version of pyautogui

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว

      Thanks for letting me know, I'll look into it, and thanks for trying out PyDirectInput!

    • @hostgrady
      @hostgrady 4 ปีที่แล้ว

      @@LearnCodeByGaming np, love the support for other games already

    • @hostgrady
      @hostgrady 4 ปีที่แล้ว

      @@LearnCodeByGaming just as an addon, from what I can see, the write function works fine without direct input, I have been able to switch seamlessly between your library and pyautogui's type function seamlessly

  • @n.m.danimations5854
    @n.m.danimations5854 3 ปีที่แล้ว +1

    With pydirect input i keep getting the error no module called pydirectinput?

  • @carlosquinones7560
    @carlosquinones7560 2 ปีที่แล้ว

    Hey, so I tried to use both pyautogui and pydirectinput but neither of them are working for Halo 5 Forge on PC. It detects the mouse movement and the pydirectinput.press() method works for keyboard inputs but the leftClick() method doesn't work in the game, it only moves the mouse around but the clicks are not registering in neither module. What should I do?

  • @ThePirateHistory
    @ThePirateHistory 3 ปีที่แล้ว

    Have game like counter strike nexon studio, there not work your lib) and i try win32 is the same, can i trigger real output from mouse&

  • @ramonpaolomaran2253
    @ramonpaolomaran2253 3 ปีที่แล้ว

    Oh My God. Thanks very much.
    Brazil : )

  • @jayco10125
    @jayco10125 ปีที่แล้ว

    so uh how do we make the mouse have a duration on relative movement? I tried the normal way but it is instant not relative

  • @estebeste4045
    @estebeste4045 4 ปีที่แล้ว +3

    Hi! First of all thank you for the tutorials, they are really helpful. I have a question tho. Can some game have their own cursor position different from the your actual cursor position? I'm asking because I'm making a bot for a game that recenters the cursor everytime I move it in game, and the thing is if I use pydirectinput.move(x,y) it moves it inside the game but at very random positions, not where I intend it to move. Also another interesting thing is after i run the function once, it moves to a random position, but then if I move around in game with the cursor(to change its position) and run the function again, the cursor doesn't move at all, like it thinks it's already there. Only if I give it different coordinates it will move again to a random position. If you got any idea what's going on, please let me know! Thanks!

    • @crazycalias6380
      @crazycalias6380 4 ปีที่แล้ว +1

      este beste are you trying to use it in a first person shooter? I am trying in a first person shooter and I am having the same problem. The cursor doesnt move to where it is supposed to... if you find any solution let me know pls

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +2

      Hello! So move(x, y) does relative movement from your current mouse position. You might be looking for moveTo(x, y) to go to an absolute position on your screen. There's also moveRel(x, y) which is just another name for move(x, y). Hope that helps! Sorry it's not the best naming conventions, I'm following the function names set by PyAutoGUI.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +1

      @@crazycalias6380 Hi! Try using moveTo() instead of move().

    • @estebeste4045
      @estebeste4045 4 ปีที่แล้ว

      @@LearnCodeByGaming i was using moveTo, sry I said move by mistake

    • @suleyk4063
      @suleyk4063 3 ปีที่แล้ว +1

      @@LearnCodeByGaming All of the functions dont seem to work properly in an fps environment. I think its because the game calculates the distance between the before-and-after coordinates then moves the camera, and when combined with the fact that you cant see the absolute cursor position, makes it look like weird, random movement. Any thoughts on a work-around?

  • @mariusz8385
    @mariusz8385 4 ปีที่แล้ว

    i've tried both pyautogui and pydirectinput to make my click my mouse in football manager 2009 and it doesnt want to work for some reason... i do see mouse being move but the click doesnt want to work

  • @crazymooseman9087
    @crazymooseman9087 2 ปีที่แล้ว

    Your a saviour!!

  • @nguyenangkhanh1485
    @nguyenangkhanh1485 3 ปีที่แล้ว

    Thank you so much, this pretty much worked for me but some cases don't.
    For the Teamfight Tactic game, the keyboard event works like a charm but when I try to /ff (surrender), a new window appears and let me choose to accept quit or not and after that mouse function is fire to click accept button, it's done click, but seem like the game isn't taking that input from mouse, how can I fix it?
    The CMD and game run as Administrator.

  • @ElParacletoPodcast
    @ElParacletoPodcast ปีที่แล้ว

    Thanks for the video, is there anyway to do this on an ipad, to control mouse and keyboard? thanks

  • @stachuuu10000
    @stachuuu10000 ปีที่แล้ว

    Thanks, works nicely

  • @henrycharriere5256
    @henrycharriere5256 2 ปีที่แล้ว

    tnks man, do you have some option for linux? pyautogui does not work moveTo method for me

  • @psmith5573
    @psmith5573 3 ปีที่แล้ว

    If this solution didn't work out for you. Try to give the python script you run an ADMINISTRATOR right.
    This made the pyDirectInput / or even PyAutoGUI work for me.
    def run_as(required_command, required_password):
    shell = client.Dispatch("WScript.shell")
    shell.Run(f"runas /user:administrator {required_command}")
    time.sleep(1)
    shell.SendKeys(f"{required_password}
    ", 0)
    run python command via cmd only. Powershell doesn't work for me (not granted the admin permission).
    Happy botting :)

  • @brandonproductions2575
    @brandonproductions2575 4 ปีที่แล้ว +1

    Great video, I was wondering can you do some videos on game bots for web browser games?

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว

      Thanks! Is there a particular game or website you'd like to see a tutorial for?

    • @brandonproductions2575
      @brandonproductions2575 4 ปีที่แล้ว +1

      @@LearnCodeByGaming The web browser game is called lords and knights.

    • @brandonproductions2575
      @brandonproductions2575 4 ปีที่แล้ว

      @@LearnCodeByGaming Could you make a bot on Idle champions? It's a free game on steam.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +1

      @@brandonproductions2575 I'll check it out.

    • @brandonproductions2575
      @brandonproductions2575 4 ปีที่แล้ว

      @@LearnCodeByGaming Thank you

  • @TheFlipsy
    @TheFlipsy หลายเดือนก่อน

    I know I'm years late, but I'm VERY thankful for PyDirectInput! Is there any way for PyDirectInput to take controllers into account? Only one other library appears to attempt to have controller input be taken into account (vgamepad) but that's also only virtual inputs and so there is no DirectX input for gamepads.

  • @JordhanRDZ
    @JordhanRDZ 4 ปีที่แล้ว +2

    Hey ! first and foremost, thanks for the series, i really enjoyed it ! also i couldnt register mouse or keyboard clicks on a game called ragnarok (iro), any idea why? (running the IDE in admin mode and using pydirectinput)

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 ปีที่แล้ว +1

      Glad you enjoyed it! Sorry I wish I had some other idea why it might not be working for that game, but I really can't say. You've already tried everything I would suggest. It's a hard problem to debug because you don't get any error messages to work with.

    • @carlosrivadulla8903
      @carlosrivadulla8903 4 ปีที่แล้ว

      LOL, actually came here for the same reason, playing ragnarok and it doesn't receive the inputs, I don't know why. Did you find out why?

    • @chickenragnarokcheatingcau7808
      @chickenragnarokcheatingcau7808 4 ปีที่แล้ว

      @Learn Code By Gaming please try to do it in ragnarok online

  • @jerrydavis258
    @jerrydavis258 8 หลายเดือนก่อน

    bro, your job is great and help a lot~!

  • @MushBeck_Goat
    @MushBeck_Goat ปีที่แล้ว

    Hello,
    I tried to create a BOT in python for my game in LDPLAYER 9 (an Android emulator), but pyautogui and pydirect work on my windows but not on my emulator how to solve this probleme?

  • @k4r1dz
    @k4r1dz 4 ปีที่แล้ว +1

    Great stuff!!!!