Python Automation Series #11: How to automate your mouse and keyboard in Python ?

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 168

  • @blackcitadel37
    @blackcitadel37 Год назад +6

    I wish i had watched this video before. My tendinitis and the 800 documents i have (now had :D) to check manually until Monday for work thank you a hell of a lot, sir. Awesome content.

    • @BekBrace
      @BekBrace  Год назад

      Much appreciated my friend

  • @joeyjohnsonson4341
    @joeyjohnsonson4341 2 года назад +17

    dude’s voice is great

    • @BekBrace
      @BekBrace  2 года назад +1

      Thanks so much 🙂

    • @donthackme2
      @donthackme2 5 месяцев назад +1

      it's 2:30 am and the video made me even sleepier

    • @BekBrace
      @BekBrace  5 месяцев назад

      That's not a very nice thing to say

    • @donthackme2
      @donthackme2 5 месяцев назад

      @@BekBrace why?
      I'm not English so can you explain please?
      I wanted to say that I was tired because it was 2 am but I wanted to watch the video(which I enjoyed) and you voice is calm and charming and it made me even sleepier

    • @BekBrace
      @BekBrace  5 месяцев назад +1

      Oh, I misunderstood. Usually when you say this, that means that the person talking is boring 😜 But thank you very much for the sweet compliment ❤️🙏

  • @JonahStarenchak
    @JonahStarenchak 12 дней назад +2

    Im kind of new to python and running code on Windows at my home PC, how do I instill the pyautogui in VSCode?

    • @gumonn9883
      @gumonn9883 День назад

      Ok, let's do in parts
      To clarify, VSCode itself doesn't install anything it's just an editor for managing and editing files (like notepad does).
      To install python librarys you can use the command line (terminal), in windows is cmd or powershell. To open the comand line in VSCode you go to the top left in the Three dots ("...") chose terminal. There is gonna open your terminal in VSCode, you type "pip install pyautogui" and pip install to you the library pyautogui and any additional dependencies it requires.
      You can do this with any new Library you want to use just changing the name for the package, but "pip install (package)" is the same

    • @CubifyMosaics
      @CubifyMosaics День назад +1

      @@gumonn9883 I figured it out, but thanks so much for the detailed description

  • @batsukhtsogt7615
    @batsukhtsogt7615 3 года назад +4

    Thank you, been looking for this for a while. You are a real life saver.

    • @BekBrace
      @BekBrace  3 года назад

      I’m glad my friend 🙂

  • @hamzazain3578
    @hamzazain3578 Год назад +3

    Bro..y ou got a calming voice and a really easy to understand method of teaching, REP+ and hope you find success and it was a really fun experiance learning this from your video.

    • @BekBrace
      @BekBrace  Год назад +1

      Thank you very much my friend 🙏😊

  • @iydl
    @iydl 2 года назад +2

    Thank you so much man, I modified my typing thing a bit so I had a delay before it did it and so it did it like 10 times so now I can spam my friends on discord. Thank you so much!!!!!

    • @BekBrace
      @BekBrace  2 года назад

      Hehehe 🤭 Great job my friend

  • @liloflorida752
    @liloflorida752 3 года назад +3

    I had a dream about pyautogui !

    • @sknfer
      @sknfer 3 года назад

      waaaat ????

  • @aradhyakumarchandra8900
    @aradhyakumarchandra8900 2 года назад +2

    Thank you so much !! The video was great 👍. I have a question that will the pyautogui.hotkeys() command work if I want to press the windows key and up arrow key together to maximize my window ?
    Please clear my doubt.

    • @BekBrace
      @BekBrace  2 года назад

      Thank you friend 🙂
      No, i doubt it as it will be regarded as key interruption

    • @aradhyakumarchandra8900
      @aradhyakumarchandra8900 2 года назад

      Thank you so much 😁😁

    • @Randorandom232
      @Randorandom232 2 года назад

      @@BekBrace so we can't use window commands?

  • @lauranalo2254
    @lauranalo2254 4 года назад +4

    I did the drawing thing and it's very cool 😀

  • @mbogitechconpts
    @mbogitechconpts 3 года назад +2

    Wow! Great video.

  • @leonkennedy6726
    @leonkennedy6726 3 года назад +7

    Thanks man , very useful tutorial and a good intro to automation

  • @maoraltman3700
    @maoraltman3700 3 года назад +3

    best vid on the topic thx so much

    • @BekBrace
      @BekBrace  3 года назад

      Thank you very much Maor

  • @MasterProgrammer423
    @MasterProgrammer423 3 месяца назад +1

    Best tutorial ever!

    • @BekBrace
      @BekBrace  3 месяца назад

      Thanks a Bunch 👍

  • @clevertonlacerda1300
    @clevertonlacerda1300 3 года назад +4

    Thank you for make this video, it will help me a lot of with my tasks!!

    • @BekBrace
      @BekBrace  3 года назад +1

      I’m very happy you found it useful 👍

    • @tuckerlangston8528
      @tuckerlangston8528 3 года назад

      You all prolly dont care but does any of you know a trick to get back into an Instagram account?
      I stupidly forgot my password. I would love any tips you can offer me

  • @romanmelon5845
    @romanmelon5845 Год назад +2

    thanks, I use this lib to avoid my company tracking myself during work day =)
    For now have tool that writes me simple code))

  • @N0WARE
    @N0WARE Год назад +1

    Thanks
    Never been so excited to try code before :D

    • @BekBrace
      @BekBrace  Год назад

      You're welcome, brother / sister

  • @YT-GAMER-X
    @YT-GAMER-X Год назад +2

    You're voice is so satisfying

  • @partivkartikeya2269
    @partivkartikeya2269 2 года назад +1

    Thanks a lot bro.. your video was very helpful to complete my project work..

    • @BekBrace
      @BekBrace  2 года назад

      I’m glad brother 🙏 All the best to you

  • @prabirchandrasen7852
    @prabirchandrasen7852 2 года назад +1

    Really very helpful sir

  • @highschoolwallaywalasamina4987
    @highschoolwallaywalasamina4987 2 года назад +2

    i have made this program for 100 iterations that takes 15 minutes in using many applications, so how can i run this automation program in the background? that i wanna save my 15 minutes or do another program or task?

    • @BekBrace
      @BekBrace  2 года назад +1

      That's an excellent question, and I've been looking myself for an automation solution that can run in the background , as long as I know there is no way we can do that, but I'll keep searching for an answer to that question

  • @dgkoolkid3572
    @dgkoolkid3572 11 дней назад

    rlly good vid, helped me in 20 seconds

  • @teen_python_go9947
    @teen_python_go9947 4 года назад +2

    Woah!!
    'Tis amazin' sir!!
    Thanks a lot for helpin'!!
    Love from India!!

    • @BekBrace
      @BekBrace  4 года назад +1

      Thank you LIT Python 🙏

  • @Ankumeh589
    @Ankumeh589 5 месяцев назад +1

    Best tutorial

  • @hhory2614
    @hhory2614 2 года назад +3

    Hello Bek!
    Your video was really useful, I can't thank enough.
    May I ask, is there a way to make python work in the "background"?
    What I mean is, how can I do anything else, while the code is running in a specific windows only?
    Can you advise a tutorial for that? I'd be thankful.

    • @BekBrace
      @BekBrace  2 года назад +6

      Hello my friend, and thank you very much for your comment.
      Actually, this is very good question, and I have been looking for a solution for this issue;
      I do some automation macros in VBA for excel, and I have the same issue: I cannot do anything till the macro finishes
      When I get an answer I will let you know for sure

    • @ihatenggas
      @ihatenggas 2 года назад +3

      yes you can do that by renaming the file to .pyw

    • @dualnubs4663
      @dualnubs4663 2 года назад +1

      @@ihatenggas how bro can you explain or there is a specific vid for that?

  • @Garfield_Minecraft
    @Garfield_Minecraft Год назад +2

    This would be so useful
    I can use my voice controll the computer
    Thanks im learning python code

    • @BekBrace
      @BekBrace  Год назад +1

      Great ! Keep learning my friend

    • @Hello2afiq
      @Hello2afiq День назад

      can i see your project?

  • @shishirbhargav9627
    @shishirbhargav9627 3 года назад +1

    Amazing Video
    thank you for such informative content
    love from india

    • @BekBrace
      @BekBrace  3 года назад

      Best regards from Poland

  • @sebasy6915
    @sebasy6915 2 года назад +1

    Hello Bec. Thank you! . I have a question: I try to use complex characters like " \" in a windows path, but pyautogui.typewrite does not work typing this kind of characters. Help me please. Thank you again!

    • @BekBrace
      @BekBrace  2 года назад

      Hi There! what are you trying to achieve ?

    • @sebasy6915
      @sebasy6915 2 года назад

      Hi. I'm working in a boot that open a specific route in CMDER . Sample: pyautogui. Typewrite ("C\archives \programming
      epository
      ") but the result is : C archives programming repository. Thank you!

  • @daviizinkks
    @daviizinkks 6 месяцев назад +1

    thanks bro ! i made a script that automatically search things you want in edge , thanks so much

    • @BekBrace
      @BekBrace  6 месяцев назад

      You're very welcome 🤗

  • @kamranmohaghegh2884
    @kamranmohaghegh2884 Год назад +2

    Thank you Bek, it is a very useful video. Clear sound and speed for the training :-bd

    • @BekBrace
      @BekBrace  Год назад

      Thank you very much 😊

  • @electrocrane
    @electrocrane 2 года назад +1

    Man this is a pure life saver ! thank you very much , have a nice day :)

    • @BekBrace
      @BekBrace  2 года назад

      I am glad, friend :) Have a good day ahead too

    • @electrocrane
      @electrocrane 2 года назад

      @@BekBrace man i literally used this pyautogui to cut all my lengthy editing steps in premier pro , so now i can press one button and it'll directly apply one effect to the clip , no need of drag and type over and over again now , PURE LIFESAVER :)
      trying to learn more for further improvement .

  • @haowu5776
    @haowu5776 3 года назад +1

    Great video ❤️. Can we capture the mouse/keyboard event?

  • @BhramaM4334
    @BhramaM4334 Год назад +1

    thanks. this helped me a lot!

    • @BekBrace
      @BekBrace  Год назад

      you are very welcome

  • @youneedspeed4773
    @youneedspeed4773 7 месяцев назад +1

    Thanks a lot man. really helped me :)

    • @BekBrace
      @BekBrace  7 месяцев назад

      Gladly ☺️

  • @Scorpienmovies
    @Scorpienmovies 2 года назад +1

    Hey Bek,
    that was great and informative content, thank you so much for the Video. Do you know, if it is allowed in the terms and services to use pyautogui in the workspace?

    • @BekBrace
      @BekBrace  2 года назад

      Thank You so much :)
      Didn't see anything in the documentations that says otherwise pyautogui.readthedocs.io/en/latest/

  • @tasty7963
    @tasty7963 7 месяцев назад

    its not giving me the height and width of my screen and im not sure if it imported pyautogui, but i dit watch that part multiple times to check

  • @Jeancarlo842
    @Jeancarlo842 3 месяца назад

    ótimo tutorial, muito obrigado. +1 inscrito

    • @BekBrace
      @BekBrace  3 месяца назад

      Thank you so much :)

  • @muhamadameen5690
    @muhamadameen5690 2 года назад +1

    very useful , thanks

    • @BekBrace
      @BekBrace  2 года назад +1

      You're very welcome

  • @sknfer
    @sknfer 3 года назад +2

    perfect vieo

    • @BekBrace
      @BekBrace  3 года назад +1

      Thank you very much 🙏

  • @Randomvidd3
    @Randomvidd3 Год назад

    Helpful video actually

  • @joseantonioperedarios2811
    @joseantonioperedarios2811 3 года назад +1

    Thanks for the video. I have tried to use this module. But when scheduling three consecutive clicks outside of Visual Studio Code, the script only do one click. Why will it be?

    • @BekBrace
      @BekBrace  3 года назад +1

      Hello Jose ! Thank you for your comment.
      I am not sure that I fully understand, what do you mean by " outside of Visual Studio Code " ?

    • @joseantonioperedarios2811
      @joseantonioperedarios2811 3 года назад +1

      @@BekBrace Thanks for answering. I want my script to click on a window of an accounting program, then navigate its menus. I wrote the coordinates of each menu. But when I run the script, it only gives 1 click and not the others that I programmed. Does it have something to do with pillow?

    • @BekBrace
      @BekBrace  3 года назад +1

      @@joseantonioperedarios2811 ohhh I see what you mean. pillow is an images library so I don’t know how it could help in this particular situation, but honestly I never encountered this issue; I’ll try to find a solution and get back to you, meanwhile, you can search the web for an answer

    • @joseantonioperedarios2811
      @joseantonioperedarios2811 3 года назад

      @@BekBrace Thanks a lot. I will continue my search.

  • @horthsms7223
    @horthsms7223 24 дня назад +1

    Please do an update where the python program is on one monitor and the window to automate is on the second monitor.

    • @BekBrace
      @BekBrace  24 дня назад

      I'll do my best 😊

  • @Beeater-i2c
    @Beeater-i2c 4 месяца назад

    I have a simple bot for a website that I use, but it stopped working(site update). It’s a typescript and follows a selenium-based script that uses a very simple algorithm. Do you think you can help me identify the problem? Thank you for you help!!!

    • @BekBrace
      @BekBrace  2 месяца назад

      Send e your code on bekbrace@outlook.com, I will check it out this weekend

  • @svetlana9699
    @svetlana9699 4 года назад +1

    Great tutorial !

    • @BekBrace
      @BekBrace  4 года назад

      Thank you! Cheers!

  • @pica_noris3461
    @pica_noris3461 4 года назад +1

    Neat ! Thanks a lot for this video , very helpful

    • @BekBrace
      @BekBrace  4 года назад

      Pica _Noris Thank you for watching 😊

  • @RathElTigre
    @RathElTigre 10 месяцев назад

    How i can make that the mouse moves and click but only if press a key?

  • @qwerty_____146
    @qwerty_____146 4 месяца назад

    Hi Bro. Thank you a lot.

    • @BekBrace
      @BekBrace  4 месяца назад

      You are welcome

  • @RapFanMan1
    @RapFanMan1 2 года назад

    the question is how can i know for example google chrome on desktop axis coordinates what are ???

  • @chairliftt
    @chairliftt Год назад

    thank you very much for this video! i just want to doublecheck: once you've created your mouse input function, you could then just inplement this in a while loop, right? to just keep it going for however long? let's say i have 500 papers to click through, i can just let it run? sorry if you covered this in the video. thank you again!

    • @BekBrace
      @BekBrace  Год назад

      Yes exactly 😊 You can do precisely that

    • @chairliftt
      @chairliftt Год назад

      @@BekBrace Wow, thank you so much for the quick reply! Cheers!

  • @Rodrigao.BR7
    @Rodrigao.BR7 Год назад

    Thanks a lot for this!

    • @BekBrace
      @BekBrace  Год назад

      You're very welcome!

  • @eclips_1
    @eclips_1 Год назад

    I know this tutorial is very old but I still have a Question:
    Is it also possible to hold right click with pyautogui?

    • @BekBrace
      @BekBrace  Год назад

      no problem :)
      as far as I know pyautogui does not have a built-in function for holding down the right-click. However, you can achieve this behavior by combining pyautogui.mouseDown() and pyautogui.mouseUp() functions with the appropriate mouse button parameter.

  • @ConnorP94
    @ConnorP94 2 года назад

    Is there anyway to make it type the same text but +1 for example cp1, cp2,cp3 ect?

  • @AnasMations
    @AnasMations 3 года назад

    This is so helpful, thank you!!

  • @alexj7693
    @alexj7693 3 года назад +1

    What extension packs do you use?

    • @BekBrace
      @BekBrace  3 года назад +2

      For Python:
      Visual Studio Intellicode
      Python
      Prettier
      MagicPython

    • @alexj7693
      @alexj7693 3 года назад

      @@BekBrace thank you!

  • @Jinxone741
    @Jinxone741 2 года назад

    Thanks man . one question what Function to type a variable

  • @gatonegro187
    @gatonegro187 8 месяцев назад

    I want to move mouse with a xbox controller so this should be helpful thanks

  • @aditya5531
    @aditya5531 2 года назад +1

    Thanks a lot

    • @BekBrace
      @BekBrace  2 года назад

      Glad you liked it

  • @FrogInALog_
    @FrogInALog_ Год назад

    I need help, I do not want the user to be able to click of type while it is going, please help

  • @chaimingkai7235
    @chaimingkai7235 Год назад +1

    hi is there anyway we could record down our moves and replay it?

  • @Abstract_Code
    @Abstract_Code 2 года назад

    Bro can you please tell me what is your color scheme called it looks so cool.🙏🙏

  • @alimustafa2682
    @alimustafa2682 2 года назад +1

    The voice though !!

  • @crazydudes9782
    @crazydudes9782 3 года назад +1

    how about dual monitor?

  • @mxh1t
    @mxh1t 2 года назад +1

    can pls share mouse move and click , using win32

  • @lookman06
    @lookman06 2 года назад +1

    Hi, how to know where is our mouse coordinates?

    • @BekBrace
      @BekBrace  2 года назад +1

      Using : pyautogui.position()

  • @emiliorambaldi2894
    @emiliorambaldi2894 2 года назад

    import pyautogui
    ModuleNotFoundError: No module named 'pyautogui'
    Where is that module?

    • @BekBrace
      @BekBrace  2 года назад

      You've got to install first :
      pip install pyautogui
      Then you can import it.

  • @yassinewaterlaw6597
    @yassinewaterlaw6597 2 года назад +1

    How we can install pyautogui module ??

    • @BekBrace
      @BekBrace  2 года назад

      Have you watched the video ?

    • @yassinewaterlaw6597
      @yassinewaterlaw6597 2 года назад +1

      @@BekBrace i've fixed the probleme thank you

  • @emiliorambaldi2894
    @emiliorambaldi2894 2 года назад +1

    In my python there is not module named pyautogui

    • @BekBrace
      @BekBrace  2 года назад

      You must install it as shown in the tutorial 🙂

  • @MemesGuy
    @MemesGuy 9 месяцев назад

    is there a way to loop this?

  • @schiribeats
    @schiribeats Год назад +1

    canÄt import pyautogui it gets error

    • @BekBrace
      @BekBrace  Год назад +1

      What's the error ?

    • @schiribeats
      @schiribeats Год назад

      @@BekBrace Traceback (most recent call last):
      File "", line 1, in
      import pyautogui
      ModuleNotFoundError: No module named 'pyautogui'

  • @angelos-zw3zn
    @angelos-zw3zn 7 месяцев назад

    how can you run this program?

  • @jesuisravi
    @jesuisravi 3 года назад

    I don't see the code by which you moved to Paint. How did you get there?

    • @BekBrace
      @BekBrace  3 года назад

      Line 18 through 22

    • @jesuisravi
      @jesuisravi 3 года назад

      @@BekBrace good. Thanks

  • @Acid_Sakib
    @Acid_Sakib 6 месяцев назад

    can anyone help me how to break a while loop by pressing esc key?

  • @trevor9776
    @trevor9776 2 года назад +1

    can we do all this using c language

    • @BekBrace
      @BekBrace  2 года назад +1

      Unlikely, but maybe I'm not sure

  • @LimeSpeedCrystal
    @LimeSpeedCrystal Год назад

    How to typewrite with a delay?????????

  • @madsgrefsrud1139
    @madsgrefsrud1139 3 года назад +1

    what app is that

  • @jasonstranthon5183
    @jasonstranthon5183 Год назад +1

    In none of your videos do you explain to a noob how to get that interface you have. I installed python and run it and it just looks like normal windows command prompt & keeps saying "pip' did you mean 'zip' when I try to install autogui?
    Plus nowhere can i find the simple looking GUI you have in this vid....how do I get that ?
    Seriously, there should be a non convoluted way to install this....its easier to just use c++ at this point.....

    • @BekBrace
      @BekBrace  Год назад

      In this vid ? you mean "in this video" !
      I have no idea what you're talking about when you say "the interface you have".
      what's the issue with pip ? pip is a package manager through which you can install modules/packages/dependencies that you may use in your app.
      Again with the "simple GUI you have" - what do you mean ?!
      Go ahead then work with C++, or try to explain your point of view in a clearer way

  • @gatonegro187
    @gatonegro187 8 месяцев назад

    I want to move mouse with a xbox controller so, so I don't have to get Elon Musk's Neurolink chip drilled into my skull, this should be helpful thanks

  • @tugaric
    @tugaric 2 года назад

    Thank you jesus not an indian accent 😭 tears of joy

    • @BekBrace
      @BekBrace  2 года назад

      Hehe, that would be offensive to our indian friends but thanks for your comment ,😊

  • @lloydchristmas_iii4310
    @lloydchristmas_iii4310 2 года назад +1

    Win 32 is alot faster then puautogui

  • @notanymorestopmotionlego2328
    @notanymorestopmotionlego2328 3 года назад +3

    I use this to make hack client

  • @admiralevan
    @admiralevan 2 года назад +1

    Trying to do shit in power automate makes me want to eat glass. It kept deleting my flows or crashing and not saving flows. SIMPLE SHIT WHY ARE YOU SO BAD MICROSOFT

    • @BekBrace
      @BekBrace  2 года назад

      What about Linux ?