• Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey

AutoHotkey webinar: Getting text from programs with AutoHotkey

webnar 300x200

Video Hour 1:  High Level: Getting text from programs

General ways (there are more) to get text & the order to try them:

  1. Using COM to extract text from programs like: Excel, Word, PowerPoint, Outlook, IE
  2. Getting Text from PDFs
  3. Using Active Accessibility Viewer & UI Automation
  4. ControlGet
  5. Copy / Paste (when all else fails or when just need a quick solution)Squishy Ball 2
  6. OCR – Optical Character Recognition

Video Hour 2: Coding and Q&A

Script Highlight: Chrome.ahk by GeekDude

  • Automate Chrome without Selenium
  • Not as robust as COM w/IE but a great start at basic automation
  • Connect to running Chrome (running in Debug mode)
  • Page navigation
  • Get / Set elements & JavaScript Injection
  • Print pages to PDF
  • Capture to Screenshot
  • Some tutorial videos

Resources for getting text from programs

COM– Microsoft’s Component Object Model

Extracting from PDFs

Active Accessibility Viewer & UI Automation

Active Accessibility & UI Automation are built-in Microsoft architecture that can allow you to, programmatically, get text from programs

Let’s see a few examples using:

AutoHotkey Bottle 3

ControlGet

On standard Windows controls, you can access them with ControlGet

  • Some things like listboxes, listviews, etc. have some pretty cool capabilities
  • Often newer programs do not use the standard window controls 🙁

OCR – Optical Character Recognition

 

Get text from a list box; use AutoHotKey to grab items from programs

Get text from a list boxSometimes I’d like to be able to, progromatically, extract values listed inside a program. AutoHotkey Bottle 2 Unfortunately many programs I use do not allow the ability to get text from a list box.

One of AHKs great strengths is how well it “hooks” into Windows.  I wrote an AutoHotKey script which allows me to copy and paste a list of items selected in the window.  There are lots of options like retrieve all items, only those selected, obtain the count of either previously mentioned.  Once you have all the items you can send instructions back to the list box and specify which one you want selected (thus if you frequently go back and select the same items, it can automate the process.

 
loop {
  ControlGet, Sel_CT, List, Count Selected, SysListView321, A ;Gets count of items selected from last active window
  ToolTip % Sel_CT
sleep, 300
}
Browser_Forward::Reload

#IfWinActive ahk_class #32770 ;Only run below if in Specific window type
Browser_Back::
ControlGet, Selected_Items,List,Selected      ,SysListView321, A ;gets Selected Items in last active window
ControlGet, Selected_CT   ,List,Selected Count,SysListView321, A ;gets count of selected items in last active window

ControlGet, All_Items,List,      ,SysListView321, A ;gets list of all items in last active window
ControlGet, All_CT   ,List, Count,SysListView321, A ;gets count of all items in last active window

Clipboard:=Selected_Items
MsgBox % "Number of Items selected: " Selected_CT "`r`r" Selected_Items
MsgBox % "Number of Items selected: " All_CT "`r`r" All_Items
return
#IfWinActive

Black Bottle 2

Get text from a list box

  • Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey