Jump to content

Recommended Posts

Posted

Hey all,

I'm trying to call each variable from an array individually to use in a loop, then perform some actions, and when the loop is complete call the next variable.

For example,

$Hello[0] = Apple
$Hello[1] = Banana
$Hello[2] = Pineapple
$Hello[3] = Pear
$Hello[4] = Mango
$Hello[5] = Orange

I now want to call on the array to do some functions which I assume I would you a For...To...Next statement, however, I'm not sure how to properly do it.

What I want to happen is for example to open notepad, Paste "Apple", then exit Notepad, Click on a button on a different application, then do the same loop for "Banana", then "Pineapple" and so on.

If anyone could help me with this I'd greatly appreciate it, I'm not sure what this function would be called so I couldn't find it anywhere else in the help section.

Posted

iNadez-,

A simple example...

local $hello[6]

$Hello[0] = 'Apple'
$Hello[1] = 'Banana'
$Hello[2] = 'Pineapple'
$Hello[3] = 'Pear'
$Hello[4] = 'Mango'
$Hello[5] = 'Orange'

for $i = 0 to ubound($Hello) - 1
    ;
    ; do something
    ;
    ConsoleWrite($Hello[$i] & @CRLF)
next

kylomas

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

Posted
46 minutes ago, kylomas said:

iNadez-,

A simple example...

local $hello[6]

$Hello[0] = 'Apple'
$Hello[1] = 'Banana'
$Hello[2] = 'Pineapple'
$Hello[3] = 'Pear'
$Hello[4] = 'Mango'
$Hello[5] = 'Orange'

for $i = 0 to ubound($Hello) - 1
    ;
    ; do something
    ;
    ConsoleWrite($Hello[$i] & @CRLF)
next

kylomas

How do i send the 'Apple' value? when i use the consoleWrite command it just sends "$Hello[$i]" to the console until the end of the array number

Posted (edited)

In the for loop, each "round" $i increments.  So, on the first round $i = 0 and thus $Hello[0] = "Apple".

Make sure $Hello[0] (or $Hello[$i]) is not wrapped in quotes.

Edited by spudw2k
Posted
Global $InstaFamous[15];
   $InstaFamous[0] = "https://www.instagram.com/christianguzmanfitness/?hl=en"
   $InstaFamous[1] = "https://www.instagram.com/stevecook/?hl=en"
   $InstaFamous[2] = "https://www.instagram.com/bradleymartyn/?hl=en"
   $InstaFamous[3] = "https://www.instagram.com/calumvonmoger/?hl=en"
   $InstaFamous[4] = "https://www.instagram.com/therock/?hl=en"
   $InstaFamous[5] = "https://www.instagram.com/loganpaul/?hl=en"
   $InstaFamous[6] = "https://www.instagram.com/buffbunny/?hl=en"
   $InstaFamous[7] = "https://www.instagram.com/jakepaul/?hl=en"
   $InstaFamous[8] = "https://www.instagram.com/nikkiblackketter/?hl=en"
   $InstaFamous[9] = "https://www.instagram.com/jenselter/?hl=en"
   $InstaFamous[10] = "https://www.instagram.com/1dayumay/?hl=en"
   $InstaFamous[11]= "https://www.instagram.com/whitneyysimmons/?hl=en"
   $InstaFamous[12] = "https://www.instagram.com/maxxchewning/?hl=en"
   $InstaFamous[13] = "https://www.instagram.com/omarisuf/?hl=en"
   $InstaFamous[14] = "https://www.instagram.com/silentmikke/?hl=en"

Okay so this is my code, I now want to take these values and input them into the google search bar. This is what I have:

Func Famous()
         for $i = 0 to ubound($InstaFamous) - 1
            MouseClick("left",1133, 63,1,500)
            Send("$InstaFamous[$i]"
            Send("{ENTER}")
         Next
      EndFunc

I'm just not sure how to paste that information I have called from the array into the google bar (PS: The mouseclick is the google URL bar

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...