Array url

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
User avatar
stevebilly
Posts: 4
Joined: Sun Aug 03, 2014 5:19 pm

Array url

Post by stevebilly » Wed Oct 15, 2014 6:35 am

What I am trying to do is loop through a url and each time pull content from an array into the url. This is to help with a tedious game task. I am a scripting novice and have only done simple edits to my own iMacro recordings thus far. I've been trying to research and I just can't find anything that helps me so I am reaching out here in the forums.

Code: Select all

http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=XXXXXXXXXX&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=XXXXXXXXXX&pvp%5Battack_value%5D=932&pvp%5Bdefense_value%5D=%3F%3F%3F 
From what I've found so far I need 2 arrays, one to pull Sword ID's from and one to add a random region from 3 choices. Any help would be great.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Array url

Post by chivracq » Wed Oct 15, 2014 12:14 pm

stevebilly wrote:What I am trying to do is loop through a url and each time pull content from an array into the url. This is to help with a tedious game task. I am a scripting novice and have only done simple edits to my own iMacro recordings thus far. I've been trying to research and I just can't find anything that helps me so I am reaching out here in the forums.

Code: Select all

http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=XXXXXXXXXX&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=XXXXXXXXXX&pvp%5Battack_value%5D=932&pvp%5Bdefense_value%5D=%3F%3F%3F 
From what I've found so far I need 2 arrays, one to pull Sword ID's from and one to add a random region from 3 choices. Any help would be great.
CIM...! :mrgreen:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
User avatar
garyst1981
Posts: 125
Joined: Tue Jan 15, 2013 1:01 am
Location: Philadelphia, PA
Contact:

Re: Array url

Post by garyst1981 » Wed Oct 15, 2014 12:45 pm

you can put the "array" in a CSV file and take the info from there.

You will need to do

Code: Select all

SET !DATASOURCE nameofyourfile.csv
SET !LOOP 1 
SET !DATASOURCE_LINE {{!LOOP}}
That will go thru your file getting the data... To use the data you would need to do the following:

Code: Select all

http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=XXXXXXXXXX&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=XXXXXXXXXX&pvp%5Battack_value%5D=932&pvp%5Bdefense_value%5D=%3F%3F%3F{{!COL1}}
Where its going to populate the {{!COL1}} with the value of the current row of the first column of the CSV
www.gustavorivera.com.mx
User avatar
stevebilly
Posts: 4
Joined: Sun Aug 03, 2014 5:19 pm

Re: Array url

Post by stevebilly » Wed Oct 15, 2014 9:38 pm

garyst1981 wrote:you can put the "array" in a CSV file and take the info from there.

You will need to do


Where its going to populate the {{!COL1}} with the value of the current row of the first column of the CSV
Thank you Gary I will look into this :) I am sorry for not posting CIM I am new to this forum and will do this next time
I'm using iMacros for Chrome windows 8.1
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Array url

Post by chivracq » Thu Oct 16, 2014 1:13 am

stevebilly wrote:
garyst1981 wrote:you can put the "array" in a CSV file and take the info from there.

You will need to do

Where its going to populate the {{!COL1}} with the value of the current row of the first column of the CSV
Thank you Gary I will look into this :)
I am sorry for not posting CIM I am new to this forum and will do this next time
I'm using iMacros for Chrome windows 8.1
"I'm using iMacros for Chrome windows 8.1" => iMacros for CR v8.07, CR35, Win8.1, I reckon...

Gary's Post gives you a Solution for your !VAR1 Question if !VAR1's Values belong to a fixed List. Depending on what Format you expect for !VAR1 (if they can be computed by some simple Incrementation), you might be able to avoid using a .CSV as a Datasource (which would be more performant...), as your Random [1-3] !VAR2 Part can be handled from the same .CSV File (several Solutions) or directly from within your .iim Macro.

Mention the Format / Expected Values (+ Range) for !VAR1 for more specific Help from me...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
User avatar
stevebilly
Posts: 4
Joined: Sun Aug 03, 2014 5:19 pm

Re: Array url

Post by stevebilly » Thu Oct 16, 2014 3:16 am

VERSION BUILD=8070701 RECORDER=CR Chrome window 8.1 I'm not sure what CR35 is but if you tell me where to find this info I'll look it up

Code: Select all

SET !ERRORIGNORE YES
PROMPT "Please enter your target ID:" !VAR1
PROMPT "Please enter your action type:" !VAR2


URL GOTO=http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=348952576&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=cape_wrath&pvp%5Battack_value%5D=932&pvp%5Bdefense_value%5D=%3F%3F%3F
URL GOTO=http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=348952679&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=summerhall&pvp%5Battack_value%5D=908&pvp%5Bdefense_value%5D=%3F%3F%3F
URL GOTO=http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=345742917&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=summerhall&pvp%5Battack_value%5D=908&pvp%5Bdefense_value%5D=%3F%3F%3F
URL GOTO=http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=345743031&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=summerhall&pvp%5Battack_value%5D=908&pvp%5Bdefense_value%5D=%3F%3F%3F
URL GOTO=http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=345743164&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=summerhall&pvp%5Battack_value%5D=908&pvp%5Bdefense_value%5D=%3F%3F%3F
URL GOTO=http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=345743450&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=summerhall&pvp%5Battack_value%5D=908&pvp%5Bdefense_value%5D=%3F%3F%3F
URL GOTO=http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D={{!VAR1}}&pvp%5Bsworn_sword_id%5D=345939384&pvp%5Bpvp_action_symbol%5D={{!VAR2}}&pvp%5Bsub_region_symbol%5D=summerhall&pvp%5Battack_value%5D=908&pvp%5Bdefense_value%5D=%3F%3F%3F

This is what I've been using and it works alright but I know could be made so much better. What I want to try is to shorten it up my thought is I could store the sworn_sword ID#'s somewhere/somehow and call them as the script plays. I also would like to figure out a way to pull a random sub_region from 3 choices summerhall, marches, cape_wrath. My thought is that I could shorten this macro considerably if I can do this. Possibly have the url play on a loop calling each element each time but I'm just not sure if this is possible. I am hoping that my finished product will have a random wait time between each link between 4 and 7 seconds.
User avatar
stevebilly
Posts: 4
Joined: Sun Aug 03, 2014 5:19 pm

Re: Array url

Post by stevebilly » Thu Oct 16, 2014 8:04 am

VERSION BUILD=8070701 RECORDER=CR Chrome38.0.2125.104 m window 8.1

I tried the csv suggestion but I must be doing something wrong as when the script plays the columns are not retrieved.

Code: Select all

SET !DATASOURCE swords.csv
SET !DATASOURCE_COLUMNS 2
SET !DATASOURCE_LINE {{!LOOP}}



URL GOTO=http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D=10748601&pvp%5Bsworn_sword_id%5D={{COL1}}&pvp%5Bpvp_action_symbol%5D=barter&pvp%5Bsub_region_symbol%5D={{COL2}}&pvp%5Battack_value%5D=932&pvp%5Bdefense_value%5D=%3F%3F%3F
my csv file

Code: Select all

348952576, cape_wrath
348952679, summerhall
345742917, marches
345743031
345743164
345743450
345939384
348359881
348359956
348360019
348360097
348360174
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Array url

Post by chivracq » Thu Oct 16, 2014 2:50 pm

stevebilly wrote:VERSION BUILD=8070701 RECORDER=CR Chrome38.0.2125.104 m window 8.1

I tried the csv suggestion but I must be doing something wrong as when the script plays the columns are not retrieved.

Code: Select all

SET !DATASOURCE swords.csv
SET !DATASOURCE_COLUMNS 2
SET !DATASOURCE_LINE {{!LOOP}}

URL GOTO=http://gota.disruptorbeam.com/pvps/create?pvp%5Btarget_id%5D=10748601&pvp%5Bsworn_sword_id%5D={{COL1}}&pvp%5Bpvp_action_symbol%5D=barter&pvp%5Bsub_region_symbol%5D={{COL2}}&pvp%5Battack_value%5D=932&pvp%5Bdefense_value%5D=%3F%3F%3F
my csv file

Code: Select all

348952576, cape_wrath
348952679, summerhall
345742917, marches
345743031
345743164
345743450
345939384
348359881
348359956
348360019
348360097
348360174
"CR35" means Chrome v35...

Yep, your "stg wrong" is that you use "{{COLn}}" instead of "{{!COLn}}"... Built-in Variables start with a "!"...

So Col1 is based on '!LOOP and for your Random Col2 Part, you compute a [1-3] Number to apply to '!DATASOURCE_LINE' before retrieving {{!COL2}}.

For your Random WAIT, you have many-many Examples on the Forum and even in the Wiki...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply