iNadeZ- Posted July 6, 2017 Share Posted July 6, 2017 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. Link to comment Share on other sites More sharing options...
kylomas Posted July 6, 2017 Share Posted July 6, 2017 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 Link to comment Share on other sites More sharing options...
iNadeZ- Posted July 6, 2017 Author Share Posted July 6, 2017 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 Link to comment Share on other sites More sharing options...
iNadeZ- Posted July 6, 2017 Author Share Posted July 6, 2017 All I need to do is paste the value corresponding to each variable in the array to notepad Link to comment Share on other sites More sharing options...
spudw2k Posted July 6, 2017 Share Posted July 6, 2017 (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 July 6, 2017 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
iNadeZ- Posted July 6, 2017 Author Share Posted July 6, 2017 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 Link to comment Share on other sites More sharing options...
iNadeZ- Posted July 6, 2017 Author Share Posted July 6, 2017 Ahh when I took it out of quotations it worked, I amended the code to: Func Famous() for $i = 0 to ubound($InstaFamous) - 1 MouseClick("left",1133, 63,1,500) Send($InstaFamous[$i]) Send("{ENTER}") Next EndFunc It now works, thank you so much guys ! Link to comment Share on other sites More sharing options...
jdelaney Posted July 7, 2017 Share Posted July 7, 2017 (edited) Are you using IE? There are _IE functions that will reliably set a dom object with a specific value...send is very unreliable Edited July 7, 2017 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
iNadeZ- Posted July 7, 2017 Author Share Posted July 7, 2017 @jdelaney I'm using google chrome unfortunately Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now