AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Check of a Webpage as loaded?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
steveiwonder



Joined: 16 Nov 2004
Posts: 83

PostPosted: Tue Feb 19, 2008 11:30 am    Post subject: Check of a Webpage as loaded? Reply with quote

Hey Guys,

Is there any way to check using internet explorer controls to see if a page has loaded 100% without any errors etc?

Say ... http://new.bbc.co.uk.

Anyone else aware of a way to change your proxy server setting inside internet explorer? Including changing the port number?

Tools> Internet Options > Connections Tab > Lan Settings

i'm creating a tool which does daily checks using different proxy servers on on the same port number and browsing to websites, to checks if it loads ok. My daily NOC engineer checks for work.

I could obviously use Mouseclicks for evrything but i think that becomes a little long winded. I wonder if there is some short cut code that can be used to set your browser to a certain proxy server without entering your settings each time.

Any help would be much appreciated.
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 495

PostPosted: Tue Feb 19, 2008 12:14 pm    Post subject: Reply with quote

Search the forum

http://www.autohotkey.com/forum/topic19256.html&highlight=webpage+loaded
Back to top
View user's profile Send private message
steveiwonder



Joined: 16 Nov 2004
Posts: 83

PostPosted: Tue Feb 19, 2008 4:47 pm    Post subject: Reply with quote

Hey Guys,

I'm using this code to read from a text file that contains 4 websites (seems silly but its very useful for work)
loop through and check if the page loads.

However the following code runs.. but only once.

Can someone help on stopping this from break the loop and only running once.




Code:
Loop
{
     FileReadLine, linecontent, %A_WorkingDir%\sites.txt, %A_Index%
     If ( linecontent = testsite)
     {
         msgbox, sites looped
         ExitApp
     }



testsite = %linecontent%

Run, iexplore.exe %testsite%


MsgBox, % IEReady()
Return

IEReady(hIESvr = 0)
{
   If Not   hIESvr
   {
      Loop,   50
      {
         ControlGet, hIESvr, hWnd, , Internet Explorer_Server1, A ; ahk_class IEFrame
         If   hIESvr
            Break
         Else   Sleep 100
      }
      If Not   hIESvr
         Return   """Internet Explorer_Server"" Not Found."
   }
   Else
   {
      WinGetClass, sClass, ahk_id %hIESvr%
      If Not   sClass == "Internet Explorer_Server"
         Return   "The specified control is not ""Internet Explorer_Server""."
   }

   COM_Init()
   If   DllCall("SendMessageTimeout", "Uint", hIESvr, "Uint",

DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT"), "Uint", 0, "Uint", 0,

"Uint", 2, "Uint", 1000, "UintP", lResult)
   &&   DllCall("oleacc\ObjectFromLresult", "Uint", lResult, "Uint",

COM_GUID4String(IID_IHTMLDocument2,"{332C4425-26CB-11D0-B483-00C04FD90119}"), "int", 0,

"UintP", pdoc)=0
   &&   pdoc &&

pweb:=COM_QueryService(pdoc,IID_IWebBrowserApp:="{0002DF05-0000-0000-C000-000000000046}")
      Loop
         If   COM_Invoke(pweb, "ReadyState") = 4
            Break
         Else   Sleep 500
   COM_Release(pdoc)
   COM_Release(pweb)
   COM_Term()
   Return   pweb ? "DONE!" : False
   
 
}


}
Back to top
View user's profile Send private message
steveiwonder



Joined: 16 Nov 2004
Posts: 83

PostPosted: Wed Feb 20, 2008 11:53 am    Post subject: Reply with quote

Anyone able to take a look?

If ths helps i got the "check if page loads part" from the following
http://www.autohotkey.com/forum/topic19256.html&highlight=determine

Much appreciate any help available.
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1125

PostPosted: Wed Feb 20, 2008 12:21 pm    Post subject: Reply with quote

looks like you're short one "}" before the "testsite = %linecontent%" line. Hence the 'return' breaks the loop after one go.
_________________
My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags
Back to top
View user's profile Send private message
steveiwonder



Joined: 16 Nov 2004
Posts: 83

PostPosted: Wed Feb 20, 2008 1:39 pm    Post subject: Reply with quote

I don't think thats the answer, as the loop is to check all 5 sites which it reads line by line from the "Sites.txt" so it can test all all of them
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 495

PostPosted: Wed Feb 20, 2008 2:20 pm    Post subject: Reply with quote

So it checks the five sites and then it stops but you want it to loop again?

I'd look at ExitApp ig that is the case Wink
Back to top
View user's profile Send private message
steveiwonder



Joined: 16 Nov 2004
Posts: 83

PostPosted: Wed Feb 20, 2008 3:08 pm    Post subject: Reply with quote

HugoV wrote:
So it checks the five sites and then it stops but you want it to loop again?

I'd look at ExitApp ig that is the case Wink


Sad Its mean't to look through all 5... but only does one of them.

I cannot see where its breaking the loop /exiting?

I've played around with it all day yesterday.
Back to top
View user's profile Send private message
steveiwonder



Joined: 16 Nov 2004
Posts: 83

PostPosted: Wed Feb 20, 2008 3:09 pm    Post subject: Reply with quote

HugoV wrote:
So it checks the five sites and then it stops but you want it to loop again?

I'd look at ExitApp ig that is the case Wink


Sad Its mean't to look through all 5... but only does one of them.

I cannot see where its breaking the loop /exiting?

I changed the Exitapp's etc and move stuff around but i still failed terribly.
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 495

PostPosted: Wed Feb 20, 2008 3:22 pm    Post subject: Reply with quote

This works for me, all you would need to add is close the browser if it keeps opening new windows (depends on version and settings?)

REPLACED CODE:
Code:
Loop, read, %A_WorkingDir%\sites.txt
{
LoadIEDone(A_LoopReadLine)
}

LoadIEDone(URL_TO_LOAD)
{
com_CoInitialize()
pie := com_ActiveXObject("InternetExplorer.Application")
com_Invoke(pie, "Visible=", True)
com_Invoke(pie, "Navigate", URL_TO_LOAD)
psh :=   COM_CreateObject("Shell.Application")
psw :=   COM_Invoke(psh, "Windows")
Loop, %   COM_Invoke(psw, "Count")
   pwb := COM_Invoke(psw, "Item", A_Index-1), sInfo .= COM_Invoke(pwb, "hWnd") . " : """ . COM_Invoke(pwb, "LocationURL") . """,""" . COM_Invoke(pwb, "LocationName") . """,""" . COM_Invoke(pwb, "StatusText") . """,""" . COM_Invoke(pwb, "Name") . """,""" . COM_Invoke(pwb, "FullName") . """`n", COM_Release(pwb)
COM_Release(psw)
COM_Release(psh)
;COM_Term()

;MsgBox, % sInfo

Loop
   If   pdoc:=Com_Invoke(pie, "Document")
        Break
   Else Sleep 100
Loop
   If   Com_Invoke(pdoc, "readyState") = "complete"
        Break
   Else Sleep 500
Com_Release(pdoc)

com_Release(pie)
com_CoUninitialize()
return pie
}


Last edited by HugoV on Wed Feb 20, 2008 5:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
steveiwonder



Joined: 16 Nov 2004
Posts: 83

PostPosted: Wed Feb 20, 2008 4:17 pm    Post subject: Reply with quote

That loads the first page fine for me.. then it just runs 4 internet explorers for each URL. Not waiting for each URL to load first.
Back to top
View user's profile Send private message
Oberon



Joined: 18 Feb 2008
Posts: 458

PostPosted: Wed Feb 20, 2008 4:19 pm    Post subject: Reply with quote

Why would you need this anyway? There are far better ways to automate web based tasks with stuff like UrlDownloadToFile/FileRead or cURL.
Back to top
View user's profile Send private message
steveiwonder



Joined: 16 Nov 2004
Posts: 83

PostPosted: Wed Feb 20, 2008 4:33 pm    Post subject: Reply with quote

I need this for my Job,
everyday we have to do "Daily NOC Checks" This one im trying to automate is like this..

We have around 40 Proxy servers which out proxy "proxy1.equinoxsolutions.com" shares its load over, these are called "Squids" each squid has its own IP address.

Example:
192.168.0.15
192.168.0.16
192.168.0.17
192.168.0.18 .. etc etc

Someone in the morning will have to set there browers proxy too
192.168.0.15 Port 3182(always the same)

Then browse too all 5 URLS and make sure they load fine.

Then set it too 192.168.0.16

Then browse too all 5 URLS and make sure they load fine.

This then has to be done for ALL 40 Squids/IP addresses, every morning

So it enters 1 proxy.. tests 5 websites.. next proxy.. 5 websites & so on.

I've got the proxy setting changing fine.

Any more questions just feel free to ask.
Back to top
View user's profile Send private message
Oberon



Joined: 18 Feb 2008
Posts: 458

PostPosted: Wed Feb 20, 2008 4:41 pm    Post subject: Reply with quote

You managed to set up a proxy network but you don't know how to check their uptime with a ping... funky.
Back to top
View user's profile Send private message
steveiwonder



Joined: 16 Nov 2004
Posts: 83

PostPosted: Wed Feb 20, 2008 4:54 pm    Post subject: Reply with quote

not as simple as doing pings i'm afraid. Something can be live.. its a different matter weather its functioning correctly Shocked

Each squid runs different services, pinging the squid IP means nothing. Just says that its switched on and responding to pings.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group