Paul2 Posted January 6, 2014 Share Posted January 6, 2014 (edited) Hello everybody, I just started using Autoit and this is my first program I actually want to put to use. It opens an Excel file were it should copy values to a warehouse management system. But the values are always 0. Does anybody know why? I try to get the data from range "A19" and can´t figure out why I won´t get it. expandcollapse popup#include <Excel.au3> Func _WinWaitActivate($title, $text, $timeout = 0) WinWait($title, $text, $timeout) If Not WinActive($title, $text) Then WinActivate($title, $text) WinWaitActive($title, $text, $timeout) EndFunc ;==>_WinWaitActivate $Lieferschein = FileOpenDialog("Lieferschein auswählen", "C:\Users\Paul\Dropbox\JTL\Lieferscheine", "(*.*)") ;Opens the packinglistfolder _ExcelBookOpen($Lieferschein) ;Opens the choosen Packinglist $Zeile = 18 ;Variable for Cell (Cell 18 ist the header of the packagelist) $Anzahl = 1 _WinWaitActivate("Manuelle Bestellung beim Lieferanten", "Status der Bestellun") ;The window I want the data to copy to MouseClick("left", 659, 938, 1) ;Activates the right box If _ExcelReadCell($Lieferschein, $Zeile, 1) = "SAP-Artikel-Nr." Then ;Checks if the xlsx is in right form Do $Zeile = $Zeile + 1 $SAP = _ExcelReadCell($Lieferschein, $Zeile, 1) ;Saves SAP Number $Menge = _ExcelReadCell($Lieferschein, $Zeile, 4) ;Saves quantity $Zeile = $Zeile + 1 ;Counts MsgBox(0, $SAP, $Menge) ;Check Values For $Zaehler = $Menge To 0 Step -1 ;Puts article in jtl as often as its on the packinglist Send($SAP) Send("{Enter}") Next Until $SAP = "" ;Ends when all are in Else MsgBox(0, "Fehler", "Der Lieferschein hat nicht die Gültige Form") EndIf The Spreadsheet: (From Row 18 to 22) A B C(empty) D 18 SAP-Artikel-Nr. Artikel-Bezeichnung Menge 19 100015016 AEG POCKET SPANNUNGSWANDLER SI 150 150W IPOD 1 20 100020938 CARTREND OBD II DIAGNOSEGERÄT 1 21 100015656 BRÜDER MANNESMANN HANDWERKER - KARTUSCHENPISTOLE 2 22 100020278 BRÜDER MANNESMANN M10997 ZANGENSATZ 4-TLG. 1 Thanks a lot for your help! Best regards, Paul Edited January 6, 2014 by Paul2 Link to comment Share on other sites More sharing options...
Exit Posted January 6, 2014 Share Posted January 6, 2014 (edited) Change _ExcelBookOpen($Lieferschein) to $Lieferschein = _ExcelBookOpen($Lieferschein) Edited January 6, 2014 by Exit App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Paul2 Posted January 6, 2014 Author Share Posted January 6, 2014 Thanks a lot! Now it works. Link to comment Share on other sites More sharing options...
water Posted January 6, 2014 Share Posted January 6, 2014 Paul2, if performance is an issue you could try my rewrite of the Excel UDF. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Paul2 Posted January 7, 2014 Author Share Posted January 7, 2014 Thanks! Right now the Data is not to big so im okay with the performance. I will come back to this if the data gets bigger. Best regards 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