| View previous topic :: View next topic |
| Author |
Message |
steveiwonder
Joined: 16 Nov 2004 Posts: 83
|
Posted: Tue Feb 19, 2008 11:30 am Post subject: Check of a Webpage as loaded? |
|
|
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 |
|
 |
HugoV
Joined: 27 May 2007 Posts: 495
|
|
| Back to top |
|
 |
steveiwonder
Joined: 16 Nov 2004 Posts: 83
|
Posted: Tue Feb 19, 2008 4:47 pm Post subject: |
|
|
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 |
|
 |
steveiwonder
Joined: 16 Nov 2004 Posts: 83
|
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1125
|
Posted: Wed Feb 20, 2008 12:21 pm Post subject: |
|
|
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 |
|
 |
steveiwonder
Joined: 16 Nov 2004 Posts: 83
|
Posted: Wed Feb 20, 2008 1:39 pm Post subject: |
|
|
| 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 |
|
 |
HugoV
Joined: 27 May 2007 Posts: 495
|
Posted: Wed Feb 20, 2008 2:20 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
steveiwonder
Joined: 16 Nov 2004 Posts: 83
|
Posted: Wed Feb 20, 2008 3:08 pm Post subject: |
|
|
| 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  |
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 |
|
 |
steveiwonder
Joined: 16 Nov 2004 Posts: 83
|
Posted: Wed Feb 20, 2008 3:09 pm Post subject: |
|
|
| 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  |
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 |
|
 |
HugoV
Joined: 27 May 2007 Posts: 495
|
Posted: Wed Feb 20, 2008 3:22 pm Post subject: |
|
|
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 |
|
 |
steveiwonder
Joined: 16 Nov 2004 Posts: 83
|
Posted: Wed Feb 20, 2008 4:17 pm Post subject: |
|
|
| 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 |
|
 |
Oberon
Joined: 18 Feb 2008 Posts: 458
|
Posted: Wed Feb 20, 2008 4:19 pm Post subject: |
|
|
| 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 |
|
 |
steveiwonder
Joined: 16 Nov 2004 Posts: 83
|
Posted: Wed Feb 20, 2008 4:33 pm Post subject: |
|
|
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 |
|
 |
Oberon
Joined: 18 Feb 2008 Posts: 458
|
Posted: Wed Feb 20, 2008 4:41 pm Post subject: |
|
|
| 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 |
|
 |
steveiwonder
Joined: 16 Nov 2004 Posts: 83
|
Posted: Wed Feb 20, 2008 4:54 pm Post subject: |
|
|
not as simple as doing pings i'm afraid. Something can be live.. its a different matter weather its functioning correctly
Each squid runs different services, pinging the squid IP means nothing. Just says that its switched on and responding to pings. |
|
| Back to top |
|
 |
|