Jump to content

Simple variables question


Duff360
 Share

Recommended Posts

Hello,

I would like to create a small script

I want something like this:

Local $a = "USA"
Local $b = "Canada"
Local $c  = "Japan"

WinActivate ("Microsoft Excel - Blablaxlsx")
MouseClick ("left", 525, 400, 2)
SEND($a)

WinActivate ("Microsoft Excel - Blablaxlsx")
MouseClick ("left", 525, 420, 2)
SEND($b)

WinActivate ("Microsoft Excel - Blablaxlsx")
MouseClick ("left", 525, 440, 2)
SEND($c)

I already created something for the MouseClick but I'm not able with the text to insert.

Thank you!

Link to comment
Share on other sites

To do it your way, without the UDF, would have required a double click I think, which you are doing, but clearly something is not right.

Is an insert cursor showing up at that point?

If so, then you may also need to follow up with sending an ENTER.

Using the UDF though, is a much better way to do it all.

 

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Duff360,

Directly from the Help file using your values...

#include <Array.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>

; Create application object and create a new workbook
Local $oExcel = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $oWorkbook = _Excel_BookNew($oExcel)
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

; *****************************************************************************
; Write a 1D array to the active sheet in the active workbook
; *****************************************************************************
Local $aArray1D[3] = ["USA", "Canada", "Japan"]
_Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aArray1D, "D3")
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "1D array successfully written.")

kylomas

edit:  If you want to change an existing workbook then change the _Excel_BookNew UDF to _Excel_BookOpen.  You can also navigate between sheets.  It's all in the Help file...

Edited by kylomas
additional info

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
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
 Share

  • Recently Browsing   0 members

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