How to loop X/Y Clicks - pull coordinates from text file?

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
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
Legalien
Posts: 66
Joined: Mon Feb 15, 2016 6:47 pm
Contact:

How to loop X/Y Clicks - pull coordinates from text file?

Post by Legalien » Fri Aug 09, 2019 12:33 pm

Windows 10
iMacros 8.9.7
Firefox 55.0.2

So I have a script and I want on each loop the actual X/Y coordinates to change, to be pulled from a text file.

Here is what I have:

Code: Select all

SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 20

SET !DATASOURCE C:\Users\USER\Documents\iMacros\Datasources\L4L1.txt

SET !DATASOURCE_COLUMNS 2
SET !DATASOURCE_LINE {{!LOOP}}

WAIT SECONDS=5
CLICK X={{!COL1}} Y={{!COL2}}
WAIT SECONDS=5
And in the text file I have lines:

100,200
200,300
300,400

The logic is that on 3 loops the script will do this:

CLICK X=100 Y=200
CLICK X=200 Y=300
CLICK X=300 Y=400

But it's not working.

I'm sure the solution is quite simple actually. How can I do it?

Thanks :)
Buy Social Media Services - https://Socialesale.com
Legalien
Posts: 66
Joined: Mon Feb 15, 2016 6:47 pm
Contact:

Re: How to loop X/Y Clicks - pull coordinates from text file?

Post by Legalien » Fri Aug 09, 2019 12:52 pm

So I am Googling for a solution while waiting for a reply here, and unfortunately I didn't find anything to allow me to make the example I gave above work.

However, I would be cool even with he least elegant solution to where I pull the entire line from a text file.

For example:

Code: Select all

SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 20

SET !DATASOURCE C:\Users\USER\Documents\iMacros\Datasources\L4L1.txt

SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}

WAIT SECONDS=5
USE={{!COL1}} --------> and this pulls the entire line I need and uses it to click (CLICK X=100 Y=200)
WAIT SECONDS=5
If you know what I mean...

How can I solve my problem? :)
Buy Social Media Services - https://Socialesale.com
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to loop X/Y Clicks - pull coordinates from text file?

Post by chivracq » Mon Aug 12, 2019 9:39 pm

Legalien wrote:
Fri Aug 09, 2019 12:33 pm

Code: Select all

Windows 10
iMacros 8.9.7
Firefox 55.0.2
So I have a script and I want on each loop the actual X/Y coordinates to change, to be pulled from a text file.

Here is what I have:

Code: Select all

SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 20

SET !DATASOURCE C:\Users\USER\Documents\iMacros\Datasources\L4L1.txt

SET !DATASOURCE_COLUMNS 2
SET !DATASOURCE_LINE {{!LOOP}}

WAIT SECONDS=5
CLICK X={{!COL1}} Y={{!COL2}}
WAIT SECONDS=5
And in the text file I have lines:

100,200
200,300
300,400

The logic is that on 3 loops the script will do this:

CLICK X=100 Y=200
CLICK X=200 Y=300
CLICK X=300 Y=400

But it's not working.

I'm sure the solution is quite simple actually. How can I do it?

Thanks :)
Legalien wrote:
Fri Aug 09, 2019 12:52 pm
So I am Googling for a solution while waiting for a reply here, and unfortunately I didn't find anything to allow me to make the example I gave above work.

However, I would be cool even with he least elegant solution to where I pull the entire line from a text file.

For example:

Code: Select all

SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 20

SET !DATASOURCE C:\Users\USER\Documents\iMacros\Datasources\L4L1.txt

SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}

WAIT SECONDS=5
USE={{!COL1}} --------> and this pulls the entire line I need and uses it to click (CLICK X=100 Y=200)
WAIT SECONDS=5
If you know what I mean...

How can I solve my problem? :)

Hum, what do you mean by "But it's not working."...?
What is happening...?

Check first with a

Code: Select all

PROMPT COL1:<SP>_{{!COL1}}_<BR>_COL2:<SP>_{{!COL2}}_
... that the correct Data gets retrieved from your DataSource, without any Space or soft Returns or TAB between the '_' Delimiters...

Disable '!ERRORIGNORE' to see if you get any RuntimeError...

If you get any RuntimeError for example that the 'X'/'Y' Coordinates/Parameters expect a "Number", you might want to use 'EVAL()' to first convert your '!COL[1-2]' to a Number as iMacros might first see it as a String...

Any "good" Reason(s) anyway why you want to use the 'CLICK' Mode...? :shock:
I consider this Mode to be pretty "unreliable" and it should always be your "last" Choice... (after the 'TAG' and 'EVENT' Modes), as it depends on the Size of your Screen, Screen Resolution, Browser Size, Width of the iMacros Side-Panel which must the same like when you had recorded your Script to record those Coordinates... (... where the 'SIZE' Command might help though...)

Some "Workaround" maybe if you still want to use the Coordinates for your Click could be to use the 'EVENT' Mode and to record "slowly" clicking that Spot/Element on your Page, which the 'EVENT' will record with a "fake" 'MOUSEMOVE' using the same Coordinates.

Same thing also with the 'MOUSEUP' Event Type, like...:

Code: Select all

EVENT TYPE=MOUSEUP POINT="({{!COL1}},{{!COL2}})"
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Legalien
Posts: 66
Joined: Mon Feb 15, 2016 6:47 pm
Contact:

Re: How to loop X/Y Clicks - pull coordinates from text file?

Post by Legalien » Tue Aug 13, 2019 12:15 am

Hey man,

Thanks for getting back to me.

I actually already solved my problem. Not exactly how I wanted, but the solution is perfectly working for me.

Found it here: viewtopic.php?f=11&t=26418

Thanks anyway, I appreciate the help :)
Buy Social Media Services - https://Socialesale.com
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to loop X/Y Clicks - pull coordinates from text file?

Post by chivracq » Tue Aug 13, 2019 12:34 am

Legalien wrote:
Tue Aug 13, 2019 12:15 am
Hey man,

Thanks for getting back to me.

I actually already solved my problem. Not exactly how I wanted, but the solution is perfectly working for me.

Found it here: viewtopic.php?f=11&t=26418

Thanks anyway, I appreciate the help :)

Ah..., OK, I had seen your Reply in that Thread but I didn't "really" make the "Connection" between the 2 Threads/Cases, and I took "for granted" that you were using "real Coordinates" that you first had recorded manually, and it would then be "nearly impossible" they would be/fall outside your Screen..., and [100-300]/[200-400] looked like a "plausible" Coordinates' Range to me and that they were unlikely to be the Cause of your Pb... :?

But I hope you saw my "Comment" about the 'CLICK' Mode... Only once in the 10 or 12 Years now I think I've been using iMacros, I had to use this Mode for one "tricky" Case... (and I was not very "proud" of myself, ah-ah...!) The 'TAG' + 'EVENT' Modes are both much more reliable in all Cases... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Legalien
Posts: 66
Joined: Mon Feb 15, 2016 6:47 pm
Contact:

Re: How to loop X/Y Clicks - pull coordinates from text file?

Post by Legalien » Thu Aug 22, 2019 6:57 am

Well, I'm botting a site and somehow if I use Tag or Event clicks they eventually ban me :(

But if I'm using X/Y clicks there's no problems.

That's how I ended up here basically.

But I wanted a way to click randomly on what I need, and so I thought I can call the clicks from a txt or csv file and do it like that. But then I found that thread that explained how to have the X/Y be random using VAR, and that did it for me.

That's all :)
Buy Social Media Services - https://Socialesale.com
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to loop X/Y Clicks - pull coordinates from text file?

Post by chivracq » Thu Aug 22, 2019 2:52 pm

Legalien wrote:
Thu Aug 22, 2019 6:57 am
Well, I'm botting a site and somehow if I use Tag or Event clicks they eventually ban me :(

But if I'm using X/Y clicks there's no problems.

That's how I ended up here basically.

But I wanted a way to click randomly on what I need, and so I thought I can call the clicks from a txt or csv file and do it like that. But then I found that thread that explained how to have the X/Y be random using VAR, and that did it for me.

That's all :)

Hum..., OK, that makes sense..., well, a bit...! But this is the first time sbd mentions using the 'CLICK' Mode to avoid Bot-Detection compared to the 'TAG' and 'EVENT' Modes... I would think Random/Conditional 'WAIT'/'PAUSE'/'ABORT'(*) would be more "reliable"..., and/or I suspect many of your 'CLICK' Statements are probably doing "nothing" on that Page/Site, and I've actually never seen any Site implementing such a "refined" Bot-Detection... :twisted:
(*) 'ABORT' is no iMacros Command, I use this Term to include the 'MacroError()'/'FAIL_IF_FOUND'/'RuntimeError'/'!ERRORIGNORE'/etc Functionality.

Any chance you could share the URL of this Site/Page...?, I would be interested to have a look if I can find and "analyze" how they implemented such Functionality/Detection...? (Well..., if it's not behind L&P...)
(If you don't want to post that URL "publicly" on the Forum, you can "report" any Post in this Thread, and I'll be the only one to see your "Report"...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Legalien
Posts: 66
Joined: Mon Feb 15, 2016 6:47 pm
Contact:

Re: How to loop X/Y Clicks - pull coordinates from text file?

Post by Legalien » Fri Sep 06, 2019 11:29 pm

Well, for quite some time I had issues with this site logging me out sometimes, and eventually banning me. One day I looked through their very unfamiliar code to me (using inspect element), and spotted some weird "antibot" type words, and connected to them exactly the type of code that iMacros uses when recording, both with regular and with event mode. So I made an uneducated guess and decision to try the X/Y mode and see what happens, and so far so good.

But I can't say 100% that this is what did it. I'm just shooting in the dark here.

That said, yes, many of my clicks were doing nothing on the site. So they would try to click, but there was nothing to click, you got that right. Also, this site does have some fairly decent bot-detection captchas. And also it has been botted (or tried to) with iMacros by many many people over the years, so maybe they literally put in place bot protection just to prevent iMacro clickers. But they didn't make it obvious, like 1 click straight ban. You can click and it's all good and it works and you'll have a good time, but it won't last too long, eventually you will get banned.

Anyway, I'll report your last post and put the URL if you wanna check it out. Yes it is behind a login page... I'll even give you logins to an account I don't use so you can login if you want to check it out.

Damn, I'm about to report your post, for sure you'll get banned :twisted: :mrgreen:
Buy Social Media Services - https://Socialesale.com
Post Reply