I'm attempting to use OCR to search an excel file and return an adjacent cell contents with no luck. For my purposes I'm not worried about opening any specific sheet, I'd like to just reference whatever I currently have open in Excel.
This is my latest iteration of many attempts:
Code: Select all
#include <Vis2> ; Equivalent to #include .\lib\Vis2.ahk
#c::
OCR() ; OCR to clipboard
MsgBox, %clipboard%
LookFor = %clipboard%
xl := ComObjActive("Excel.Application")
FoundM := x1.Range("A:A").Find(LookFor).Offset(0,1).Value
MsgBox, % FoundM
return
Esc:: ExitApp
Esc:: ExitApp
I have Excel open and test contents in Columns A & B. The first MsgBox correctly displays the OCR'd text but the script isn't finding the test text within Excel even though the spelling is identical.
What am I doing wrong here?