Sign in to follow this  
Followers 0
elmer92413

Basic Array Question

3 posts in this topic

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



#2 ·  Posted (edited)

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

#3 ·  Posted (edited)

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