Take a look

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Danzig
Newbie
Posts: 10
Joined: Wed Oct 20, 2004 6:52 pm

Take a look

Post by Danzig » Tue Nov 09, 2004 4:51 pm

Anybody see the error in this one it is escaping me..

Code: Select all

VBSTART
Function VBDiff(str_Value1,str_Value2)
	VBDiff = DateDiff("s",str_Value1,str_Value2)
End Function
VBEND

gosub>TimeAndDate
let>time1=%DateAndTime%
mdl>Time1 = %time1%

gosub>TimeAndDate
let>time2=%DateAndTime%
mdl>Time2 = %time2%

vbe>VBDiff(%time1%,%time1%),strTime
mdl>strTime = %strTime%

//// Start of Subs ////
srt>TimeAndDate
			   GDT>DateAndTime
			   GTM>Time
			   let>Time=  %Time%
			   con>DateAndTime,Time
End>TimeAndDate
Thanks in advance

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Nov 09, 2004 5:00 pm

VBScript expects strings in quotes, so you must do this:

vbe>VBDiff("%time1%","%time1%"),strTime
MJT Net Support
[email protected]

Danzig
Newbie
Posts: 10
Joined: Wed Oct 20, 2004 6:52 pm

Post by Danzig » Tue Nov 09, 2004 5:41 pm

That fixed that part of it

Code: Select all

VBSTART
Function VBDiff(str_Value1,str_Value2)
	msgbox "str_Value1 = "&str_Value1&" str_Value2 = "&str_Value2
	VBDiff = DateDiff("s",str_Value1,str_Value2)
End Function
VBEND

gosub>TimeAndDate
let>time1=%DateAndTime%
mdl>Time1 = %time1% DateAndTime = %DateAndTime%

gosub>TimeAndDate
let>time2=%DateAndTime%
mdl>Time2 = %time2% DateAndTime = %DateAndTime%

vbe>VBDiff("%time1%","%time1%"),strTime
mdl>strTime = %strTime%

//// Start of Subs ////
srt>TimeAndDate
			   GDT>DateAndTime
			   GTM>Time
			   let>Time=  %Time%
			   con>DateAndTime,Time
End>TimeAndDate
But the odd thing is that the diff doesn't return the values it is always 0

The vbs below work as it should though

Code: Select all

str_Value1 = "11/9/2004  12:36:04 PM"
WScript.Echo str_Value1

str_Value2 = "11/9/2004  12:36:23 PM"
WScript.Echo str_Value2

msgbox "str_Value1 = "&str_Value1&" str_Value2 = "&str_Value2
	VBDiff = DateDiff("s",str_Value1,str_Value2)
	
	WScript.Echo VBDiff
Any ideas?

Danzig
Newbie
Posts: 10
Joined: Wed Oct 20, 2004 6:52 pm

Post by Danzig » Tue Nov 09, 2004 8:02 pm

posted too soon got it was an id10t error...

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts