Hi Guys,
Out of frustration of missing incoming chat messages in gmail I created a vbs script that opens a gmail window for me, monitors it then flashes the window on the task bar upon detecting an incoming transmission.
Its a simple script that could potentially be modifiyed to do all sorts for me at least it does the job that I set out to do so I thought I would share it with the community.
Sam
'-Copy from here paste into a new text file then change the file type to vbs-'
'GMail Control Script – To alert the user of incoming emails and chat messages 'This script may be freely distributed and modified but please share your work and email me any cool mods :) 'Author Sam.Munrogmail.com
Option Explicit Public bIEClosed ' flag to indicate ie closed by user Dim URL: url = "https://mail.google.com/mail/" Dim ie : set ie = wscript.createobject("internetexplorer.application","ie_") with ie .navigate url .Silent = True .ToolBar = False .visible = True do until .readystate = 4 : wscript.sleep 100: loop end with
'Kudos to james a. warrington for providing the ie_OnQuit code bIEClosed = FALSE ' ie up and running
' --- wait loop --- ' on err used to avoid ie.StatusText err after ie closed Dim WshShell Set WshShell = CreateObject("WScript.Shell")
On Error Resume Next
DO WScript.Sleep(200) ie.StatusText = "Powered by GMail Control" If Mid(ie.Document.title,1,11) <> "Google Mail" Or Mid(ie.Document.title,15,7) = "Inbox ("Then WshShell.AppActivate ie.Document.title & " – " & ie.Application.Name 'ie.document.parentWindow.focus() WScript.Sleep(800) End If Loop Until bIEClosed wscript.quit
sub ie_OnQuit() 'MsgBox(" see... we did catch the OnQuit Event ")
' wscript.quit ' this was ignored... ' apparently, the "action" doesn't stop here... ' wsh/vbs insists on going back to what it was doing before ' the event was "fired", and this subroutine called
bIEClosed = TRUE ' close script when you can... end sub
'-EOF-'
|