I have been hopelessly lurking the forum for a valid solution that would be up to date.
I simply applied the script a another user: pajeen
(sorry if the name is incorrect. He/She deserves all the credit)
(Look up the ScreenGrab OCR thread.)
(you will need to download the things that he did)
(If no one can find this, ill upload a copy)
either way, I thought to myself, why not use OCR to detect when ff finished loading?
Note: I used 1024 X 768
But, the coordinates can easily be modified
Code:
;==This has been modified to tell when a page has loaded=====
ReloadScript = 0
WaitForDone:
if ReloadScript >= 1
{
Reload
}
Loop
{
; Requires gocr or tesseract, mkbitmap, potrace, and imagemagick.
; Default variables
; Temporary file options
FileCreateDir, %A_ProgramFiles%\gocr\tmp
TmpDir = %A_ProgramFiles%\gocr\tmp
TmpFile = image_out
; mkbitmap options
mkbitmap = 1 ; 1, Preprocess screen grab using mkbitmap. 0, false.
mkbitmap_path = %A_ProgramFiles%\gocr
mkb_i = ; -i, inversion. Blank by default.
mkb_f = 4
mkb_n = ; -n, nofilter. Turns off highpass filtering. Blank by default.
mkb_s = 2
mkb_interpolation = "-1" ; "-3" or "-1". Cubic or linear interpolation. "-1" yields better results for text.
mkb_t = 0.45
mkb_g = ; -g, grey. Only scales and greymaps the image. Blank by default.
; potrace options
potrace = 1 ; 1, Preprocess screen grab using potrace. 0, false.
potrace_path = %A_ProgramFiles%\gocr
pot_z = minority ; black, white, right, left, minority, majority, random
pot_t = 0
pot_a = 1
pot_n = ; Blank by default. "-n" turns off curve optimization.
pot_O = 0.2
pot_u = 10
app = "gocr"
; gocr options
gocr_path = %A_ProgramFiles%\gocr
gocr_s = 0
gocr_d = -1
gocr_m = 32
gocr_n = 0
; tesseract options
convert_path = %A_ProgramFiles%\gocr
tesseract_path = %A_ProgramFiles%\gocr
; Needs four variables representing the points needed for the scan.
; A set of coordinates for the upper left corner of the scan area (the origin), and a set for the lower right corner of the scan area.
; Represented by scan_x_start, scan_y_start, scan_x_end, scan_y_end.
CoordMode, Pixel, Relative ; Sets pixel actions relative to coordinates of the full desktop window or the active window. Use the mode that you used to obtain the starting and ending coordinates of the image area.
scan_x_start = 6
scan_y_start = 723
scan_x_end = 36
scan_y_end = 738
scan_current_x = %scan_x_start% ; Sets the starting x point of the scan. The origin of the window is the upper left corner.
scan_current_y = %scan_y_start% ; Sets the starting y point of the scan.
BlockInput, On
Loop
{
scan_current_y++
if scan_current_y > %scan_y_end%
{
Break
}
Loop
{
scan_current_x++
if scan_current_x > %scan_x_end%
{
Break
}
PixelGetColor, current_pixel_color, %scan_current_x%, %scan_current_y%, RGB
StringMid, current_pixel_r, current_pixel_color, 3, 2
StringMid, current_pixel_g, current_pixel_color, 5, 2
StringMid, current_pixel_b, current_pixel_color, 7, 2
; Need to turn the value returned into a hexadecimal value.
current_pixel_r = 0x%current_pixel_r%
current_pixel_g = 0x%current_pixel_g%
current_pixel_b = 0x%current_pixel_b%
SetFormat, integer, d
; Need to perform a math operation using the variables in order to get them in integer decimal format.
current_pixel_r -= 0
current_pixel_g -= 0
current_pixel_b -= 0
current_pixel_r := " " . current_pixel_r
current_pixel_g := " " . current_pixel_g
current_pixel_b := " " . current_pixel_b
image_data = %image_data% %current_pixel_r% %current_pixel_g% %current_pixel_b%
}
image_data = %image_data% `n
scan_current_x = %scan_x_start%
}
BlockInput, Off
format := "P3`n", comment := "# File made using AutoHotkey.`n", width := scan_x_end - scan_x_start, height := scan_y_end - scan_y_start, max_colors := 255
file_data = %format% %comment% %width% %height% `n %max_colors% `n %image_data%
; Clean old temporary files.
IfExist %TmpDir%\%TmpFile%.ppm
{
FileDelete %TmpDir%\%TmpFile%.ppm
}
; End of cleaning.
FileAppend, %file_data%, *%TmpDir%\%TmpFile%.ppm
ImageFormat = "ppm"
If mkbitmap = 1
{
RunWait, %mkbitmap_path%\mkbitmap.exe %mkb_i% -f %mkb_f% %mkb_n% -s %mkb_s% %mkb_interpolation% -t %mkb_t% %mkb_g% "%TmpDir%\%TmpFile%.ppm" -o "%TmpDir%\%TmpFile%.pbm", %mkbitmap_path%, hide,
ImageFormat = "pbm"
}
If potrace = 1
{
RunWait, %potrace_path%\potrace.exe -z %pot_z% -t %pot_t% -a %pot_a% %pot_n% -O %pot_O% -u %pot_u% -g -o "%TmpDir%\%TmpFile%.pgm" "%TmpDir%\%TmpFile%.%ImageFormat%", %potrace_path%, hide,
ImageFormat = "pgm"
}
If app = "gocr"
{
RunWait, %gocr_path%\gocr.exe -i "%TmpDir%\%TmpFile%.%ImageFormat%" -s %gocr_s% -d %gocr_d% -m %gocr_m% -n %gocr_n% -o "%TmpDir%\%TmpFile%.txt", %gocr_path%, Hide,
}
FileReadLine, IsPageLoaded, %A_ProgramFiles%\gocr\tmp\image_out.txt, 1
StringReplace, IsPageLoaded, IsPageLoaded, %A_SPACE%,, All
StringReplace, IsPageLoaded, IsPageLoaded, _,, All
StringReplace, IsPageLoaded, IsPageLoaded, ?,, All
FileRemoveDir, %A_ProgramFiles%\gocr\tmp, 1
If IsPageLoaded = Done
Break
else
{
Sleep, 2500
ReloadScript +=1
Goto, WaitForDone
}
}
MsgBox, The Rest of the script goes here.