Page 1 of 1

Start after loaded website

Posted: 08 Mar 2018, 14:31
by jonyjohny
Hi :)
I want that after the moment when the page loads, appear the message about this.But I have a problem, I don't know how to loop checking the time of loading the file and run formula only when website is loaded. I thought I would link it to the RunWait command, but I have no idea how. I this moment I wrote it and I stoped in it...

Code: Select all

	FileGetTime, X, C:\Users\Admin\AppData\Local\Google\Chrome\User Data\Default\Current Session, M 

	ControlClick, x832 y333, Google Chrome,, Left, 1, NA

	FileGetTime, XX, C:\Users\Admin\AppData\Local\Google\Chrome\User Data\Default\Current Session, M

	If time X>XX
	msgbox, tak

Re: Start after loaded website

Posted: 09 Mar 2018, 01:50
by BoBo
I doubt that the modification time of a folder will change bc one of the files it contains has been modified. Go for the ComObj > "wait page loaded" approach.

Re: Start after loaded website

Posted: 09 Mar 2018, 02:44
by Jovannb
Hi,

in my case, that does the trick

Code: Select all

wb := ComObjCreate("InternetExplorer.Application")
wb.Visible := false 													; false, to not see the window
wb.Navigate("www.apa.at")

While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy 	; wait till IE-Page is loaded
   sleep 100
regards

J.B.

Re: Start after loaded website  Topic is solved

Posted: 09 Mar 2018, 02:59
by BoBo

Code: Select all

#SingleInstance, Force
SetBatchlines, -1
	wb := ComObjCreate("InternetExplorer.Application")
	wb.Visible := true 													; false, to not see the window
	wb.Navigate("www.washingtonpost.com")

	StartTime := A_TickCount
	While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy 	; wait till IE-Page is loaded
	   ElapsedTime := A_TickCount

	MsgBox, % Round((ElapsedTime - StartTime)/1000,2) " seconds have elapsed."
	Return
Jovannb's code (above) - tweaked.