Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with timing
#1
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
#2
Create function MyTimerFunction and paste this:
Code:
Copy      Help
;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:

Code:
Copy      Help
int hour=60*60
int minute=60
tim (3*hour)+(45*minute) MyTimerFunction
#3
Wow You are fast THANKS for the quick answer Gin..
#4
edited
#5
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..

Code:
Copy      Help
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
#6
Your code is good. Maybe 2.5 is too short time. Here is my version:

Code:
Copy      Help
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.
#7
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
#8
To stop a timer started by tim, use tim with period 0 and with the same function name.

tim 0 MyTimerFunction


Forum Jump:


Users browsing this thread: 1 Guest(s)