Page 1 of 1 1
Topic Options
#141117 - 2005-06-06 11:49 PM WEBPageLoaded()??????
sliver Offline
Getting the hang of it

Registered: 2002-09-05
Posts: 94
I am trying to write some code that would detect if a particular web page is loaded or not. EX. - User tries to access www.mypage.com...the page is not available right away but code keeps looping to see if web page loaded yet. When web page finally loaded I am exiting application.

I looked all over the UDF section and came across WebSiteStatus UDF but I have had inconsistent results with that one (and that really just checks if you can get to the site...not if it's loaded in IE.)

Didn't know if anyone knew a better way to see if a web page was loaded on a users machine or not.

Thanks,

Note...I cannot use $createobject(InternetExplorer.application) and check the busy variable to do this....long story.

Top
#141118 - 2005-06-06 11:52 PM Re: WEBPageLoaded()??????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you mean, if webpage is loaded now, or if that page is open currently, or if it has been opened at some point say today?
_________________________
!

download KiXnet

Top
#141119 - 2005-06-07 12:04 AM Re: WEBPageLoaded()??????
sliver Offline
Getting the hang of it

Registered: 2002-09-05
Posts: 94
I mean if the web page is currently open in the browser (it won't be open at first)....... Thats what I will keep checking for in my loop...just can't figure out a good way to do this.

EX. of what I'm doing...

Code:
 
While $form.visible
$=Execute($form.doevents(1))
WebPageLoaded(www.mywebpage.com)
Sleep 10
?
?
? "Just Checked For it"
Loop
Quit 1




Not much of a script without the WebPageLoaded() UDF though

Top
#141120 - 2005-06-07 12:12 AM Re: WEBPageLoaded()??????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you have some ways...
think the easiest (that doesn't involve files) way is checking the window title.
it's not 100% sure way, but most likely suites your needs.

now, checking the title... there are many ways and the simplest is to do:
Code:

while setfocus("the desired window title") sleep 1 loop


"loop exited, window is open at that location."
_________________________
!

download KiXnet

Top
#141121 - 2005-06-07 12:19 AM Re: WEBPageLoaded()??????
sliver Offline
Getting the hang of it

Registered: 2002-09-05
Posts: 94
I am worrying about the windows title changing though (I assume it gets that title through the HTML code) or not being the same in all regions (IE...othe countries). Do you know of any other way to do this??? I will test this out though...thanks
Top
#141122 - 2005-06-07 12:34 AM Re: WEBPageLoaded()??????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it does not change by language.
anyways, if you say you can't use com to open the page, you say, you can't do anything that's 100% sure.

well... you can but not that easy...
_________________________
!

download KiXnet

Top
#141123 - 2005-06-07 12:38 AM Re: WEBPageLoaded()??????
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The problem with SetFocus() is that the page title will show before the page load completes. Also, IE can be customized with different titles.

You may be better off using AutoIT which can actually scrape the screen for specific text.

Are you in control of the web page content? If so, you might consider embedding code in it that could be used to notify.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#141124 - 2005-06-07 12:45 AM Re: WEBPageLoaded()??????
sliver Offline
Getting the hang of it

Registered: 2002-09-05
Posts: 94
I am not in control of the web page content...that was another worry I have.

The reason there will be a wait is because these users will be redirected to a hotel registration (pay site) first. After they register.... the original address I sent them too will be displayed at which point I want the program to close itself (when it actually gets to the original website).

Top
#141125 - 2005-06-07 12:48 AM Re: WEBPageLoaded()??????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok...
now as there is some talk about serious methods, you can:
1) destroy the cached file
2) look for it's creation
3) once created, try to delete it
4) when delete is possible, the page has loaded

anyways, you can create whatever methods to make sure the page is opened but I can't understand why you would want to make it 100% sure.
then, how would you control user scripting it to open in hidden window?
_________________________
!

download KiXnet

Top
#141126 - 2005-06-07 12:50 AM Re: WEBPageLoaded()??????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
so this will happen only once, right?
so you could check for the cookie file it most likely will create.
_________________________
!

download KiXnet

Top
#141127 - 2005-06-07 02:54 AM Re: WEBPageLoaded()??????
sliver Offline
Getting the hang of it

Registered: 2002-09-05
Posts: 94
it will happen every time they are at a hotel and need to register....do you mean check for the cookie file and then delete it after the website is closed??? I guess I could do that as long as the cookie name stays the same.
Top
#141128 - 2005-06-07 02:55 AM Re: WEBPageLoaded()??????
sliver Offline
Getting the hang of it

Registered: 2002-09-05
Posts: 94
1) destroy the cached file
2) look for it's creation
3) once created, try to delete it
4) when delete is possible, the page has loaded

Do you mean the temp file that is created???

Top
#141129 - 2005-06-07 03:59 AM Re: WEBPageLoaded()??????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja.

the cookie method and the temp file method are 2 different ones.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 229 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.065 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org