Jump to content

After adding timer, buttons don't work


Recommended Posts

Hello

I'm making a script to renew my library loans online which i will then put as a scheduled task. I want a gui to pop up so that if i am working at the time i can stop it from running. I added a timer so that if i am not at the computer it will run automatically. Now the buttons do not work. (Numbers replaced with XX as they are password.)

Please can someone help??

#include <GUIConstants.au3>

GUICreate("AutoIt Script", 280, 100) 
GUICtrlCreateLabel("Renew UCL Library Loans?", 30, 10)
$yesbutton = GUICtrlCreateButton("Yes", 30, 60, 100)
$nobutton = GUICtrlCreateButton("No", 140, 60, 100)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()
  
  $begin = TimerInit()
sleep(10000)
$dif = TimerDiff($begin)

  Select
    Case $msg = $nobutton
    Exit

    Case $msg = $yesbutton
    ExitLoop

    Case $dif >= 10000
    ExitLoop
    
  EndSelect
WEnd 

GUIDelete()

Run("C:\Program Files\Mozilla Firefox\firefox.exe -new-window http://library.ucl.ac.uk", "", @SW_MAXIMIZE)
WinWaitActive("UCL01 - Sign-in - Mozilla Firefox")
WinSetState("UCL01 - Sign-in - Mozilla Firefox", "", @SW_MAXIMIZE)
Sleep(1000)
MouseClick("left", 22, 235, 2)
Sleep(7000)
Send("{NUMPAD0}{NUMPAD2}{NUMPAD8}{NUMPAD3}{NUMPAD0}{NUMPAD9}{NUMPAD1}{NUMPAD5}{NUMPAD0}{NUMPAD0}")
Send("{Tab}")
Send("{NUMPADXX}{NUMPADXX}{NUMPADXX}{NUMPADXX}")
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(8000)
MouseClick("left", 556, 236, 2)
Sleep(8000)
MouseClick("left", 196, 529, 2)
Sleep(8000)
MouseClick("left", 549, 311, 2)
Sleep(8000)
MouseClick("left", 834, 234, 2)
Sleep(8000)
MouseClick("left", 834, 234, 2)
Sleep(8000)
Send("!f")
Send("x")
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...