JerryD Posted June 20, 2010 Posted June 20, 2010 I'm working on converting a VB Script to AutoIt. I'm by no means fluent in VB, but can usually figure out what's going on.The script is using a built in function IsNull which I originally thought would mean to return 1 if the variable was either equal to zero or a null string, but that didn't seem to be it.I found a site that has a list of VB Script Commands and discovered that IsNull returns 1 if the variable passed is a DateTime type (IsNull(expression) Is expression a DateTime? True/False).What AutoIt variable type or types would this be? Specifically, how might one write a function IsNull that operates the same way on a variable - specifically part of an object.Or am I oversimplifying the question?Thanks!
enaiman Posted June 20, 2010 Posted June 20, 2010 In AutoIt you have either strings or numbers. You can have the date/time in two formats: - string: 21/06/2010 10:20 - Unix Time Format: (the number of seconds that have elapsed since midnight 1.1.1970 UTC) So, in order to check if something is a "valid time" you will need to use some checks (best with RegEx). Not very easy but doable. That's what "I" know; others might know more than myself. Good luck. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
ResNullius Posted June 21, 2010 Posted June 21, 2010 (edited) @JerryD,Looking at the script you linked to, the 1st use of IsNull is thisSet UpdateSession = CreateObject("Microsoft.Update.Session") if IsNull(UpdateSession) then wscript.quit end ifIf that's the use you're wondering about, then this is simply testing for the valid creation of the Update.Session object.So AutoIt equivalent would be$oUpdateSession = ObjCreate("Microsoft.Update.Session") If Not IsObj($oUpdateSession) then exit EndIfHope that helps.Edit: Looking at the rest of the script, IsNull is also sometimes being used as you suspected, to test whether a string is passed (as in arguements to a function).Perhaps if you post your conversion efforts and where you feel the script is failing, we can offer more insight.Edit 2: Looks like the VB Functions page you linked to is a victim of a cut and paste error for their IsNull definition. See this one instead: http://www.w3schools.com/vbscript/func_isnull.asp Edited June 21, 2010 by ResNullius
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now