Sign in to follow this  
Followers 0
bouncyball89

Including Excel in my script

4 posts in this topic

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 = 0

Do

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 ;;; #ce

Send("{TAB}")

Send("^v") ;;; #cs pastes # in customer box ;;; #ce

Send("{TAB}")

Send("!c") ;;; #cs calls invoice search/accounts receivable invoice screen ;;; #ce

WinWaitActive("Accounts Receivable Invoices")

MouseClick("left",60,120, 2) ;;; #cs selects first line in invoice ;;; #ce

WinClose("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 ;;; #ce

MouseClick("left", 52, 409, 1) ;;; #cs selects the save button ;;; #ce

WinWaitActive("Invoice Entry")

MouseClick("left", 285, 68, 1) ;;; #cs selects the "apply credit memo" button ;;; #ce

WinWaitActive("Apply Credit Memo")

If MouseClick("left",387, 87, 1) = "" Then

Send("!C")

Else

MouseClick("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 ;;; #ce

WinWaitActive("Apply Credit Memo")

If MouseClick("left",387, 105, 1) = "" Then

Send("!C")

Else

MouseClick("left", 52, 409, 1) ;;; #cs selects the save button ;;; #ce

EndIf

WinWaitActive("Invoice Entry")

MouseClick("left", 47, 68, 1)

$i = $i + 1

Until $i = 200

If $i = 200 then

Endif

Wend

I am very new to this program so please mind my ignorance. Any help would be greatly appreciated.

Thank You,

Ramona

Share this post


Link to post
Share on other sites



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Welcome to AutoIt and the forum!

Isn't your post a bit late? bouncyball89 left the forum 1 1/2 years ago.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0