[MACRO REQUEST] Loop and dynamic ID form compiler

Find a consultant or advertise your services here
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
User avatar
cybmatrix
Posts: 38
Joined: Tue Dec 08, 2009 8:33 pm

[MACRO REQUEST] Loop and dynamic ID form compiler

Post by cybmatrix » Mon Sep 02, 2019 2:59 pm

Windows 7 PRO (64 bit)
Waterfox 51.0.1 (64 bit)
iMacros for FF 8.9.7

-----------

Hi there.
I need a macro like explained in this topic: viewtopic.php?f=2&t=30497

How much will cost ?
Thanks.

Write me at \\ andream@dontouch.ch
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by Tom, Tech Support » Tue Sep 03, 2019 8:04 am

Hi cybmatrix,
cybmatrix wrote:
Wed Aug 28, 2019 2:51 pm
Hello.
I'm trying to automate some messages on this website ( you have to register to use it ): https://www.quoka.de/partnerschaften-ko ... nehmungen/

28-08-2019 15-40-46.jpg

After clicking on "CONTACT USER", a floating modal form open:

28-08-2019 16-24-20.jpg

The problem is that every form have a dynamic ID, and seems very complicated to identify each one on page refresh.
I've tried with relative positioning after clicking on the form TITLE, but sometimes works, sometimes not.

Code: Select all

TAG POS=1 TYPE=H4 ATTR=TXT:Kontaktieren
TAG POS=R2 TYPE=TEXTAREA FORM=NAME:MailForm ATTR=CLASS:*qx_form* CONTENT=MESSAGE
TAG POS=R3 TYPE=INPUT:TEXT FORM=NAME:MailForm ATTR=CLASS:*qx_form* CONTENT=NAME
HTML code extracted from the form is:
<textarea name="d27c24cfcee6f7a903493b06461ab4df" id="d27c24cfcee6f7a903493b06461ab4df" placeholder="Deine Nachricht" rows="5" class="qx_form__textarea qx_contact-form__textarea c-920fd75ddc014107b4496d8b28c1189f" cols="80" wrap="virtual"></textarea>
This is the one for the NAME field:
<input name="f59e9b8df721b5ea5b273cc7620f984a" id="f59e9b8df721b5ea5b273cc7620f984a" value="" class="qx_form__input qx_contact-form__input c-8e5f605b4cd88fb0219f9e560862671f qx_form__input_first" placeholder="Dein Name" style="border-top-right-radius: 3px ! important; border-top-left-radius: 3px ! important;" type="text">

Is there a simple solution maybe using "placeholders" or a well calibrated relative positioning ?
Thanks.

-----------

Windows 7 PRO (64 bit)
Waterfox 51.0.1 (64 bit)
iMacros for FF 8.9.7

It appears to me that you could use the "placeholder" attribute to uniquely identify the elements on this form. Have you already tried this?

Code: Select all

TAG POS=1 TYPE=TEXTAREA FORM=NAME:MailForm ATTR=PLACEHOLDER:"Deine Nachricht" CONTENT=MESSAGE
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:MailForm ATTR=PLACEHOLDER:"Dein Name" CONTENT=NAME
Regards,

Tom, iMacros Support
User avatar
cybmatrix
Posts: 38
Joined: Tue Dec 08, 2009 8:33 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by cybmatrix » Tue Sep 03, 2019 12:38 pm

Thanks TOM !
But with this ATTR forms are completely ignored by imacros ... :|
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by Tom, Tech Support » Tue Sep 03, 2019 1:20 pm

What do you mean by "completely ignored by imacros"? Do the suggested commands given in my last reply result in any error message?
Regards,

Tom, iMacros Support
User avatar
cybmatrix
Posts: 38
Joined: Tue Dec 08, 2009 8:33 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by cybmatrix » Tue Sep 03, 2019 3:18 pm

That the floating forms are not correctly filled.
03-09-2019 17-17-12.jpg
Tom, Tech Support wrote:
Tue Sep 03, 2019 1:20 pm
What do you mean by "completely ignored by imacros"? Do the suggested commands given in my last reply result in any error message?
User avatar
cybmatrix
Posts: 38
Joined: Tue Dec 08, 2009 8:33 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by cybmatrix » Thu Sep 05, 2019 12:54 pm

Any alternetive solution ?
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by Tom, Tech Support » Thu Sep 05, 2019 1:26 pm

Try recording these fields with the EVENT recording mode. To enable this mode, click the "Record options" button on the Rec tab of the iMacros sidebar and select "Experimental event recording mode".
Regards,

Tom, iMacros Support
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by chivracq » Thu Sep 05, 2019 3:02 pm

Tom, Tech Support wrote:
Thu Sep 05, 2019 1:26 pm
Try recording these fields with the EVENT recording mode. To enable this mode, click the "Record options" button on the Rec tab of the iMacros sidebar and select "Experimental event recording mode".

I already gave all those Suggs (about the 'placehorlder' Attribute and the 'EVENT' Mode) (and a few other ones also...) in my first Reply in @OP's original Thread, in my "a few mini-Hints" Section... :wink:
- (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
cybmatrix
Posts: 38
Joined: Tue Dec 08, 2009 8:33 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by cybmatrix » Thu Sep 05, 2019 4:18 pm

Already tested, but nothing happened.

Tom, Tech Support wrote:
Thu Sep 05, 2019 1:26 pm
Try recording these fields with the EVENT recording mode. To enable this mode, click the "Record options" button on the Rec tab of the iMacros sidebar and select "Experimental event recording mode".
Windows 7 PRO (64 bit)
Waterfox 51.0.1 (64 bit)
iMacros for FF 8.9.7
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by chivracq » Fri Sep 06, 2019 8:27 am

cybmatrix wrote:
Thu Sep 05, 2019 4:18 pm
Already tested, but nothing happened.

Tom, Tech Support wrote:
Thu Sep 05, 2019 1:26 pm
Try recording these fields with the EVENT recording mode. To enable this mode, click the "Record options" button on the Rec tab of the iMacros sidebar and select "Experimental event recording mode".

"nothing happened." is a bit of a vague Statement, and that Feedback could have already been posted in your original Thread when I had mentioned the 'EVENT' Mode... :?

OK, not sure what "nothing happened." really means, but if you mean "noting recorded" (using the 'EVENT' Mode), + "nothing replaid", no-no-no!!, I don't believe it...!!, the 'TAG' Mode was working you said in your Org Thread, I've never seen a Site where the 'TAG' Mode works and the 'EVENT' Mode does nothing... :?
=> Provide a Test Account for your Site, and I would be very interested to have a Look at such a Site...! And @Tom from TechSup as well, I guess...

You can "report" any Post in this Thread, and @Tom and myself are the only ones who can see your "Report" in which you can mention some Login and Password (+ Login URL if needed) if you want us / any of us to do some Testing... 8)
(Even if for myself, I won't give you "the" Solution to your original Thread, as I don't "support" that Use of iMacros like I've already mentioned, and I don't help for such "Functionality", but hum, you got me "curious" about this Site... :wink: )
=> You can say in your "Report" if only @Tom is "allowed" to have a look at the Site, no Pb, I'll respect of course...
[And/but I'm still pretty confident I will/would find at least 10 different Solutions to what you want, ah-ah... (And I'm not sure @Tom will find the ones related to 'R-POS' with the 'EVENT' Mode, ah-ah...!, well..., depending a bit on the "nothing happened.", of course... (then I won't find them either, if the 'EVENT' Mode "really" doesn't record anything, ah-ah...!) :wink: )]

But, pfff...! AGAIN...!, if 'R-POS' (+ 'TAG' Mode) was "sometimes"/"nearly" working from your Org Thread, that means it works and that you were very close...! :idea:
Either you were not using the "right" 'Anchor', or you didn't try applying "the few other Techniques related/combined to 'R-POS'"... :twisted:
- (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
cybmatrix
Posts: 38
Joined: Tue Dec 08, 2009 8:33 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by cybmatrix » Mon Sep 09, 2019 3:33 pm

I meant also the EVENT mode result in a: TAG not found !

chivracq wrote:
Fri Sep 06, 2019 8:27 am
"nothing happened." is a bit of a vague Statement, and that Feedback could have already been posted in your original Thread when I had mentioned the 'EVENT' Mode... :?
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by chivracq » Mon Sep 09, 2019 5:50 pm

cybmatrix wrote:
Mon Sep 09, 2019 3:33 pm
I meant also the EVENT mode result in a: TAG not found !
chivracq wrote:
Fri Sep 06, 2019 8:27 am
"nothing happened." is a bit of a vague Statement, and that Feedback could have already been posted in your original Thread when I had mentioned the 'EVENT' Mode... :?

Alright, I saw your "Report" with the Login & Password, I will (try to) have a look by myself..., I'm a bit "curious" about this Site... :wink:
But hum, I have a veeeeeery slow Internet Connection at the moment, and using a Proxy will slow it down even more... But @Tom already has a German IP, so that might already be "easier" for him...

Grrr...!, and I "hate" those Sites that "require" an IP from a specific Country, or to serve some Content related to your IP and/or the Language they "think" you (want to) speak... I see it also with many French Sites which absolutely want to serve me some "Content" in Dutch because I have a Dutch IP..., and yep I speak Dutch but when I visit a French Site, I want the Content in French and related to France... Sounds like nobody is even "allowed" to travel "abroad", like going on holiday for example... And that some People might even live "abroad" is completely unthinkable, of course...! :roll:
- (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
cybmatrix
Posts: 38
Joined: Tue Dec 08, 2009 8:33 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by cybmatrix » Tue Sep 10, 2019 7:40 am

Hello chivracq.
Something new ?
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by Tom, Tech Support » Wed Sep 11, 2019 4:11 pm

Hi cybmatrix,

Thanks for sharing the credentials! I've been looking at this for over 2 hours now trying to come up with a way to fill the fields on the contact form, but the main problem is that there are several hidden fields for each one of those input fields. The position of the actual, visible field that needs to be filled changes randomly, and there is no obvious attribute value that distinguishes the "real" field from all of the others, making it all but impossible to target the correct field using iMacros for Firefox. In other words, the ID as well as the POS of the "real" field is always different on each instance of that form, which makes it a moving target.

@chivracq, maybe you see a clever way around this scenario, but it seems to me that it might be implemented this way in order to thwart automation!

I could only fill the "real" field with EVENTS, and once it is filled, then a value of "qx_form_textarea_shifted" is dynamically added to the CLASS attribute. So, it is theoretically possible to code something in Javascript to "probe" each of those fields until it finds the correct one, but that seems more trouble than it's worth, especially since it is much easier to automate this form using e.g. iMacros image recognition. That feature is only available with the Professional and Enterprise Editions using either the iMacros browser or iMacros for IE, but it is a much more straightforward and efficient (plus easy!) solution. :D
Regards,

Tom, iMacros Support
User avatar
cybmatrix
Posts: 38
Joined: Tue Dec 08, 2009 8:33 pm

Re: [MACRO REQUEST] Loop and dynamic ID form compiler

Post by cybmatrix » Tue Sep 17, 2019 2:30 pm

Found a solution with JS, that recursively try to insert text in the real POS:

Code: Select all

function InputMessage(msg)
{
	var ele=window.content.document.querySelectorAll("textarea[placeholder='Deine Nachricht']");
	for(var i=1;i<=ele.length;i++)
		iimPlayCode("SET !ERRORIGNORE YES\nSET !TIMEOUT_STEP 0\nTAG POS="+i+" TYPE=TEXTAREA ATTR=placeholder:Deine<SP>Nachricht CONTENT="+msg.replace(/ /g,"<SP>"));
}

function InputName(name)
{
	var ele=window.content.document.querySelectorAll("input[placeholder='Dein Name']");
	for(var i=1;i<=ele.length;i++)
		iimPlayCode("SET !ERRORIGNORE YES\nSET !TIMEOUT_STEP 0\nTAG POS="+i+" TYPE=INPUT ATTR=placeholder:Dein<SP>Name CONTENT="+name.replace(/ /g,"<SP>"));
}

* CODE BY Vivek from India !
Post Reply