bouncyball89 Posted April 6, 2012 Posted April 6, 2012 Hello All,I have a very simple script that isn't working correctly and I was hoping that this forum could take a look at my script and tell me what I did wrong. Basically, I have a an Excel 2007 spreadsheet that has 100+ acct numbers in the first column. My script activates the excel doc, moves down one row, copies that cell and pastes it into an ERP. Everything works fine within the ERP part of the script, but at the end it starts a new ERP invoice and it is suppose to activate the excel doc, move down a row, and copy that cell. It works the first time but after that it will either not activate the excel doc, not move down one, or move down one but not copy the new cell.Opt("MouseCoordMode", 0)While 1 = 1$i = 0Do WinSetState("Microsoft Excel", "", @SW_RESTORE)WinActivate("Microsoft Excel")WinWaitActive("Microsoft Excel")Send("{down}")WinWaitActive("Microsoft Excel")Send("^c") ;;; #cs copy cell from excel ;;; #ce WinSetState("Invoice Entry", "", @SW_RESTORE)WinActivate("Invoice Entry")WinWaitActive("Invoice Entry")MouseClick("left", 150, 100, 2 , 25 ) ;;;#cs selects invoice box ;;; #ceSend("{TAB}")Send("^v") ;;; #cs pastes # in customer box ;;; #ceSend("{TAB}")Send("!c") ;;; #cs calls invoice search/accounts receivable invoice screen ;;; #ceWinWaitActive("Accounts Receivable Invoices")MouseClick("left",60,120, 2) ;;; #cs selects first line in invoice ;;; #ceWinClose("Accounts Receivable Invoices")WinWaitActive("Invoice Entry")WinWaitActive("Invoice Entry")MouseClick("left", 285, 68, 1) ;;; #cs selects the "apply credit memo" button ;;; #ce WinWaitActive("Apply Credit Memo", "", 5) MouseClick("left", 387, 69, 1) ;;; #cs selects the "Amount Applied" cell in the first line of data ;;; #ceMouseClick("left", 52, 409, 1) ;;; #cs selects the save button ;;; #ceWinWaitActive("Invoice Entry")MouseClick("left", 285, 68, 1) ;;; #cs selects the "apply credit memo" button ;;; #ceWinWaitActive("Apply Credit Memo")If MouseClick("left",387, 87, 1) = "" ThenSend("!C") ElseMouseClick("left", 52, 409, 1) ;;; #cs selects the save button ;;; #ce EndIf WinWaitActive("Invoice Entry")MouseClick("left", 285, 68, 1) ;;; #cs selects the "apply credit memo" button ;;; #ceWinWaitActive("Apply Credit Memo")If MouseClick("left",387, 105, 1) = "" ThenSend("!C") ElseMouseClick("left", 52, 409, 1) ;;; #cs selects the save button ;;; #ce EndIf WinWaitActive("Invoice Entry") MouseClick("left", 47, 68, 1) $i = $i + 1Until $i = 200If $i = 200 thenEndifWendI am very new to this program so please mind my ignorance. Any help would be greatly appreciated.Thank You,Ramona
water Posted April 6, 2012 Posted April 6, 2012 Don't do it the way you do it right now if you want a reliable and dummy proof solution AutoIt comes with an Excel UDF (User Defined Functions) which lets you easily and reliably automate Excel. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
makhi Posted August 24, 2013 Posted August 24, 2013 This code is just out of my mind. You can easily make an general excel invoice template here at http://www.fetchflow.com/support/question/Generate-invoices-using-Excel.html without any codes, hiring a developer and can use anywhere you want.
water Posted August 24, 2013 Posted August 24, 2013 (edited) Welcome to AutoIt and the forum!Isn't your post a bit late? bouncyball89 left the forum 1 1/2 years ago. Edited August 24, 2013 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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