Book Read Free

Automate the Boring Stuff with Python

Page 51

by Al Sweigart


  controlling mouse, Pauses and Fail-Safes, Step 3: Get and Print the Mouse Coordinates, Clicking the Mouse, Clicking the Mouse, Dragging the Mouse

  clicking mouse, Clicking the Mouse

  dragging mouse, Clicking the Mouse

  scrolling mouse, Dragging the Mouse

  determining mouse position, Moving the Mouse

  image recognition, Project: Extending the mouseNow Program

  installing pyautogui module, Controlling the Keyboard and Mouse with GUI Automation

  logging out of program, Controlling the Keyboard and Mouse with GUI Automation

  overview, Controlling the Keyboard and Mouse with GUI Automation

  screenshots, Scrolling the Mouse

  stopping program, Controlling the Keyboard and Mouse with GUI Automation

  H

  %H directive, Pausing Until a Specific Date

  hash character (#), Multiline Strings with Triple Quotes

  headings, Word document, Writing Word Documents

  help, Starting IDLE, How to Find Help

  asking online, How to Find Help

  for error messages, Starting IDLE

  hotkey combinations, Pressing and Releasing the Keyboard

  hotkey() function, Pressing and Releasing the Keyboard, Review of the PyAutoGUI Functions

  Hotmail.com, Connecting to an SMTP Server, Retrieving and Deleting Emails with IMAP

  HTML (Hypertext Markup Language), Saving Downloaded Files to the Hard Drive, Saving Downloaded Files to the Hard Drive, A Quick Refresher, Viewing the Source HTML of a Web Page, Using the Developer Tools to Find HTML Elements

  browser developer tools and, Viewing the Source HTML of a Web Page

  finding elements, Using the Developer Tools to Find HTML Elements

  learning resources, Saving Downloaded Files to the Hard Drive

  overview, Saving Downloaded Files to the Hard Drive

  viewing page source, A Quick Refresher

  I

  %I directive, Pausing Until a Specific Date

  id attribute, A Quick Refresher

  IDLE (interactive development environment), Downloading and Installing Python, Starting IDLE, Entering Expressions into the Interactive Shell, Variable Names, Copying and Pasting Strings with the pyperclip Module, Disabling Logging, Over, Debugging a Number Adding Program

  creating programs, Variable Names

  debugging in, Disabling Logging, Over, Debugging a Number Adding Program

  overview, Disabling Logging

  stepping through program, Over

  using breakpoints, Debugging a Number Adding Program

  expressions in, Entering Expressions into the Interactive Shell

  overview, Starting IDLE

  running scripts outside of, Copying and Pasting Strings with the pyperclip Module

  starting, Downloading and Installing Python

  if statements, Blocks of Code, while Loop Statements

  overview, Blocks of Code

  using in while loop, while Loop Statements

  imageDraw module, Ideas for Similar Programs

  imageDraw objects, Ideas for Similar Programs

  ImageFont objects, Drawing Example

  Image objects, Manipulating Images with Pillow

  images, Computer Image Fundamentals, Computer Image Fundamentals, Colors and RGBA Values, Coordinates and Box Tuples, Coordinates and Box Tuples, Working with the Image Data Type, Working with the Image Data Type, Copying and Pasting Images onto Other Images, Copying and Pasting Images onto Other Images, Copying and Pasting Images onto Other Images, Rotating and Flipping Images, Rotating and Flipping Images, Changing Individual Pixels, Project: Adding a Logo, Ideas for Similar Programs, Ideas for Similar Programs, Ideas for Similar Programs, Lines, Lines, Lines, Lines, Drawing Example, Project: Extending the mouseNow Program

  adding logo to, Project: Adding a Logo

  attributes for, Working with the Image Data Type

  box tuples, Coordinates and Box Tuples

  color values in, Computer Image Fundamentals

  coordinates in, Colors and RGBA Values

  copying and pasting in, Copying and Pasting Images onto Other Images

  cropping, Working with the Image Data Type

  drawing on, Ideas for Similar Programs, Ideas for Similar Programs, Ideas for Similar Programs, Lines, Lines, Lines, Lines, Drawing Example

  example program, Lines

  ellipses, Lines

  ImageDraw module, Ideas for Similar Programs

  lines, Ideas for Similar Programs

  points, Ideas for Similar Programs

  polygons, Lines

  rectangles, Lines

  text, Drawing Example

  flipping, Rotating and Flipping Images

  opening with Pillow, Coordinates and Box Tuples

  pixel manipulation, Changing Individual Pixels

  recognition of, Project: Extending the mouseNow Program

  resizing, Copying and Pasting Images onto Other Images

  RGBA values, Computer Image Fundamentals

  rotating, Rotating and Flipping Images

  transparent pixels, Copying and Pasting Images onto Other Images

  IMAP (Internet Message Access Protocol), Disconnecting from the SMTP Server, Connecting to an IMAP Server, Connecting to an IMAP Server, Connecting to an IMAP Server, Size Limits, Getting the Body from a Raw Message, Getting the Body from a Raw Message

  defined, Disconnecting from the SMTP Server

  deleting messages, Getting the Body from a Raw Message

  disconnecting from server, Getting the Body from a Raw Message

  fetching messages, Size Limits

  folders, Connecting to an IMAP Server

  logging into server, Connecting to an IMAP Server

  searching messages, Connecting to an IMAP Server

  imapclient module, Disconnecting from the SMTP Server

  IMAPClient objects, Retrieving and Deleting Emails with IMAP

  immutable data types, List-like Types: Strings and Tuples

  importing modules, Importing Modules, Moving the Mouse

  overview, Importing Modules

  pyautogui module, Moving the Mouse

  imprint attribute, Run Attributes

  im variable, Scrolling the Mouse

  indentation, Example Program: Magic 8 Ball with a List

  indexes, The List Data Type, Negative Indexes, Getting a List’s Length with len(), Removing Values from Lists with del Statements, Dictionaries and Structuring Data, Multiline Strings with Triple Quotes

  for dictionaries, Dictionaries and Structuring Data (see keys, dictionary)

  for lists, The List Data Type, Negative Indexes, Getting a List’s Length with len(), Removing Values from Lists with del Statements

  changing values using, Getting a List’s Length with len()

  getting value using, The List Data Type

  negative, Negative Indexes

  removing values from list using, Removing Values from Lists with del Statements

  for strings, Multiline Strings with Triple Quotes

  IndexError, The Dictionary Data Type

  index() method, Methods

  infinite loops, An Annoying while Loop, continue Statements, Step 1: Import the Module

  INFO level, Using the logging Module

  in operator, The in and not in Operators, Checking Whether a Key or Value Exists in a Dictionary, Indexing and Slicing Strings

  using with dictionaries, Checking Whether a Key or Value Exists in a Dictionary

  using with lists, The in and not in Operators

  using with strings, Indexing and Slicing Strings

  input() function, Comments, Methods, Logging in to the SMTP Server

  overview, Comments, Methods

  using for sensitive information, Logging in to the SMTP Server

  installing, About This Book, Step 4: Save the Image and Find the Previous Comic, Working with Excel Spreadsheets, Controlling the Keyboard and Mouse with G
UI Automation, Installing Third-Party Modules

  openpyxl module, Working with Excel Spreadsheets

  pyautogui module, Controlling the Keyboard and Mouse with GUI Automation

  Python, About This Book

  selenium module, Step 4: Save the Image and Find the Previous Comic

  third-party modules, Installing Third-Party Modules

  int, The Integer, Floating-Point, and String Data Types

  (see also integers)

  integer division/floored quotient (//) operator, Entering Expressions into the Interactive Shell

  integers, The Integer, Floating-Point, and String Data Types, The str(), int(), and float() Functions

  floating-point equivalence, The str(), int(), and float() Functions

  overview, The Integer, Floating-Point, and String Data Types

  interactive development environment, Variable Names (see IDLE (interactive development environment))

  interactive shell, Variable Names (see IDLE)

  Internet Explorer, developer tools in, Viewing the Source HTML of a Web Page

  Internet Message Access Protocol, Disconnecting from the SMTP Server (see IMAP (Internet Message Access Protocol))

  interpreter, Python, Downloading and Installing Python

  int() function, The len() Function

  isabs() function, The os.path Module

  isalnum() method, The upper(), lower(), isupper(), and islower() String Methods

  isalpha() method, The upper(), lower(), isupper(), and islower() String Methods

  isdecimal() method, The upper(), lower(), isupper(), and islower() String Methods

  isdir() function, Finding File Sizes and Folder Contents

  is_displayed() method, Finding Elements on the Page

  is_enabled() method, Finding Elements on the Page

  isfile() function, Finding File Sizes and Folder Contents

  islower() method, The upper(), lower(), isupper(), and islower() String Methods

  is_selected() method, Finding Elements on the Page

  isspace() method, The isX String Methods

  istitle() method, The isX String Methods

  isupper() method, The upper(), lower(), isupper(), and islower() String Methods

  italic attribute, Run Attributes

  items() method, Dictionaries vs. Lists

  iter_content() method, Saving Downloaded Files to the Hard Drive

  J

  %j directive, Pausing Until a Specific Date

  join() method, The isX String Methods, Files and File Paths, The os.path Module, Step 2: Create and Start Threads

  JPEG format, Working with the Image Data Type

  JSON files, Working with CSV Files and JSON Data, Step 3: Write Out the CSV File Without the First Row, Step 3: Write Out the CSV File Without the First Row, JSON and APIs, Reading JSON with the loads() Function, Reading JSON with the loads() Function

  APIs for, Step 3: Write Out the CSV File Without the First Row

  defined, Working with CSV Files and JSON Data

  format overview, Step 3: Write Out the CSV File Without the First Row

  reading, JSON and APIs

  and weather data project, Reading JSON with the loads() Function

  writing, Reading JSON with the loads() Function

  justifying text, The join() and split() String Methods

  K

  keyboard, Image Recognition, Sending a String from the Keyboard, Key Names, Pressing and Releasing the Keyboard

  controlling, with PyAutoGUI, Image Recognition, Key Names, Pressing and Releasing the Keyboard

  hotkey combinations, Pressing and Releasing the Keyboard

  pressing and releasing keys, Key Names

  sending string from keyboard, Image Recognition

  key names, Sending a String from the Keyboard

  KeyboardInterrupt exception, Step 2: Track and Print Lap Times, Moving the Mouse, Step 1: Import the Module

  keyDown() function, Key Names, Pressing and Releasing the Keyboard, Review of the PyAutoGUI Functions

  keys, dictionary, Dictionaries and Structuring Data

  keys() method, Dictionaries vs. Lists

  keyUp() function, Key Names, Pressing and Releasing the Keyboard, Review of the PyAutoGUI Functions

  keyword arguments, Return Values and return Statements

  L

  LARGER search key, Performing the Search

  launchd, Launching Other Programs from Python

  launching programs, Step 2: Create and Start Threads, Launching Other Programs from Python, Launching Other Programs from Python, Launching Other Programs from Python, Launching Other Programs from Python, Task Scheduler, launchd, and cron, Task Scheduler, launchd, and cron, Task Scheduler, launchd, and cron, Task Scheduler, launchd, and cron, Project: Simple Countdown Program

  and countdown project, Project: Simple Countdown Program

  opening files with default applications, Task Scheduler, launchd, and cron

  opening websites, Task Scheduler, launchd, and cron

  overview, Step 2: Create and Start Threads

  passing command line arguments to processes, Launching Other Programs from Python

  poll() method, Launching Other Programs from Python

  running Python scripts, Task Scheduler, launchd, and cron

  scheduling, Launching Other Programs from Python

  sleep() function, Task Scheduler, launchd, and cron

  wait() method, Launching Other Programs from Python

  len() function, The input() Function, Getting a List’s Length with len(), Word Documents

  finding number of values in list, Getting a List’s Length with len()

  overview, The input() Function

  less than (<) operator, Boolean Values

  less than or equal to (<=) operator, Boolean Values

  LibreOffice, Working with Excel Spreadsheets, Step 4: Save the Results

  line breaks, Word document, Adding Headings

  LineChart() function, Charts

  line continuation character (), Example Program: Magic 8 Ball with a List

  line() method, Ideas for Similar Programs

  linked styles, Styling Paragraph and Run Objects

  Linux, What Is Python?, Downloading and Installing Python, Starting IDLE, Files and File Paths, Launching Other Programs from Python, Launching Other Programs from Python, Task Scheduler, launchd, and cron, Opening Files with Default Applications, Controlling the Keyboard and Mouse with GUI Automation, Installing Third-Party Modules, The pip Tool, Running Python Programs on OS X and Linux

  backslash vs. forward slash, Files and File Paths

  cron, Launching Other Programs from Python

  installing Python, Downloading and Installing Python

  installing third-party modules, The pip Tool

  launching processes from Python, Launching Other Programs from Python

  logging out of automation program, Controlling the Keyboard and Mouse with GUI Automation

  opening files with default applications, Task Scheduler, launchd, and cron

  pip tool on, Installing Third-Party Modules

  Python support, What Is Python?

  running Python programs on, Running Python Programs on OS X and Linux

  starting IDLE, Starting IDLE

  Unix philosophy, Opening Files with Default Applications

  listdir() function, Handling Absolute and Relative Paths

  list_folders() method, Connecting to an IMAP Server

  list() function, Reader Objects, Image Recognition

  lists, The List Data Type, The List Data Type, Negative Indexes, Negative Indexes, Getting a List’s Length with len(), Getting a List’s Length with len(), Getting a List’s Length with len(), Getting a List’s Length with len(), Removing Values from Lists with del Statements, Removing Values from Lists with del Statements, Using for Loops with Lists, The in and not in Operators, The in and not in Operators, The in and not in Operators, The Multiple Assignment Trick, Methods, Methods, Methods,
Adding Values to Lists with the append() and insert() Methods, Removing Values from Lists with remove(), Sorting the Values in a List with the sort() Method, List-like Types: Strings and Tuples, The Tuple Data Type, Passing References, Passing References, The Dictionary Data Type, A Tic-Tac-Toe Board

  append() method, Methods

  augmented assignment operators, The Multiple Assignment Trick

  changing values using index, Getting a List’s Length with len()

  concatenation of, Getting a List’s Length with len()

  copy() function, Passing References

  deepcopy() function, Passing References

  dictionaries vs., The Dictionary Data Type

  finding number of values using len(), Getting a List’s Length with len()

  getting sublists with slices, Negative Indexes

  getting value using index, The List Data Type

  index() method, Methods

  in operator, The in and not in Operators

  insert() method, Methods

  list() function, The Tuple Data Type

  Magic 8 Ball example program using, Sorting the Values in a List with the sort() Method

  multiple assignment trick, The in and not in Operators

  mutable vs. immutable data types, List-like Types: Strings and Tuples

  negative indexes, Negative Indexes

  nesting, A Tic-Tac-Toe Board

  not in operator, The in and not in Operators

  overview, The List Data Type

  remove() method, Adding Values to Lists with the append() and insert() Methods

  removing values from, Removing Values from Lists with del Statements

  replication of, Getting a List’s Length with len()

  sort() method, Removing Values from Lists with remove()

 

‹ Prev