Jump to content

Recommended Posts

Posted (edited)

Hí!

I want to show in a MsgBox a value i get form a cell in Excel. I start AutoIt with the Excel cursor in this cell.

The code bellow do not work because the message box show a null valor:

Dim $answer = 0

ClipPut("")
WinActivate("[CLASS:XLMAIN]")
send("^c")
$answer = MsgBox(1,"",Clipget())

If i add a Sleep, it works, the MsgBox show the cell value:

Dim $answer = 0

ClipPut("")
WinActivate("[CLASS:XLMAIN]")
send("^c")
Sleep(30)
$answer = MsgBox(1,"",Clipget())

The "^c" command take some time to conclude, and in parallel the Autoit code continues running, causing severe problems on my script.

There is any way to copy values other than "Send("^c")" and then "Sleep(30)"? A way that stop the code until the value get copyed?

Thankyou!

Edited by Donnovan
Posted

Look up Excel Management in the AutoIt Help File. To get you started, you can use _ExcelBookOpen() or _ExcelBookAttach() then _ExcelReadCell(). Suggest you read up on it a bit before digging in!

Posted

Thanks a lot!

_IE... and _Excel... functions made a 1000% upgrade on my code!!!

Faster, No Syncronism errors, and i can work while the script runs!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...