0
votes

After about two years from my initial question, I keep finding myself needing a screen scraping from a browser window.

The way I do this is : Maximize the browser window with

send !{space}
sleep 500
send x

then, place the cursor close to top left corner with

mousemove, 30, 30 ; or similar 
sleep 250 ; let computer catch up with mouse movement
mouseclick, L
send ^a
sleep 250
send ^c

at this point. I have the screen-scraped content in my paste buffer. All I am interested in is the text portions anyway. I can launch a notepad and paste the contents of the buffer into a text file and try searching for the the strings I am looking for, but I have gut feeling that, I can skip this temporary file creation step. Just don't know how.

And I would like to perform, few more ahk commands if the string is found in the buffer or keep waiting looping if it is not there yet.

Thanks for your contributions

2

2 Answers

1
votes

Assuming you look for the string Hello World in your clipboard an example code would be

send ^c

StringCaseSense, Off
Haystack = %Clipboard%
Needle = Hello World
IfInString, Haystack, %Needle%
{
    MsgBox, The string was found.
    return
} 
else
{
;Do something else here
}
1
votes

You an use the built in variable 'Clipboard' to read and write the clipboard contents.