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

 

String=
(
Dallas,Fort Worth, TX
Coppell,TX
Old town, Alexandria, VA
Novato,CA
)
;*********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
	 S:=StrSplit(Row)
	 for k, v in S
		m(k,v)
	Pos:=InStr(Row,",",,0,1)
	MsgBox % SubStr(Row,1,InStr(Row,",",,0,1)-1) "`r`r" trim(SubStr(row,InStr(Row,",",,0,1)+1))
	
}
return

 

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


#SingleInstance,Force 
;~ 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

Screen clipping with OCR

Screen clipping with OCRIn this webinar on getting text from programs Jackie Sztuk demonstrated his adaptation of Tesseract.  I realized this would be a cool addition to my screen-clipping tool so I’ve incorporated!   Check out the below video and you can download all the files for screen clipping with OCR here (This requires several executables so I’ve put it all in this zip file)  BTW on 9/21/19 I updated the Tesseract.ahk file to wait for the image to be present. This should reduce the issue of the script complaining about the image not being found.

Screen clipping with OCR demo video