Posts: 17
Threads: 3
Joined: Feb 2013
Hi,
I have a function which refreshes a webpage in Internet Explorer using html element. I want it repeating again and again immediately when web page is loaded fully. It might take 0.5 seconds to 1.5 seconds to load page normally.
FUNCTION pagerefresh
int w=wait(30 WV win("Welcome To REALTrans - Internet Explorer" "IEFrame"))
rep
Htm e=htm("U" "New Offers " "" w "1/1/2" 5 0x21 0)
e.Click
Your help would be appreciated.
Thank you.
Posts: 1,334
Threads: 61
Joined: Jul 2006
to make that function repeat you need to move the rep command
not tested may not work as expected
Function
pagerefresh
rep
,int w=wait(30 WV win("Welcome To REALTrans - Internet Explorer" "IEFrame"))
,Htm e=htm("U" "New Offers " "" w "1/1/2" 5 0x21 0)
,e.Click
,1.5
you will probably need to alter the code some..
Posts: 17
Threads: 3
Joined: Feb 2013
You have put fixed delay of 1.5 which I don't want. I want to refresh immediately as the page loading is complete. If it load in 0.5 seconds then it should refresh immediately, if it loads in 1.5 seconds then it should refresh accordingly. So that is what I want. Let me know if anything is there which waits for page to load fully.
Thank you and waiting to hear from you.
Posts: 1,334
Threads: 61
Joined: Jul 2006
you can adjust the delay or remove it.It was just added so the function doesn't max out your cpu
also can try example
instead of fixed wait
wait 0 I "http://www.quickmacros.com/forum";;;change to your website address
or specify more options in htm
Posts: 1,334
Threads: 61
Joined: Jul 2006
read about htm and wait in qm help for more info. You may or may not need to adjust the speed of the function if it runs to fast may error or worse max out your cpu
Posts: 17
Threads: 3
Joined: Feb 2013
That does not work, let me know if any other function or anything which can do this.
Posts: 1,334
Threads: 61
Joined: Jul 2006
what is error?
please paste your code so can evaluate it better
see
http://www.quickmacros.com/forum/showthread.php?tid=786 for more info on how to do this
Posts: 17
Threads: 3
Joined: Feb 2013
Here are codes which refreshing constantly without waiting for page to load fully.
rep
int w=wait(30 WV win("Welcome To REALTrans - Internet Explorer" "IEFrame"))
Htm e=htm("U" "New Offers " "" w "1/1/2" 5 0x21 30)
e.Click
wait 0 I "https://as.realtrans.com/webtop/default.html"
Posts: 12,055
Threads: 140
Joined: Dec 2002
When creating code for htm, in the "Find html element" dialog specify a wait time. Then the function will wait for the element. That is how we wait for "web page loaded".
Posts: 17
Threads: 3
Joined: Feb 2013
As you can see there is already specified 30 seconds in my code of Htm element wait, let me know how it can repeat only after webpage loading is done.
Posts: 12,055
Threads: 140
Joined: Dec 2002
The code should work. I cannot test.
Try to insert wait 0.3 before the wait 0 I line.
It depends on web page, maybe the page does not set "browser busy" state, then wait 0 I cannot wait.
If something in the web page changes when it is finished refreshing, try to capture a changed or created html element or accessible object, and wait for it. I cannot test, cannot give you the code.
Posts: 17
Threads: 3
Joined: Feb 2013
That worked perfectly! Thanks a million!!!