
Ace08
Active Members-
Posts
157 -
Joined
-
Last visited
Ace08's Achievements

Prodigy (4/7)
2
Reputation
-
sanmaodo reacted to a post in a topic: How do you get the mouse coordinates?
-
zxtnt09 reacted to a post in a topic: Simple Database
-
Hi guys I know its just an easy problem but i realy cant figure it out, the idea would be having 2 sets of files one of these file will be a reference while the other will be the input, what im supposed to do here is to count the lines from file1 thats not existing in file 2 and those existing. What i did was open both files, read a line from file1 and checks the lines from file2 if its not existing then it will be counted in the sample below the count for those non existing should only be equal to 2 since "train" and "sub" is not defined from file2 Thanks for the help File1: toy boat plane van train sub File2: toy boat van plane $var = FileOpenDialog ("Choose The File.", @ScriptDir & "\Input", "File(*.txt)" , 2) Local $file = FileOpen($var, 0), $count, $_count ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 Local $line = FileReadLine($file) If @error = -1 Then ExitLoop Local $RefFile = FileOpen(@ScriptDir & "\Input\b.txt",0) If $RefFile = -1 Then MsgBox(0, "Error", "Unable to open reference file.") Exit EndIf While 2 $refFileLine = FileReadLine($RefFile) If @error = -1 Then ExitLoop If $line = $refFileLine Then $count = $count + 1 Else $_count = $_count + 1 EndIf WEnd FileClose($RefFile) WEnd FileClose($file) MsgBox(0,"Notice", "Total match : " & $count & @CRLF & "Count no match : " & $_count)
-
Although im still in the designing part i'll try a different approach to make it running, hopefuly it'll be finished before January ends
-
Thanks somdcomputerguy for the quick response have also do some research and found the needed function #include <GuiDateTimePicker.au3> _GUICtrlDTP_Create($hWnd, $iX, $iY [, $iWidth = 120 [, $iHeight = 21 [, $iStyle = 0x00000000 [, $iExStyle = 0x00000000]]]]) @kylomas wow thanks for the sample script this will come in handy (almost look like the one im making >_<)
-
Hi Guys, Lately we've been extracting a bunch from our database so i thought why not make only one that can save queries instead of creating 1:1 apps and adding them on scheduled task, The problem is how do i make a time picker control(attached is a pic)? or rather, can this be done with autoit? If it is possible kindly guide me with the functions to use. Thank you in advance.
-
Have searched the forum and found out that same question was already asked. Below code was provided by ptrex. Const $adSchemaTables = 20 Const $adOpenStatic = 3 Const $adLockOptimistic = 3 Const $adCmdText = 0x0001 ; =&H0001 Global $s_Filename=FileGetShortName("D:sampletest.xls") ; Initialize COM error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $objConnection = ObjCreate("ADODB.Connection") $objRecordSet = ObjCreate("ADODB.Recordset") $objConnection.Open ("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source="&$s_Filename&";" & _ "Extended Properties=""Excel 8.0;HDR=Yes;"";") ConsoleWrite(_adoListTables() & @LF) ConsoleWrite( @LF) Func _adoListTables() Local $oList = '' If IsObj($objConnection) = 0 Then Return SetError(1) $oRec = $objConnection.OpenSchema($adSchemaTables) While NOT $oRec.EOF If StringLen( $oRec("TABLE_TYPE").value) > 5 Then;; Skip the hidden internal tables $oRec.movenext ContinueLoop EndIf $oList = $oList & $oRec("TABLE_NAME").value & ' | ' $oRec.movenext Wend If $oList <> '' Then Return '|' & StringTrimRight($oList,1) Else SetError(3, 0, 0) Return $oList EndIf EndFunc ;<===> _adoListTables() $objConnection.Close $objConnection = "" $objRecordSet = "" Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc Thanks ptrex
-
Whew thats what im afraid of. might as well look for other options thanks water for the help
-
just xls
-
Hi I'm just wondering is there a way to get the sheet name of an excel file without having to use excel objects? I dont have MS Excel installed on my PC. I've found ptrex's script to read an excel file as dbf but the table name (Sheet Name) also needs to be defined currently i need to read 10 files with different sheet names. Const $adOpenStatic = 3 Const $adLockOptimistic = 3 Const $adCmdText = 0x0001 Global $s_Filename=FileGetShortName("D:\Sample\638FE12D2614.xls") Global $s_Tablename = "[Sheet1$]" ; Initialize COM error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Source XLS data $objConnection = ObjCreate("ADODB.Connection") $objRecordSet = ObjCreate("ADODB.Recordset") $objConnection.Open ("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source="&$s_Filename&";" & _ "Extended Properties=""Excel 8.0;HDR=Yes;"";") $objRecordSet.Open ("Select Count(*) FROM"& $s_Tablename & "Order by 1 Asc" , $objConnection, $adOpenStatic, $adLockOptimistic, $adCmdText) Do ConsoleWrite ($objRecordSet.Fields(0).value+1 [email="&@CR"]&@CR[/email]) ; + 1 because it is 0 based $objRecordSet.MoveNext() Until $objRecordSet.EOF() $objConnection.Close $objConnection = "" $objRecordSet = "" Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc
-
Thanks jchd for the quick response Unforunately yes im bound with dBase IV as the users require the results in this format. Looks like i'll be needing a different approach with this one. Oh man my head hurts.
-
Thanks Spiff59 and jchd for the help. @jchd: I've tried using getrows() however this won't work with me, my query results ranges from 700k+ records and autoit(via MyErrFunc()) gives me an error "Not enough storage is available to complete this operation."
-
Thanks jchd for the response, I already did that in fact it was my original script. Local $DBFConn Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $DBFConn = OpenDBFConn("c:") Func OpenDBFConn($DBFPath) $DBFConn = ObjCreate("ADODB.Connection") $DBFConn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & $DBFPath & ";" & _ "Extended Properties=""DBASE IV;"";") $DBFOpenDBFConn = $DBFConn $DBFrs = ObjCreate( "ADODB.RecordSet" ) ;~ Create a new DBF file named DBFFILETABLE $DBFrs.open("Create Table DBFFILETABLE (FNAME char(50), LNAME char(50), MINIT char(50))",$DBFConn) OpenCon() EndFunc Func OpenCon() ;~ ====================================================================== ;~ DATABASE Connection and Query ;~ ====================================================================== $DBconn = ObjCreate( "ADODB.Connection" ) $DSN = "DRIVER={SQL Server};SERVER=Servername;DATABASE=sqldb;UID=userid;PWD=pwd;" $DBrs = ObjCreate( "ADODB.RecordSet" ) $DBrs.open("select top 10FNAME,LNAME,MINIT from names with (nolock) where date between '02-01-2012 00:00:00.000' and '02-01-2012 23:59:59.998'",$DBConn) Do If $DBrs.EOF() Then ExitLoop $DBFrs.open("Insert into DBFFILETABLE Values('" & $DBrs.Fields(0).value & "', '" & $DBrs.Fields(1).value & "', '" & $DBrs.Fields(2).value & "')" ,$DBFConn) Until $DBrs.EOF() $DBrs.close MsgBox(0,"Report Maker","File has been created") ;~ ====================================================================== EndFunc Func MyErrFunc() Local $HexNumber, $oMyRet[2] $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) MsgBox(0,"Debug","### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF); Error Description SetError(1); something to check for when this function returns Exit EndFunc ;==>MyErrFunc Im looking for a way on how to speed up the insert statement. in the above code I'm inserting it per record but this takes time to finish specialy with huge records.
-
Hi what I'm trying to do here is get the names in our database and return the results to a dbf file. The file creation is working fine even the select statement, however I'm getting an error "Syntax error in INSERT INTO statement." when i add the insert into query with the select query. any help would be appreciated thank you. Local $DBFConn Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $DBFConn = OpenDBFConn("c:") Func OpenDBFConn($DBFPath) $DBFConn = ObjCreate("ADODB.Connection") $DBFConn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & $DBFPath & ";" & _ "Extended Properties=""DBASE IV;"";") $DBFOpenDBFConn = $DBFConn $DBFrs = ObjCreate( "ADODB.RecordSet" ) ;~ Create a new DBF file named DBFFILETABLE $DBFrs.open("Create Table DBFFILETABLE (FNAME char(50), LNAME char(50), MINIT char(50))",$DBFConn) OpenCon() EndFunc Func OpenCon() ;~ ====================================================================== ;~ DATABASE Connection and Query ;~ ====================================================================== $DBconn = ObjCreate( "ADODB.Connection" ) $DSN = "DRIVER={SQL Server};SERVER=Servername;DATABASE=sqldb;UID=userid;PWD=pwd;" $DBrs = ObjCreate( "ADODB.RecordSet" ) $DBFrs.open("Insert into DBFFILETABLE (FNAME,LNAME,MINIT;" & $DBrs.Open("select top 10FNAME,LNAME,MINIT from" & _ " names with (nolock) where date between '02-01-2012 00:00:00.000' and '02-01-2012 23:59:59.998'",$DBConn) ,$DBFConn) $DBrs.close MsgBox(0,"Report Maker","File has been created") ;~ ====================================================================== EndFunc Func MyErrFunc() Local $HexNumber, $oMyRet[2] $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) MsgBox(0,"Debug","### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF); Error Description SetError(1); something to check for when this function returns Exit EndFunc ;==>MyErrFunc
-
Whew I was able to remove the error by removing "adVarWChar" from $tbl.Columns.Append ("Column1", "adVarWChar") However the header looks like "COLUMN1,C,254" anyone know why?
-
Hi Guys, I've found a simple code in vb which creates a simple dbf file after translating it to autoit making the file seems ok however I'm encountering an error "The requested action with this object has failed." when I try to Add/Append columns Dim $tbl = ObjCreate("ADOX.Table") Dim $cat = ObjCreate("ADOX.Catalog") $cat.ActiveConnection = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & @ScriptDir & ";" & _ "Extended Properties=dBase III;" $tbl.NAME = "SAMPLEDB" $tbl.Columns.Append ("Column1", "adVarWChar") ;~ $tbl.Columns.Append ("Column2", "adInteger") ;~ $tbl.Columns.Append ("Column3", "adVarWChar") $cat.Tables.Append ($tbl) I was also able to check ptrex's sample however there are gibberish characters when i try to open it thru excel or scalc(Open Office)
-
Passing Arguments on a DLL Function
Ace08 replied to Ace08's topic in AutoIt General Help and Support
Thanks Shaggi for the help i did look in the help file and that is why i was able to formulate the code posted above which unfortunately is'nt working T_T its a 64bit dll running on a 64 bit PC for the arguments i have attached the documentation below Returns a Boolean value indicating whether the encryption is successful. Syntax encryptFile(strPath, strSourceFile, strPassword, strMessage, strTargetFile) The encryptFile function syntax has these arguments: Part Description strPath Required (String expression). The path or location of file to be encrypted strSourceFile Required (String expression). The filename of file to be encrypted strPassword Required (String expression). The password that will be used during encryption. (Note: The password must be encrypt by the encrypt decrypt program) strMessage Required (String expression). Returning error message during encryption. If strMessage is empty (“”) the encryption is successful otherwise, the error description during encryption will be the value for strMessage. strTargetFile Optional (String expression). The filename that will be used after the encryption. If omitted. The encrypted file will be the source filename with the extension name of “ENC”.