Need a simple loop for google maps

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
vapiano
Posts: 4
Joined: Sun Nov 01, 2020 6:14 pm

Need a simple loop for google maps

Post by vapiano » Sun Nov 01, 2020 6:45 pm

I would like to create a macro doing following steps:

1.Go to google maps
2.Search for (variable)
3.Press three times the Next button
4.Search for (another variable)
5.Press three times the Next button
6.Search for (another variable) etc...

Macro should loop the words from a list and type them into the searchbox from google maps.

All I have by now is the following code but I do not know how to make a loop and how to create a list with variable. It would be great if somebody could help.

Code: Select all

URL GOTO=https://www.google.com/maps/@51.1758057,10.4541194,6z
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:searchbox_form ATTR=ID:searchboxinput CONTENT=lieferando<SP>22117
TAG POS=1 TYPE=BUTTON ATTR=ID:searchbox-searchbutton
WAIT SECONDS=5
TAG POS=1 TYPE=SPAN ATTR=CLASS:n7lv7yjyC35__button-next-icon
WAIT SECONDS=2.5
TAG POS=1 TYPE=SPAN ATTR=CLASS:n7lv7yjyC35__button-next-icon
WAIT SECONDS=2.5
TAG POS=1 TYPE=SPAN ATTR=CLASS:n7lv7yjyC35__button-next-icon
Windows 10
iMacros for Chrome 10.1.0 free version
Google Chrome Version 86.0.4240.111
Last edited by vapiano on Sun Nov 01, 2020 7:12 pm, edited 1 time in total.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Need a simple loop for google maps

Post by chivracq » Sun Nov 01, 2020 7:11 pm

vapiano wrote:
Sun Nov 01, 2020 6:45 pm
I would like to create a macro doing following steps:

1.Go to google maps
2.Search for (variable)
3.Press three times the Next button
4.Search for (another variable)
5.Press three times the Next button
6.Search for (another variable) etc...

Macro should loop the words from a list and type them into the searchbox from google maps.

All I have by now is the following code but I do not know how to make a loop and how to create a list with variable. It would be great if somebody could help.

Code: Select all

URL GOTO=https://www.google.com/maps/@51.1758057,10.4541194,6z
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:searchbox_form ATTR=ID:searchboxinput CONTENT=lieferando<SP>22117
TAG POS=1 TYPE=BUTTON ATTR=ID:searchbox-searchbutton
WAIT SECONDS=5
TAG POS=1 TYPE=SPAN ATTR=CLASS:n7lv7yjyC35__button-next-icon
WAIT SECONDS=2.5
TAG POS=1 TYPE=SPAN ATTR=CLASS:n7lv7yjyC35__button-next-icon
WAIT SECONDS=2.5
TAG POS=1 TYPE=SPAN ATTR=CLASS:n7lv7yjyC35__button-next-icon

Code: Select all

Windows 10
iMacros for Chrome 10.1.0
Google Chrome Version 86.0.4240.111
'Free'/'PE' is missing from your FCI...?
(You'll need the 'PE' Version if you want to use a local '.csv' File as 'DataSource' for your "list with variable[s]"...)

But yep, same Answer / same Principle like in this Thread from 1 or 2 weeks ago... :idea:
- (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...
vapiano
Posts: 4
Joined: Sun Nov 01, 2020 6:14 pm

Re: Need a simple loop for google maps

Post by vapiano » Sun Nov 01, 2020 7:20 pm

'Free'/'PE' is missing from your FCI...?
You'll need the 'PE' Version if you want to use a local '.csv' File as 'DataSource' for your "list with variable[s]"...)

It is the free version. Isn't it possible to create a list in iMacros itself, e.g. list = {a,b,c,d...}?
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Need a simple loop for google maps

Post by chivracq » Sun Nov 01, 2020 7:27 pm

vapiano wrote:
Sun Nov 01, 2020 7:20 pm
'Free'/'PE' is missing from your FCI...?
You'll need the 'PE' Version if you want to use a local '.csv' File as 'DataSource' for your "list with variable[s]"...)

It is the free version. Isn't it possible to create a list in iMacros itself, e.g. list = {a,b,c,d...}?

Yep, that's possible, as an Array or a String, but iMacros has a "tendency" to treat all Vars as Strings, so it will be "easier" to declare some Var as:

Code: Select all

SET !VAR1 "a,b,c,d,..."
... and to re-split every single Value with 'EVAL()' + 'split()' on the Comma... :idea:
- (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...
vapiano
Posts: 4
Joined: Sun Nov 01, 2020 6:14 pm

Re: Need a simple loop for google maps

Post by vapiano » Sun Nov 01, 2020 7:50 pm

Yep, that's possible, as an Array or a String, but iMacros has a "tendency" to treat all Vars as Strings, so it will be "easier" to declare some Var as:

Code: Select all

SET !VAR1 "a,b,c,d,..."
... and to re-split every single Value with 'EVAL()' + 'split()' on the Comma... :idea:
Ok, got it. But how do I use the Loop function?
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Need a simple loop for google maps

Post by chivracq » Sun Nov 01, 2020 8:02 pm

vapiano wrote:
Sun Nov 01, 2020 7:50 pm
Yep, that's possible, as an Array or a String, but iMacros has a "tendency" to treat all Vars as Strings, so it will be "easier" to declare some Var as:

Code: Select all

SET !VAR1 "a,b,c,d,..."
... and to re-split every single Value with 'EVAL()' + 'split()' on the Comma... :idea:
Ok, got it. But how do I use the Loop function?

... for the Index on 'split()'... :idea:

>>>

But hum..., you just got a '-1' from me on your parallel Thread on SOF for not mentioning your FCI there while you correctly included it on our Forum in your OP, oops...! :(

Perfectly fine to open parallel Threads on different Tech Forums, but you need to provide the same Quality on all of them... :idea:
=> Update your Thread to also include that Info on SOF for me to follow up... :|
- (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...
vapiano
Posts: 4
Joined: Sun Nov 01, 2020 6:14 pm

Re: Need a simple loop for google maps

Post by vapiano » Sun Nov 01, 2020 8:45 pm

Perfectly fine to open parallel Threads on different Tech Forums, but you need to provide the same Quality on all of them... :idea:
=> Update your Thread to also include that Info on SOF for me to follow up... :|
I have deleted the other thread now
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Need a simple loop for google maps

Post by chivracq » Sun Nov 01, 2020 9:02 pm

vapiano wrote:
Sun Nov 01, 2020 8:45 pm
Perfectly fine to open parallel Threads on different Tech Forums, but you need to provide the same Quality on all of them... :idea:
=> Update your Thread to also include that Info on SOF for me to follow up... :|
I have deleted the other thread now

Oh...!? :shock: , hum, OK, that's "definitely not" what I understand about "providing the same Quality on different Tech Forums", ah-ah...! :P
Then, OK, fair enough, but I'm "out of here" now, deleting their Thread is a kind of a "Show-Killer" for me to help Users...
(Main Reason I more or less systematically quote on our Forum, to prevent Users from deleting/mutilating their Thread/Posts once they've got their Solution and Script working, to avoid sharing it with "the Competition"...)

"Good luck" further with other (Advanced) Users if you still need some Help..., and/or share your Final Script / your Solution once you've managed to implement the Functionality that you want... (Another "Show-Stopper" for me otherwise to help Users (again) if they don't share their Solution... :idea: )
- (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...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Need a simple loop for google maps

Post by chivracq » Mon Nov 02, 2020 10:19 pm

+ For those "interested", some 2nd parallel Thread on SOF (not deleted yet...):
- Loop through string in iMacros
(Nice to see that FCI is now included in this Thread on SOF... :D )

=> With one Comment/Answer which is exactly like I already told @OP a few Posts above...:
Split the string into an array and then iterate the array ? – stud3nt 4 hours ago
- (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...
DanielPe
Posts: 3
Joined: Mon Nov 16, 2020 4:02 pm

Re: Need a simple loop for google maps

Post by DanielPe » Mon Nov 16, 2020 4:20 pm

Maybe you can use

Code: Select all

var map;
    var InforObj = [];
    var centerCords = {
        lat: 52.7991657, 
        lng: -0.6153754
    };

    var locations = <?php print_r(json_encode($locations)) ?>;
    var markersOnMap = 
    [{
            // Confirm Location For Pin Is Working
            placeName: "Random Test Location",
            LatLng: 
            [{
                lat: 51.7045719, 
                lng: -0.5266157
            }]
        },
        
    ];
All is posiblle if you can to believe!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Need a simple loop for google maps

Post by chivracq » Tue Nov 17, 2020 1:32 am

DanielPe wrote:
Mon Nov 16, 2020 4:20 pm
Maybe you can use

Code: Select all

var map;
    var InforObj = [];
    var centerCords = {
        lat: 52.7991657, 
        lng: -0.6153754
    };

    var locations = <?php print_r(json_encode($locations)) ?>;
    var markersOnMap = 
    [{
            // Confirm Location For Pin Is Working
            placeName: "Random Test Location",
            LatLng: 
            [{
                lat: 51.7045719, 
                lng: -0.5266157
            }]
        },
        
    ];

Quick Quote, I'm "not sure" the Post is really relevant, User feels "a bit fake" and their Account and all their Posts might get deleted in one week... :?
- (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