• Become a Power user Intro to AutoHotkey Intermediate AutoHotkey Intermediate Objects GUIs are Easy w/AutoHotkey Painlessly switch from V1 to V2

Finding the last instance of a character in a string with StirSplit and InString with AutoHotkey

I thought I’d demonstrate a bit more how InStr() and StirSplit work.  In the below example I work through how to find the last comma in each row of data.

StirSplit and InString with AutoHotkey


Dallas,Fort Worth, TX
Old town, Alexandria, VA

;*********Use For loop over Var going line by line*********************
for i, row in Loopobj:=StrSplit(String,"`n","`r") { ;use For loop to parse over line breaks
	 for k, v in S
	MsgBox % SubStr(Row,1,InStr(Row,",",,0,1)-1) "`r`r" trim(SubStr(row,InStr(Row,",",,0,1)+1))


AutoHotkey Format function- Change case of text, pad it, set decimals & much more!

AutoHotkey has some great built-in functions for manipulating text.  The Format() function is awesome however I found the documentation a bit confusing so I made a short video to demonstrate the main uses of it.

Here is the AutoHotkey Format function code I demonstrate in the video

;~ Browser_Forward::Reload
;~ Browser_Back::
; A format string composed of literal text and placeholders of the form {Index:Format}.
Name:="joe glines"
MsgBox % Format("{1:Us}",name) ;Uppercase
MsgBox % "Hello there " Format("{1:Ts}",name) " how are you today?" ;Titlecase
MsgBox % Format("{1:Ls}`n{1:Ts}","JOE GLINES") ;LowerCase
Msgbox % Format("|{1:10s}|" ,"Right") ;pad left with up to 10 spaces
Msgbox % Format("|{1:-10s}|","Left") ;pad right with up to 10 spaces
Msgbox % Format("|{:-10}|","Left") ;the 1 and s are defaults so are not needed.
MsgBox % Format("{1:-10}`n{2:10}", "Left", "Right") ;Having two at once as well as new-line
MsgBox % Format("{2} my {1}!", "World", "Hello") ;Put second one in front of first
MsgBox % Format("{1:0.3f}", 423434.233223) ;set 3 decimals
MsgBox % Format("{1:0.3f}`n{1:.7f}", 423434.233223) ;show using 2 references first w/3 decimals, second w/7 return


AutoHotkey Format function

AutoHotkey webinar: Getting text from programs with AutoHotkey

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)
  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:

  • UI Automation via Jethrow
  • Screen Reader – UI Automation by nepter


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