-
Posts
30 -
Joined
-
Last visited
Profile Information
-
Location
Germany
Automania's Achievements

Seeker (1/7)
0
Reputation
-
Automania reacted to a post in a topic: [solved] Last row in Excel returns wrong value
-
[solved] Last row in Excel returns wrong value
Automania replied to Automania's topic in AutoIt General Help and Support
Thanks! Useful guide! -
[solved] Last row in Excel returns wrong value
Automania replied to Automania's topic in AutoIt General Help and Support
Found the error. I had 2 excel sheets open and it seemed to take the value from the other one (wasn't really obvious until I took a different excel file). Even though I deleted the $oExcel object (as well as tried $oExcel1 for the other excel file) it still referenced to the wrong Excel file that was opened first. Wasn't aware of that. Now that I closed one Excel file it referenced the correct row value from the other, desired Excel file. -
Automania reacted to a post in a topic: [solved] Last row in Excel returns wrong value
-
[solved] Last row in Excel returns wrong value
Automania replied to Automania's topic in AutoIt General Help and Support
Thanks again, DanP2. Didn'T know about ctrl+end. I created a completely new file and it shows 1 (wasn't the case yesterday but then I tried some of the disabled commands in the code)! Now knowing that it generally works I can narrow down the issue. Thanks again! -
Hi all, I've been pulling my hair out. I try to find out the row number of the last row being used to append new data into an excel sheet. I tried various commands and they always return something different but not the number they should. In the most recent example it always returns 10 even though I only got a single string in A1. So I would expect to get 1 as result, not (row) 10: #include <Excel.au3> Local $path = @MyDocumentsDir & "\result.xlsx" Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, $path) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf ;$lastrow = $oExcel.Range("A1").SpecialCells($xlCellTypeLastCell) ;local $LastRow = $oWorkbook.ActiveSheet.UsedRange.SpecialCells($xlCellTypeLastCell) ;Local $LastRow = $oWorkbook.ActiveSheet.UsedRange.Rows.Count $lastrow = $oExcel.ActiveSheet.UsedRange.Rows.Count ;$lastrow = $oWorkbook.ActiveSheet.Cells.SpecialCells($xlCellTypeLastCell).row MsgBox(0,"lastrow", $lastrow) _Excel_Close($oWorkbook) result.xlsx
-
Automania reacted to a post in a topic: [solved] extract data from website and export to Excel - (Moved)
-
Thanks for moving, sorry for posting this in the wrong area. It's an internal tool. I am not certain as I do not really have a clue about API. I suppose if they have one I wouldn't get access. It uses a form where I can put in single usernames and then it outputs associated hardware data in a table. My knowledge goes only so far that I can manipulate the url to input the username in the url already instead of putting it into the form field. Hence my initial idea of using IEextract. If there is anything more you'd like to know I'll be happy to answer (as far as I know). _IETableWriteToArray sounds very interesting, thank you! Will be interesting to find out if the function is able to identify each cell entry. That would save me a lot of trial'n'error regexpression work! edit: I just tested_IETableWriteToArray with my use case. Works like a charm! Thank you so much, Danp2!!
-
Hi all, I haven't used AutoIt in more than 10 years and I am sure a lot has improved since that long time. I hope you can give me some suggestions on my approach. Task: I need to extract user data (for around 1700 users) from a website tool. That tool shows an output in a table on the website. However, no export feature is available and I need the data in an Excel file, such as: username, serial number (of a laptop), ID number (of laptop) and some more With my knowledge from 2009 I would do this: 1) use _IEextract with each username in the url to get the whole source code of the website with the user's data summary 2) Work with lots of regexpressions to extract each data piece, save them into variables/array 3) Write variable values into an Excel file 4) rinse repeat 1700 times The relevant line for step 3 looks like this: <td class="resultcell"><span class="new">2021-03-23 11:05:00</span></td><td class="resultcell">Hostname-1234</td><td class="resultcell"><a href="?&Search=Search&result=summarized%20history&field=serial%20numbers&criteria=123456">123456</a></td><td class="resultcell">0987654/td><td class="resultcell"><a href="?&Search=Search&result=summarized%20history&field=usernames&criteria=myusername">myusername</a> and so on.. so here it would be Hostname-1234, 0987654 and myusername that I would need to extract. Although this may work it does not appear very efficient and would take a while. So I am happy for an alternate approach. Preferably, without using additional exe binary files due to company policies besides AutoIt itself.
-
In case you'd like to pass on the compiled script or don't want to hardcode the login data for whatever reason you could also use command line parameters instead (plus a shortcut): #include <IE.au3> Opt('MustDeclareVars', 1) Global $oIE, $sURL, $tForm, $FormElem, $oSubmit, $oForm, $username, $password if $CmdLine[0] = 2 Then ;if script was launched with 2 command line parameters $username = $CmdLine[1] $password = $CmdLine[2] Else MsgBox(16, "Unlocator Script", "Please launch with command line parameters for your username and password." & @CR & "For example:" & @CR & "unlocator.exe email@domain.com password123") exit EndIf $sURL = 'https://www.unlocator.com/account/login' $oIE = _IECreate($sURL) ;open IE window and browse given website $tForm = _IEFormGetObjByName($oIE, 'login') $FormElem = _IEFormElementGetObjByName($tForm, 'amember_login') _IEFormElementSetValue($FormElem, $username) ;fill in user name in respective form field $tForm = _IEFormGetObjByName($oIE, 'login') $FormElem = _IEFormElementGetObjByName($tForm, 'amember_pass') _IEFormElementSetValue($FormElem, $password) ;fill in password in respective form field _IEFormSubmit($tForm, 0) ;send form to complete website login _IELoadWait($oIE) $oForm = _IEFormGetCollection($oIE, 0) _IEFormSubmit($oForm) ;press "Update IP" button sleep(3000) ;optional _IEQuit($oIE) ;close browser instance
-
Hello, I created a script that automatically updates one's own IP for the unlocator.com service (tested with IE 10 and 11 on Win7 64bit): #include <IE.au3> Opt('MustDeclareVars', 1) Global $oIE, $sURL, $tForm, $FormElem, $oSubmit, $oForm $sURL = 'https://www.unlocator.com/account/login' $oIE = _IECreate($sURL) ;open IE window and browse given website $tForm = _IEFormGetObjByName($oIE, 'login') $FormElem = _IEFormElementGetObjByName($tForm, 'amember_login') _IEFormElementSetValue($FormElem, 'email@domain.com') ;fill in user name in respective form field $tForm = _IEFormGetObjByName($oIE, 'login') $FormElem = _IEFormElementGetObjByName($tForm, 'amember_pass') _IEFormElementSetValue($FormElem, '12345') ;fill in password in respective form field _IEFormSubmit($tForm, 0) ;send form to complete website login _IELoadWait($oIE) $oForm = _IEFormGetCollection($oIE, 0) _IEFormSubmit($oForm) ;press "Update IP" button sleep(3000) ;optional _IEQuit($oIE) ;close browser instance Of course, don't forget to replace email@domain.com with your registered email address and 12345 with your actual password. Note: it ran fine on my work PC but not at home (had an older autoit version there). So if it doesn't work, try the latest Autoit version.
-
Thanks for the reply. I have now fixed the issue. For some reason, the line to create the certificate from posting #8 created a file which I couldn't sign with although I installed it (the error mentioned above). So instead I tried the line from the website you linked in posting #9: makecert -r -pe -n "CN=Your Name" -b 01/01/2000 -e 01/01/2099 -eku 1.3.6.1.5.5.7.3.3 -ss My and this works perfectly. Great script! Thanks a lot!
-
Sorry, I should have given you the error message. Unfortunately, the COM error is in German but freely translated it would look like this: windescription: no provider was set for the memory or the object. err.number is: 80020009 By the way, is it correct that the following (first) line is equal to "" ? $oSigner = "" ; Use a valid certificat
-
Hello, I created the .cer file as described in posting #8 by makecert.exe on my local PC, then double clicked and installed it (received a success message). However, the script keeps saying it can't find the certificate and the private key, where's my mistake here? These are the cert details I used for makecert.exe makecert.exe -sk "mycert123" -r -n "CN=mycompany,O=myorg,E=me@test.com" test_cert.cer (as said, I then double clicked the .cer file and installed it) and this is the modified script: ; Initialize error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $Script = @ScriptDir & "\testscript.vbs" ; --------------------------------- Sign it ---------------------------------- $oSigner = ObjCreate("Scripting.Signer") $oSigner.SignFile ($Script, "mycert123") $oSigner = "" ; Use a valid certificat ; you can do this by going to a server that has a certificate service running. ; And than export a certificate that is OK for Signing Code. ; Then import this on the client. ;This is custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"AutoItCOM 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?oÝ?÷ Ûp? Ú¶êÞ??)àIÊâ¦Ö®¶?sc²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒ6?V6²?BÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒТb33c¶&Æå6?÷tuT?ÒG'VP¢b33c¶ö&¥6?væW"Òö&¤7&VFR?gV÷Cµ67&?F?ærå6?væW"gV÷C² ¢b33c¶&Æä?56?væVBÒb33c¶ö&¥6?væW"åfW&?g?f?ÆR?b33cµ67&?BÂb33c¶&Æå6?÷tuT? ¤?bb33c¶&Æä?56?væVBF?Và¢6öç6öÆUw&?FR?gV÷Cµ67&?B?2&VVâ6?væVBâgV÷C²fײÄb??¤VÇ6P¢6öç6öÆUw&?FR?gV÷C²67&?B?2æ÷B&VVâ6?væVBâgV÷C²fײÄb??¤VæD?` ¢b33c¶õ6?væW"ÒgV÷C²gV÷C° EndFunc
-
Context related help possible in AutoIt?
Automania posted a topic in AutoIt General Help and Support
Hello, Thanks to the good support in this forum I was able to create a help.chm for my application with the help of Microsoft HTML Help (http://msdn.microsoft.com/en-us/library/ms669985.aspx). This seems to support context related help, i.e. pressing F1 when being in a specific menu or so will open the respective part in the help file. Sadly, the tutorials I found on google are for Visual Basic. Is it possible to code something like this in AutoIt too? I really have no clue where to start. A tiny code example would help a lot, too. -
[solved] Help application as in Scite?
Automania replied to Automania's topic in AutoIt General Help and Support
That's it, thank you. -
Help with multiple things. ControlSend+Inputs
Automania replied to BlueDucky's topic in AutoIt General Help and Support
I'm not entirely sure what you try to send through the variables as well as I am not sure if controlsend is what you want if you do not actually access a control. Did you try the send command? The help file recommends using lower case for letters to avoid issues. It's a good idea to make the window the active one before sending the keys as well as adding short delays between the sent keys to avoid timing issues. In that case it'd be: winactivate("Nomad of Silver Spirit - Nostale", "") Send("Nomad of Silver Spirit - Nostale", "", "{x}") sleep(10) Send("Nomad of Silver Spirit - Nostale", "", $a) -
Sorry for the really late reply. I must have had some error somewhere, litlmike found the error. I got it to work a few days ago thanks to your help, guys. Here's the complete code for anyone stumbling across this via search: $FULL_MDB_FILE_NAME = @ScriptDir & "\database.mdb" $SQL_CODE = "select * from Table1" $CONN = ObjCreate("ADODB.Connection") $CONN.Open('Driver={Microsoft Access Driver (*.mdb)};Dbq=' & $FULL_MDB_FILE_NAME & ';') $RecordSet = ObjCreate("ADODB.Recordset") $conn.Execute("UPDATE Table1 SET Column1 = 'hello' WHERE Column2 = 'world'") $CONN.Close In this case the value will be changed in each field to "hello" if column2 contains "world" in the row. I noticed the code line even accepts multiple conditions if you want to update only specific rows: WHERE Column2 = 'world' AND WHERE Column3 = 'and everyone else' Thank you very much, everyone!