Please enable JavaScript.
Coggle requires JavaScript to display documents.
18.Controlling the Keyboard and Mouse with GUI Automation 413…
18.Controlling the Keyboard and Mouse
with GUI Automation 413
Controlling Mouse Movement . 415
Moving the Mouse . 416
Getting the Mouse Position 417
Working with the Screen 423
Getting a Screenshot 423
Analyzing the Screenshot 424
Project: Extending the mouseNow Program 424
Image Recognition 425
Installing the pyautogui Module 414
Staying on Track . 414
Shutting Down Everything by Logging Out . 414
Pauses and Fail-Safes . 415
Project: “Where Is the Mouse Right Now?” 417
Step 1: Import the Module . 418
Step 2: Set Up the Quit Code and Infinite Loop 418
Step 3: Get and Print the Mouse Coordinates 418
Controlling Mouse Interaction . 419
Clicking the Mouse . 420
Dragging the Mouse . 420
Scrolling the Mouse 422
Controlling the Keyboard . 426
Sending a String from the Keyboard . 426
Key Names . 427
Pressing and Releasing the Keyboard . 428
Hotkey Combinations . 429
Review of the PyAutoGUI Functions . 430
Project: Automatic Form Filler . 430
Step 1: Figure Out the Steps 432
Step 2: Set Up Coordinates . 432
Step 3: Start Typing Data 434
Step 4: Handle Select Lists and Radio Buttons 435
Step 5: Submit the Form and Wait . 436