It is currently Sat May 25, 2013 5:12 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Script to run an application at a specific date
PostPosted: Thu Jul 26, 2012 8:54 am 
Offline

Joined: Mon Mar 16, 2009 11:56 am
Posts: 252
Hello,

I would need a simple VB script (or a batch file or any other tool different from Windows or other task scheduler) that would permit me to run an application or open a folder at a specific date (time is irrelevant) on a XP Pro SP3 32-bit system.

I was thinking of something that (I would convert to an exe and):

- I could add to the Windows startup.

- At every boot it would check the system date and close itself if the date would not be up yet (so in principle no user interaction should be required)

- Upon booting on a specified date (or *any time* after a specified date) it would either execute a file or open a specific folder (situated at a specific path on the local disk).

Once again, without any GUI and without any user interaction/confirmation.

Tnx in advance for your valuable support :mrgreen:


Top
 Profile  
 
 Post subject: Re: Script to run an application at a specific date
PostPosted: Thu Jul 26, 2012 11:15 am 
Offline
User avatar

Joined: Mon Aug 27, 2007 2:00 am
Posts: 3740
I can't help you in VBScript, but AutoIt would be easy.

_________________
Added 177 Applications: Portable and an AutoIt MVP
SoftwareSpot - Portable Apps


Top
 Profile  
 
 Post subject: Re: Script to run an application at a specific date
PostPosted: Thu Jul 26, 2012 11:39 am 
Offline

Joined: Mon Mar 16, 2009 11:56 am
Posts: 252
guinness wrote:
I can't help you in VBScript, but AutoIt would be easy.
Sure, go right ahead with your AutoIt magics :mrgreen:

Tnx


Top
 Profile  
 
 Post subject: Re: Script to run an application at a specific date
PostPosted: Thu Jul 26, 2012 11:44 am 
Offline
User avatar

Joined: Mon Aug 27, 2007 2:00 am
Posts: 3740
Code:
#include <Date.au3>

If _IsDateOrAbove('20120729') Then ; If the date is the 29th July 2012 or greater then run the following application.
   Exit Run(@ProgramFilesDir & '\Example.exe')
EndIf

; Version: 1.00. AutoIt: V3.3.8.1 (by guinness)
; Check if a date is equal to/or has passed the current date. Pass the string YYYYMMDD e.g. 20121225.
Func _IsDateOrAbove($sDateString)
   Local $aArray = StringRegExp($sDateString, '(\d{4})(\d{2})(\d{2})', 3)
   If @error = 0 Then
      $sDateString = $aArray[0] & '/' & $aArray[1] & '/' & $aArray[2]
   EndIf
   Return (_DateDiff('D', $sDateString, @YEAR & '/' & @MON & '/' & @MDAY) >= 0)
EndFunc   ;==>_IsDateOrAbove

_________________
Added 177 Applications: Portable and an AutoIt MVP
SoftwareSpot - Portable Apps


Top
 Profile  
 
 Post subject: Re: Script to run an application at a specific date
PostPosted: Thu Jul 26, 2012 1:11 pm 
Offline

Joined: Mon Mar 16, 2009 11:56 am
Posts: 252
Thanks a lot guinness,

Your script works perfectly and solved my problem :mrgreen:


Top
 Profile  
 
 Post subject: Re: Script to run an application at a specific date
PostPosted: Thu Jul 26, 2012 1:14 pm 
Offline
User avatar

Joined: Mon Aug 27, 2007 2:00 am
Posts: 3740
spicydog wrote:
Thanks a lot guinness,

Your script works perfectly and solved my problem :mrgreen:
Really? Oh OK. :mrgreen:

_________________
Added 177 Applications: Portable and an AutoIt MVP
SoftwareSpot - Portable Apps


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group