AutoHotkey Community

It is currently May 27th, 2012, 12:57 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: December 31st, 2009, 12:58 pm 
Offline

Joined: November 15th, 2009, 6:54 pm
Posts: 82
Location: Berlin
i that i can make it wth a imagesearch but thats not good when the solution changes..

i'am searching for a solution with a pseudocode like that:

Code:
1. run, google.de
2. wait until firefox "WM_PAINT"'s
3. then wait until firefox for (as example) 100ms not "WM_PAINT"'s and then do something.


when firefox doesn't "WM_PAINT" anymore, it should signal that firefox is done with loading of the website..

someone got an idea how i can proof that firefox "WM_PAINT"'s ?

or somebody got a better solution?

_________________
*can't live without AHK*


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 31st, 2009, 9:18 pm 
Offline

Joined: March 16th, 2008, 6:48 pm
Posts: 161
Location: Brooklyn
This topic comes up at least once a week. Please check the forums.

There are plenty of workarounds. Everyone has their own formula. But there isn't a standardized method to implement for FF.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 1st, 2010, 4:27 pm 
Offline

Joined: March 26th, 2009, 4:41 am
Posts: 15
GDur wrote:
i that i can make it wth a imagesearch but thats not good when the solution changes..

i'am searching for a solution with a pseudocode like that:

Code:
1. run, google.de
2. wait until firefox "WM_PAINT"'s
3. then wait until firefox for (as example) 100ms not "WM_PAINT"'s and then do something.


when firefox doesn't "WM_PAINT" anymore, it should signal that firefox is done with loading of the website..

someone got an idea how i can proof that firefox "WM_PAINT"'s ?

or somebody got a better solution?


A solution that has worked very well for me was to install an add-on for Firefox called Fission, which changes the color of the address bar as Firefox loads a page. Then I use the PixelGetColor command to monitor the color change.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 1st, 2010, 5:45 pm 
Offline

Joined: November 15th, 2009, 6:54 pm
Posts: 82
Location: Berlin
Sergio wrote:
This topic comes up at least once a week. Please check the forums.

There are plenty of workarounds. Everyone has their own formula. But there isn't a standardized method to implement for FF.

but WM_PAINT all firefox versions do
so it should work

_________________
*can't live without AHK*


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 1st, 2010, 8:55 pm 
Offline

Joined: November 15th, 2009, 6:54 pm
Posts: 82
Location: Berlin
hardcider09 wrote:
GDur wrote:
i that i can make it wth a imagesearch but thats not good when the solution changes..

i'am searching for a solution with a pseudocode like that:

Code:
1. run, google.de
2. wait until firefox "WM_PAINT"'s
3. then wait until firefox for (as example) 100ms not "WM_PAINT"'s and then do something.


when firefox doesn't "WM_PAINT" anymore, it should signal that firefox is done with loading of the website..

someone got an idea how i can proof that firefox "WM_PAINT"'s ?

or somebody got a better solution?


A solution that has worked very well for me was to install an add-on for Firefox called Fission, which changes the color of the address bar as Firefox loads a page. Then I use the PixelGetColor command to monitor the color change.


this seems to be a nice idea...got the addon now too...
and if there's nobody who got any idea how i can check the wm_paint signals from firefox then i will use your idea
thanks

_________________
*can't live without AHK*


Report this post
Top
 Profile  
Reply with quote  
 Post subject: This might help
PostPosted: August 11th, 2010, 3:40 am 
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 8)

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.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google Feedfetcher, Leef_me, WillTroll, XstatyK, Yahoo [Bot] and 29 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group