NeptuneIT Posted October 19, 2006 Share Posted October 19, 2006 I'm attempting to use AutoIt to build a GUI for a vbscript that my company uses. I've tried converting the vbscript to AutoIt but there is a function that cannot convert. My next plan was to build the GUI in AutoIt and then have it fire off the vbscript located on a network share. Is there a way to pass variables from the AutoIt script to the VBScript? Is this the best way to do what i'm trying to do or is there a way to embed a vbscript inside an AutoIt script without having to convert? This is my first attempt at making a productive AutoIt script (I've made a few bots) so I appreciate any help someone can lend me! Thanks! Link to comment Share on other sites More sharing options...
BigDod Posted October 19, 2006 Share Posted October 19, 2006 I know nothing about VBS but you could have AutoIt write the variable to an ini file for your VBS script to read. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
MHz Posted October 19, 2006 Share Posted October 19, 2006 1. What function? 2. Commandline is easiest, then... 3. ScriptControl object, but not 100% perfect (and point 1 is concern with SC) 4. We try to help Link to comment Share on other sites More sharing options...
NeptuneIT Posted October 19, 2006 Author Share Posted October 19, 2006 1. What function?CDate - searched the forums about this one and it seem someone else is using the same function to convert dates from active directory but no one ever responded to him. Here's the full function of which CDate is a part: Function Integer8Date(objDate, lngBias) ' Function to convert Integer8 (64-bit) value to a date, adjusted for ' local time zone bias. Dim lngAdjust, lngDate, lngHigh, lngLow lngAdjust = lngBias lngHigh = objDate.HighPart lngLow = objdate.LowPart ' Account for error in IADslargeInteger property methods. If lngLow < 0 Then lngHigh = lngHigh + 1 End If If (lngHigh = 0) And (lngLow = 0) Then lngAdjust = 0 End If lngDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _ + lngLow) / 600000000 - lngAdjust) / 1440 ' Trap error if lngDate is ridiculously huge. On Error Resume Next Integer8Date = CDate(lngDate) If Err.Number <> 0 Then On Error GoTo 0 Integer8Date = #1/1/1601# End If On Error GoTo 0 End Function 4. We try to help Thanks! Link to comment Share on other sites More sharing options...
NeptuneIT Posted October 19, 2006 Author Share Posted October 19, 2006 I know nothing about VBS but you could have AutoIt write the variable to an ini file for your VBS script to read.I'm pretty sure I can get the vbscript to read the ini file - Can you point me where to look to get AutoIt to write to an ini?Thanks! Link to comment Share on other sites More sharing options...
PaulIA Posted October 19, 2006 Share Posted October 19, 2006 Look in the AutoIt help file under IniWrite Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
NeptuneIT Posted October 19, 2006 Author Share Posted October 19, 2006 Look in the AutoIt help file under IniWritePerfect! Thanks a ton Link to comment Share on other sites More sharing options...
MHz Posted October 19, 2006 Share Posted October 19, 2006 CDate - searched the forums about this one and it seem someone else is using the same function to convert dates from active directory but no one ever responded to him. Here's the full function of which CDate is a part:CDate, ohh, tough one as AutoIt has no date function except for the macros. Here is a quick untested hack. ScriptControl sometimes dislikes comments, and certain VBS functions and syntax. "On Error Goto..." would seem useless under a virtual script execution. ScriptControl can use code from a FileRead() but as stated, not 100% perfect at doing it by far (i.e. may not work). Not sure how to call and test this function but what I have come along with which may give you some direction. expandcollapse popupInteger8Date(9223372036854775807, 0); hmm.. :( Func Integer8Date($objDate, $lngBias) Local $code, $oSC $code = _ "Function Integer8Date(objDate, lngBias)" & @CRLF & _ "' Function to convert Integer8 (64-bit) value to a date, adjusted for" & @CRLF & _ "' local time zone bias." & @CRLF & _ " Dim lngAdjust, lngDate, lngHigh, lngLow" & @CRLF & _ " lngAdjust = lngBias" & @CRLF & _ " lngHigh = objDate.HighPart" & @CRLF & _ " lngLow = objdate.LowPart" & @CRLF & _ "' Account for error in IADslargeInteger property methods." & @CRLF & _ " If lngLow < 0 Then" & @CRLF & _ " lngHigh = lngHigh + 1" & @CRLF & _ " End If" & @CRLF & _ " If (lngHigh = 0) And (lngLow = 0) Then" & @CRLF & _ " lngAdjust = 0" & @CRLF & _ " End If" & @CRLF & _ " lngDate = #1/1/1601# + (((lngHigh * (2 ^ 32)) _" & @CRLF & _ " + lngLow) / 600000000 - lngAdjust) / 1440" & @CRLF & _ "' Trap error if lngDate is ridiculously huge." & @CRLF & _ " On Error Resume Next" & @CRLF & _ " Integer8Date = CDate(lngDate)" & @CRLF & _ " If Err.Number <> 0 Then" & @CRLF & _ " On Error GoTo 0" & @CRLF & _ " Integer8Date = #1/1/1601#" & @CRLF & _ " End If" & @CRLF & _ " On Error GoTo 0" & @CRLF & _ "End Function" $oSC = ObjCreate('ScriptControl') If Not @error Then $oSC.language = 'VBScript' $oSC.addcode ($code) Return $oSC.run ('Integer8Date', $objDate, $lngBias) Else Return SetError(1, 0, '') EndIf EndFunc Link to comment Share on other sites More sharing options...
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