Jump to content
Sign in to follow this  
elmer92413

Basic Array Question

Recommended Posts

elmer92413

I have some real basic code that is dependent on my arrays...

WinWaitActive("Microsoft Excel - Voice Mailboxes.xls")
Sleep(2000)
Global $array
Do
    Send("^C")
    $clipboard = ClipGet()
    $array = StringSplit($clipboard, ",")
    ClipPut(""& $array[2]" "& $array[1])
    Send("^V")
    Send("{DOWN}")
Until $clipboard = ""

I get the following message...

Error Message

All I want to do is take a field which has a name...

Last, First...

And I want to flip them around...

Then move down to the next cell and repeat until it reaches an empty cell...

Share this post


Link to post
Share on other sites
SlimShady

This should help you.

Edit:

Check line 9. I changed it because it was going to throw an error.

WinWaitActive("Microsoft Excel - Voice Mailboxes.xls")
Sleep(2000)
Global $array
While 1
    Send("^C")
    $clipboard = ClipGet()
    If $clipboard <> "" AND StringInStr($clipboard, ",") Then
        $array = StringSplit($clipboard, ",")
        ClipPut($array[2] & " " & $array[1])
        Send("^V")
        Send("{DOWN}")
    Else
        ExitLoop
    EndIf
WEnd
Edited by SlimShady

Share this post


Link to post
Share on other sites
pcdestroyer

Dim [Const] $variable
Dim $array[subscript 1]...[subscript n]


 

Parameters

const [optional] If present, the Const keyword creates a constant rather than a variable. 
$variable The name of the variable to declare. 
subscript The number of elements to create for the array dimension, indexed 0 to n-1. 

 

Remarks

The Dim/Local/Global keywords perform a similar function.
1. Declare a variable before you use it (similar to VBScript)
2. Create an array

; Example 2 - Declaring arrays
Dim $weeklyWorkSchedule[$daysWorking]
Global $chessBoard[8][8]
Local $mouseCoordinates[2], $windowStats[4]

Global $array[2]

Edit: i think u have to use $array[0] and $array[1] ... not 1 and 2

Edited by pcdestroyer

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.