VBS Script based on date

Now this may be a little out there for some people but I created a VBS logon script that would popup a website based on the current date on the computer. Now keep in mind the trick is the format of the date.

'########################
' SCHEDULEDPOPUPS.vbs
' Scheduled URL Message Popups
' Author: Paul - https://networksavy.wordpress.com
' Date Created: 8/17/2010
' Used to Schedule System Wide Popup Messages at login
'#########################
' PopUpBetween (STARTDate,ENDDATE,POPUPURL,WIDTH,HEIGHT,fromLEFT,fromTOP)           Popup between these dates
'
' Date format is #YYYY-MM-DD#
'
'Example:
'PopUpBetween #2010-08-02#, #2010-08-04#, 470, 410, 300, 250, "http://www.google.com"
'This launches google between dates 8/2/2010 and 8/4/2010
'
'On Error Resume Next
'===================================================
' Scheduled Popups  Enter Schedule here One per line
'===================================================
'            |  START   |  |   END    |  W  |  H |  L |  T |  URL for popup
PopUpBetween #2010-08-02#, #2010-08-04#, 470, 410, 300, 250, "http://www.google.com"
'            |  START   |  |   END    |  W  |  H |  L |  T |  URL for popup

'-------------------------------------------------------------------
'  Sub for popups Between Two Dates, Date format is #YYYY-MM-DD#
'-------------------------------------------------------------------
Sub PopUpBetween (STARTDate,ENDDATE,WIDTH,HEIGHT,fromLEFT,fromTOP,POPUPURL)
	If (Date + 1) > STARTDATE And (Date - 1) < ENDDATE Then ' Ensures that the current date falls within the start and end date
		InternetExplorer POPUPURL,WIDTH,HEIGHT,fromLEFT,fromTOP ' Executes POPUPURL using the InternetExplorer Sub                                                          
	End If
End Sub

'----------------------------------------
' Sub for Internet Explorer
'----------------------------------------

Sub InternetExplorer (POPUPURL,WIDTH,HEIGHT,fromLEFT,fromTOP)
	With WScript.CreateObject ("InternetExplorer.Application")        'Start Internet Explorer
	  .Navigate POPUPURL                                '<------------ Navigate IE to a URL
      .fullscreen = 0                                   '<------------ Toggle Fullscreen mode 0=off 1=on
      .left       = fromLEFT                            '<------------ Possition from the left of screen
      .top        = fromTOP                             '<------------ Possition from the top of screen
      .Width      = WIDTH                               '<------------ Width of IE window
      .Height     = HEIGHT                              '<------------ Height of IE window
      .ToolBar    = 0                                   '<------------ Toggle IE Toolbar 0=off 1=on
      .MenuBar    = 0                                   '<------------ Toggle IE Menubar 0=off 1=on
      .StatusBar  = 0                                   '<------------ Toggle IE Statusbar 0=off 1=on
      .StatusText = ""                                  '<------------ Set status text in the status bar
      .Visible    = 1                                   '<------------ Toggle IE Statusbar 0=off 1=on
 	End With
End Sub

Now one could take this logic and use it with other tasks.

Advertisements

About Paul Cardelli, CISSP
Cyber Security Analyst, and computer guru

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: