Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


A extraordinary time problem !

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,37389
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> A extraordinary time problem !
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 A extraordinary time problem ! - 8/29/2006 10:23:45 PM   
  electro

 

Posts: 52
Score: 0
Joined: 10/17/2005
Status: offline
Well I got a very simple script but it seems its get trouble with running as task and identifying the time as standard time.
The hole story short:
I have a server(SBS2003) that I use shadow copies every weekday. To do this I have created as script
that takes the snapshot. The script is runned every third hour. Since I dont want to have a lot of snapshots made when nobody
is working I created this little start code.

Const strStartTime="6:00:00"
Const strEndTime="17:00:00"
strStartTime= TimeValue(strStartTime)
strEndTime= TimeValue(strEndTime)
If Hour(Now())>Hour(strStartTime) And Hour(Now())<Hour(strEndTime) Then
' wscript.echo Hour(strStartTime) & " " & Hour(Now()) & " " & Hour(strEndTime)
' -- code from MS scripting page to create snapshot
end if

Now to the funny part:
If I run it as a user I get it to work very well but if I a use a task it doesnt work correctly.
The two snapshot it does create succesfully is made 8:30 and 11:30 and there is supposibly be another at 14:30 but it never gets made.
Runned the scheduled script for a week and the story is the same. It never runs after 12:00 if it is scheduled. My guess this acctually a
problem in how to identify the time in the scheduler. I think that the hour result is 2 or 2 PM not 14 and thats the problem. Any suggestion to
to go around this. Will try do a scheduled script that saves the hour to a textfile.
Any suggestion to solve this(almost certain I am right)
 
 
Post #: 1
 
 RE: A extraordinary time problem ! - 8/29/2006 11:17:19 PM   
  ehvbs

 

Posts: 2171
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi electro,

I think your diagnosis is correct; as a therapy I would use the Date/TimeSerial
functions and comparisions of Date/Time variables to avoid any interference
from VBScript doing something (stupid?) because of the locale.

This code


      

should show what I mean.

Good luck!

(in reply to electro)
 
 
Post #: 2
 
 RE: A extraordinary time problem ! - 8/29/2006 11:21:21 PM   
  electro

 

Posts: 52
Score: 0
Joined: 10/17/2005
Status: offline
I solved it... I totaly embaressed what the error was... :)
It was not in the code it was in me... or rather of my interpretation of windows task scheduler advanced setting :)
sorry if I got you all chasing ghosts
thanks for your help

(in reply to ehvbs)
 
 
Post #: 3
 
 RE: A extraordinary time problem ! - 8/29/2006 11:22:07 PM   
  DiGiTAL.SkReAM


Posts: 1183
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
electro,

Yes.  In Windows, the short date/tiem format is probably hosing your setup.  You should go with a method for normalizing your date/time format, such as is shown here:
http://www.winguides.com/scripting/reference.php?category=23

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to electro)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> A extraordinary time problem ! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts