Jump to content
Sign in to follow this  

Webpage Auto-Refresher

Recommended Posts


At work, we use the Outlook Web Access system to read work emails offsite, however it tends to timeout after a few minutes which bugged the hell out of my workmates and I, so I wrote this. Any comments or suggestions would be appreciated! :)

I think the comments pretty much make most of it self-explanatory. It may seem a strange way to program it, but I am trying to get it to work when the workstation is locked. No such luck as yet...

; OWAKeepAlive - refreshes Webmail once in a while to stop it timing out
; by Jason Oakley aka WauloK

; Get functions to use _SendMessage
#include <SendMessage.au3>
#include <WindowsConstants.au3>

; Start OWAKeepAlive when PC starts up.
If Not FileExists(@StartupDir & '\WebmailKeepAlive.lnk') Then
    FileCreateShortcut(@ScriptFullPath, @StartupDir & '\ WebmailKeepAlive.lnk')

; $OWAActive - OWAKeepAlive activated or not
Global $OWAActive; Is this turned on?
Global $RefreshDelay; Pause before refresh again
$AppVerNo = "1.01"; This application's version number.
Global $AppName = "Webmail Keep-Alive"; Set name of this AutoIT Application

; Set Delays
$Delay = 60000; Sixty Seconds
$MiniDelay = $Delay/60; One second

; Notify user with a Tooltip what's started
TrayTip($AppName & " v" & $AppVerNo, "Press the SCROLL-LOCK key to (de)activate!", 2, 1) 
TrayTip("clears any tray tip","",0)

; Set up Hotkey to (de)activate OWAKeepAlive
HotKeySet("{SCROLLLOCK}", "OWAToggle")

; Do the refreshing on the OWA screen

    While ($OWAActive)

    ; Set Delays
        $Minutes = 2; Refresh delay in minutes
        $Delay = 60000*$Minutes; Sixty Seconds & $Minutes
        $MiniDelay = $Delay/60/$Minutes; One second

        $OWATitle = "Microsoft Outlook Web Access"; Set the title to activate

    ; Send F5 Key to refresh directly to the OWA window
        $hwnd = WinGetHandle( $OWATitle )
        ControlSend($hwnd, '', '', '{F5}')
        $MiniDelay = $Delay/60; One second

    ; Notify user and delay a while.
        TrayTip($AppName, "Sent Refresh. Waiting " & $Minutes & " minutes...", 1, 1)
        TrayTip($AppName, "ACTIVATED! Deactivate with SCROLL-LOCK Key!", 1, 1)
        TrayTip("clears any tray tip","",0)

    ; Do the delay bit
        $RefreshDelay = $Delay/1000;
        While ($RefreshDelay)

; Enable/Disable OWAKeepAlive
Func OWAToggle()
; Set Delays
    $Delay = 60000; Sixty Seconds
    $OWAActive = NOT $OWAActive
    If $OWAActive Then
        TrayTip($AppName, "ACTIVATED!", 1, 1)
        TrayTip("clears any tray tip","",0)
        TrayTip($AppName, "De-Activated", 1, 1) 
        TrayTip("clears any tray tip","",0)

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.