Khab Posted September 8, 2009 Share Posted September 8, 2009 Hey all, I have a script which performs a basic SQL query and outputs to a text file. It includes Array.au3 and Date.au3. On some - but not all - of the aging Win NT4 SP6a machines we have, it gives an error that the Entry Point for RegOpenCurrentUser could not be found in AdvAPI32.dll Yet is fine on other machines also NT4 SP6a. I have tried copying the dll from a machine that works to one that doesn't, to no avail. Any suggestions? Code below. Thanks! expandcollapse popup#include "Array.au3" #include "Date.au3" $startDateInvalid = True While $startDateInvalid $startDate = "" & @MDAY & @MON & StringRight(@YEAR, 2) & "" if @error == 1 Then Exit EndIf if StringLen($startDate) == 6 Then $startDate = StringMid($startDate,1,2) & "." & StringMid($startDate,3,2) & "." & StringMid($startDate,5,2) EndIf $checkStartDate = StringRegExp($startDate, '([0-9]{2}).([0-9]{2}).([0-9]{2})', 1) if @error == 1 Then MsgBox(4096, "Invalid Date", "Invalid Date Entered", 5) ElseIf @error == 0 Then $startDateInvalid = False EndIf WEnd $outputName = "Output_" & @YEAR & @MON & @MDAY & ".txt" $file = FileOpen("C:\Output\" & $outputName, 2) If $file = -1 Then MsgBox(0, "Error", "Unable to create file.", 5) Exit EndIf $DSN_name = "dsn" $userid= "user" $password = "pass" $sql_query = "SELECT * FROM MYTABLE" $ORA_CONN = ObjCreate("ADODB.Connection") $ORA_CONN.Open("DSN=" & $DSN_name & ";UId=" & $userid & ";Pwd=" & $password & ";") RST = ObjCreate("ADODB.Recordset") $RST.Open($sql_query, $ORA_CONN) $array = $RST.GetRows() $numRows = UBound($array) $numCols = UBound($array, 2) FileWriteLine($file, "FIELD_HEADERS") $numRows = $numRows - 1 $numCols = $numCols - 1 For $i = 0 to $numRows Step 1 $lineString2 = $array[$i][0] & $array[$i][3] If $lineString2 <> "" Then FileWriteLine($file, $lineString2) EndIf Next FileClose($file) $RST.Close $RST = 0 Link to comment Share on other sites More sharing options...
99ojo Posted September 8, 2009 Share Posted September 8, 2009 (edited) Hey all, I have a script which performs a basic SQL query and outputs to a text file. It includes Array.au3 and Date.au3. On some - but not all - of the aging Win NT4 SP6a machines we have, it gives an error that the Entry Point for RegOpenCurrentUser could not be found in AdvAPI32.dll Yet is fine on other machines also NT4 SP6a. I have tried copying the dll from a machine that works to one that doesn't, to no avail. Any suggestions? Code below. Thanks! expandcollapse popup#include "Array.au3" #include "Date.au3" $startDateInvalid = True While $startDateInvalid $startDate = "" & @MDAY & @MON & StringRight(@YEAR, 2) & "" if @error == 1 Then Exit EndIf if StringLen($startDate) == 6 Then $startDate = StringMid($startDate,1,2) & "." & StringMid($startDate,3,2) & "." & StringMid($startDate,5,2) EndIf $checkStartDate = StringRegExp($startDate, '([0-9]{2}).([0-9]{2}).([0-9]{2})', 1) if @error == 1 Then MsgBox(4096, "Invalid Date", "Invalid Date Entered", 5) ElseIf @error == 0 Then $startDateInvalid = False EndIf WEnd $outputName = "Output_" & @YEAR & @MON & @MDAY & ".txt" $file = FileOpen("C:\Output\" & $outputName, 2) If $file = -1 Then MsgBox(0, "Error", "Unable to create file.", 5) Exit EndIf $DSN_name = "dsn" $userid= "user" $password = "pass" $sql_query = "SELECT * FROM MYTABLE" $ORA_CONN = ObjCreate("ADODB.Connection") $ORA_CONN.Open("DSN=" & $DSN_name & ";UId=" & $userid & ";Pwd=" & $password & ";") RST = ObjCreate("ADODB.Recordset") $RST.Open($sql_query, $ORA_CONN) $array = $RST.GetRows() $numRows = UBound($array) $numCols = UBound($array, 2) FileWriteLine($file, "FIELD_HEADERS") $numRows = $numRows - 1 $numCols = $numCols - 1 For $i = 0 to $numRows Step 1 $lineString2 = $array[$i][0] & $array[$i][3] If $lineString2 <> "" Then FileWriteLine($file, $lineString2) EndIf Next FileClose($file) $RST.Close $RST = 0 H, try this: After copy of working dll run regsvr32 advapi32.dll This may work. You may have to restart computer. ;-)) Stefan Edited September 8, 2009 by 99ojo Link to comment Share on other sites More sharing options...
Khab Posted September 8, 2009 Author Share Posted September 8, 2009 H,try this:After copy of working dll run regsvr32 advapi32.dllThis may work. You may have to restart computer.;-))StefanThanks for the suggestion, I will schedule some down time tonight to restart it and see how it goes (yes, need to schedule, sadly these NT4 machines are running some high-use apps still, don't ask why lol)Cheers Link to comment Share on other sites More sharing options...
Khab Posted September 13, 2009 Author Share Posted September 13, 2009 It seems this hasn't resolved the issue - most odd. Is there any way to find out why it's even trying to call that DLL ( I presume some functions of AutoIt must require it?) and perhaps do the script in a different way to not require it? 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