Posts: 45
Threads: 15
Joined: Jul 2006
Hello i have a webpage that i need to open every 3 hours, 45 minutes and put my name and password in can someone please give me an example on how to put a timer in so it opens webpage enters info then close and reopens in 3 hours 45mins and so on..
thanks
Posts: 12,140
Threads: 142
Joined: Dec 2002
Create function MyTimerFunction and paste this:
;This function will run every 3 hours 45 minutes.
;To see how it works, you can run it using the Run button in the QM toolbar.
;Change xxx, username and password.
int hwnd
web "http://xxx" 1|8 "" "" 0 hwnd
AutoPassword "username" "password" ;;note: older QM versions don't have AutoPassword function.
10
clo hwnd
In Properties, click Schedule and set schedule. Or, instead of sheduler, use this code:
int hour=60*60
int minute=60
tim (3*hour)+(45*minute) MyTimerFunction
Posts: 45
Threads: 15
Joined: Jul 2006
Wow You are fast THANKS for the quick answer Gin..
Posts: 12,140
Threads: 142
Joined: Dec 2002
Posts: 45
Threads: 15
Joined: Jul 2006
Thanks Gin it seems to work well but i'm not sure if my coding is the best can u look at it and tell me if it can be coded better i have added a couple comments so u know what i'm trying to do. i have a few wait commands and sometimes they don't seem to work..
int hwnd
web "http://xxxxxxxx" 0|8 "" "" 0 hwnd
wait 1.5
AutoPassword "username" "password" 0x0 win("xxxxxxxxx" "IEFrame")
key TY;wait 2.5 ;;this for clicking login after entering name and password
lef 506 422 0 1 ;;to click on something after i have logged on
10
clo hwnd
Posts: 12,140
Threads: 142
Joined: Dec 2002
Your code is good. Maybe 2.5 is too short time. Here is my version:
int hwnd
web "http://xxxxxxxx" 1|8 "" "" 0 hwnd
AutoPassword "username" "password" 0x1 hwnd 5
;find an element in the web page; wait max 30 s for the page/element
Htm el=htm("x" "x" "x" hwnd "" x x 30) ;;to insert this command, use dialog "Find html element"
el.Click
10
clo hwnd
;wait 0.5 removed because: 1. Flag 1 used in web. 2. A wait time used in AutoPassword.
;key TY removed because flag 1 can be used in AutoPassword.
;wait 2.5 removed because htm waits if you specify a wait time.
;lef 506 422 0 1 removed because el.Click can precisely click without the mouse.
Posts: 229
Threads: 22
Joined: Sep 2007
i like the above examples, just wondering how to stop it. without closing qm is there a code i can put in another function that will close it down, ive tried shutdown -6 0 "MytimerFuncrtion" doesnt work for me. ty
Posts: 12,140
Threads: 142
Joined: Dec 2002
To stop a timer started by tim, use tim with period 0 and with the same function name.
tim 0 MyTimerFunction