Page 1 of 1

iMacros Tag Line Properties

Posted: Wed Aug 15, 2018 6:09 pm
by shaves
I'm trying to create a macro to log in to a company owned web page. When I record putting the cursor into the User Name text box, the following command is recorded:

IM = "CODE:"
IM = IM + "TAB T=1" + vbNewLine
IM = IM + "TAB CLOSEALLOTHERS" + vbNewLine
IM = IM + "SET !TIMEOUT 120" + vbNewLine
IM = IM + "TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/pdp/qnyfy/resumeSAML20/pdp/startSSO.ping ATTR=NAME:pf.username CONTENT=" & txtUser + vbNewLine
IM = IM + "SET !ENCRYPTION NO" + vbNewLine
IM = IM + "TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:/pdp/qnyfy/resumeSAML20/pdp/startSSO.ping ATTR=NAME:pf.pass CONTENT=" & txtPass + vbNewLine
IM = IM + "TAG POS=1 TYPE=INPUT:BUTTON FORM=ACTION:/pdp/qnyfy/resumeSAML20/pdp/startSSO.ping ATTR=ID:SubmitButton" + vbNewLine

The problem is that the "qnyfy" part of the tag line changes. The next time I try to record this tag line, every thing is the same except that "qnyfy" changes to something else; which renders my VBA code useless for logging into this web page.

Is there a way to extract this information first, find out what that 5 characters should be and then re-build a string to use the correct tag line?

Windows 7
Excel 2016
iMacros scripting version 10.3
(We have been using this version because the download feature seems to work better for us than scripting version 11.0. I have access to 11.0 but haven't tried it with that one yet because most of our users have the player version 10.3)
We are using the iMacros browser for this macro


Thanks for the help........

Re: iMacros Tag Line Properties

Posted: Wed Aug 15, 2018 8:16 pm
by chivracq
shaves wrote:I'm trying to create a macro to log in to a company owned web page. When I record putting the cursor into the User Name text box, the following command is recorded:

Code: Select all

    IM = "CODE:"
    IM = IM + "TAB T=1" + vbNewLine
    IM = IM + "TAB CLOSEALLOTHERS" + vbNewLine
    IM = IM + "SET !TIMEOUT 120" + vbNewLine
    IM = IM + "TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/pdp/qnyfy/resumeSAML20/pdp/startSSO.ping ATTR=NAME:pf.username CONTENT=" & txtUser + vbNewLine
    IM = IM + "SET !ENCRYPTION NO" + vbNewLine
    IM = IM + "TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:/pdp/qnyfy/resumeSAML20/pdp/startSSO.ping ATTR=NAME:pf.pass CONTENT=" & txtPass + vbNewLine
    IM = IM + "TAG POS=1 TYPE=INPUT:BUTTON FORM=ACTION:/pdp/qnyfy/resumeSAML20/pdp/startSSO.ping ATTR=ID:SubmitButton" + vbNewLine
The problem is that the "qnyfy" part of the tag line changes. The next time I try to record this tag line, every thing is the same except that "qnyfy" changes to something else; which renders my VBA code useless for logging into this web page.

Is there a way to extract this information first, find out what that 5 characters should be and then re-build a string to use the correct tag line?

Code: Select all

Windows 7 
Excel 2016 
iMacros scripting version 10.3  
(We have been using this version because the download feature seems to work better for us than scripting version 11.0. I have access to 11.0 but haven't tried it with that one yet because most of our users have the player version 10.3)
We are using the iMacros browser for this macro

Thanks for the help........
Oh...!, funny..., thinking you wouldn't react, I was actually typing my "Answer" at the same time in your Thread on SOF:
- iMacros Tag Line properties
Shaves on SOF wrote:I'm trying to create a macro to log in to a company owned web page. When I record putting the cursor into the User Name text box, the following command is recorded:

TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/pdp/qnyfy/resumeSAML50/pdp/startSSO.ping

The problem is that the "qnyfy" part of the tag line changes. The next time I try to record this tag line, every thing is the same except that "qnyfy" changes to something else; which renders my VBA code useless for logging into this web page.

Is there a way to extract this information first, find out what that 5 characters should be and then re-build a string to use the correct tag line?

Windows 7 Excel 2016 iMacros 10.3

Thanks for the help........
chivracq on SOF wrote:Hum, @OP not very reactive, then I will still post my Answers already here but it will be a bit long and "messy", with a lot of IF-IF-IF..., would have been easier if they had opened some parallel Thread on the iMacros Forum and answered a few Qt's...

First, FCI (Full Config Info) is not clear...!:

"iMacros v10.3" means either 'iMB v10.3'...? (=> 4-5 years old...?, + 'Scripting Interface' same Version...?), or 'v10.3 for CR' + => 'Free'/'PE'...? + 'Scripting Interface' Version...? + CR Version...?

Hum, and the 'TAG' Statement has been truncated as well...

Several Solutions, I'll go from "simplest" to "more complex":

1- The 'FORM' Parameter can probably simply completely be removed. It is usually not needed, unless there are several Forms on the Page with similar HTML Elements, here the 'INPUT' Field.

2- Same like '1', but using for example the 'CLASS' Attribute or any Attr(s) that might identify this 'INPUT' Field uniquely if there are several Forms on the Page with similar (but not identical) 'INPUT' Fields. (Or by adjusting the 'POS=n' if they are identical...)

3- Same like '1' or '2', but combined with 'Relative Positioning', on some HTML Element that can be identified "easily" and uniquely to be used as the Anchor, either inside the same 'FORM' or 'DIV', or just outside if that Form has some Name/Title for that "Section", usually in 'H2' or 'H3' Type.

4- Simply replace the dynamic part ("qnyfy") with a Wildcard:

Code: Select all

TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/pdp/*/resumeSAML50/pdp/startSSO.ping 
Sols [1-4] probably provide a "Shortcut" to probably achieve the desired Result, but they actually don't really answer @OP's Qt which was "How to identify/extract/isolate this "qnyfy" 5 Letter String...

5- Using first one of [1-4] Methods, manage to tag some Element that will be inside that 'FORM', either the 'INPUT' Field itself or one Element that could be used as Anchor in '4a' (with Anchor Inside the Form), and then use 'Double Relative Positioning' (more Info on the iMacros Forum where I've several times already completely explained the Principle) to identify and tag and extract (=HTM) the complete 'Containing 'DIV'' (or could be 'SPAN', but there will very probably be some (outer) 'DIV' also) containing the 'FORM' to then isolate the "qnyfy" part using 'EVAL', stg like...:

Code: Select all

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/pdp/*/resumeSAML50/pdp/startSSO.ping ATTR=CLASS:* EXTRACT=TXT
TAG POS=R-1 TYPE=DIV ATTR=TXT:* EXTRACT=TXT
SET !EXTRACT NULL
TAG POS=R1 TYPE=DIV ATTR=TXT:*&&CLASS:* EXTRACT=HTM
SET Form_ID EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('ACTION:/pdp/'); y=x[1].split('/'); z=y[0]; z;")
PROMPT EXTRACT:<BR><BR>{{!EXTRACT}}<BR><BR>Form_ID:<SP>_{{Form_ID}}_
6- This one actually comes between '4' and '5', it would be by using '4b' to first locate some Anchor outside the 'FORM' and its 'Containing 'DIV'', then only one Level of 'Relative Positioning' would be needed... (And the 'EVAL()' Statement remains the same...)

That's it...! It would help / add some "Reliability" if for example the Class of the Containing 'DIV' can be identified/add.

And if "iMacros v10.3" meant "iMacros for CR v10.3 'Free'", you'll need to use ['!VAR1'-'!VAR3'] instead of 'Form_ID' as User Defined Vars are not supported in the 'Free' Version...

[All Solutions/Scripts not tested of course...! Hum, I had previously mentioned that I could directly think of 3 or 4 Solutions, here are already 6, ah-ah...!, and there are also different possible Variants on all 6...]

>>>

If there is no Follow-up from @OP, I might need to "later" delete this Answer as I am currently (re)using my last 5/5 'Answer_Credit', I each time have to delete some previous Answer, to be able to post a 5th one, as most Users on the 'iMacros' Tag-Channel usually never follow up on their Threads and don't do "+1" or "Accept Solution"..., and all my previous Answers usually all get downvoted anyway by some "angry" User(s), so I never manage to pass the Threshold for more than 5 Answers, ah-ah...!, tja...!

(I still don't know what the 'community wiki' CB means below posting an Answer...?)
But OK, "Quality" of the Content of your OP is indeed a bit "better" here, ah-ah...! Good-good...!, that clears already a few "uncertainties" I had about your FCI and that narrows as well the possible Solutions...

So OK, you are indeed "really' on iMB v10.3 + 'Scripting Interface' v10.3..., a bit old now and there are not that many Users anymore still using that Version, hum, or it's maybe because those Users are usually IT-Professionals and have been using iMacros for so many years already that they usually don't really need the Forum to find their own Workarounds when needed..., but why not indeed, iMB v10.3 was a/the very stable Version in the v10.x Line, if it works fine for you for the Reason(s) you mentioned, then fine... I couldn't do without the 'EVENT' Mode to be honest, ah-ah...! :shock:

Hum, then, from a look at your Script here, yep-yep-yep..., I think all 6 Sols I mentioned on SOF would indeed work in your Case, even the "simplistic" Sol_1 which actually becomes automatically Sol_2 thanks to the 'NAME' Attribute that probably identifies that 'INPUT' Field uniquely, as I reckon there will only be only one Login Box on that Page:

Code: Select all

    IM = IM + "TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:pf.username CONTENT=" & txtUser + vbNewLine
Then I would go for this Sol (Sol_[1-2]), or maybe for Sol_4, with the Wildcard, for maybe a little bit of extra Reliability, but that could get broken one day, if the Sites changes a bit the Login Process...:

Code: Select all

TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/pdp/*/resumeSAML50/pdp/startSSO.ping 
And for "the Fun", you can of course try/test if I was correct as well with Sol_5 and Sol_6... You probably don't really need it in this Case, but the Principle is quite simple and the Method is quite powerful, this is the same Method I use to deal with Dynamic ID's, ah-ah...! (And that I have demonstrated a few times already...) You never know, you might need it one day, ah-ah...!

If you try/test all 6 Sols, I'll be interested to hear your Feedback, if I was correct and if they all 6 work... 8)

>>>

OK, I've quoted most Content from SOF here as well as SOF is a bit of a Hassle, the System is a bit "stupid" and only turns around "Reputation Points" and I can only post 5 "Answers" in total, so I regularly have to delete some previous one to be able to post a new one, as I never reach some unknown Reputation Threshold (from "unhappy" Users on our Forum actually who don't want to mention their FCI ah-ah...!, and who locate me on SOF and regularly downvote all my (previous) Answers + most Users on SOF in the 'iMacros' Tag-Channel are often first time Posters who don't really follow up on their Threads and don't really understand/use the "+1" + "Accept Solution" System and usually disappear once they've got their Script working...), so I might one day have to delete it if I want to be able to post another one, tja...! :roll:

Re: iMacros Tag Line Properties

Posted: Wed Aug 15, 2018 8:31 pm
by shaves
Thanks for all of the solutions. I will look / try all of them to see what happens. I appreciate all of the time you have taken to explain this answer. I was originally going to put this on the iMacros forum but got distracted and forgot about it after posting it on SOF. It may be a while before I can provide some feedback as I may be out of the office for awhile due to a medical issue. Once I get back, I will provide some feedback on these solutions. Thanks again for all of your help.........

Re: iMacros Tag Line Properties

Posted: Wed Aug 15, 2018 9:42 pm
by chivracq
shaves wrote:Thanks for all of the solutions. I will look / try all of them to see what happens. I appreciate all of the time you have taken to explain this answer. I was originally going to put this on the iMacros forum but got distracted and forgot about it after posting it on SOF. It may be a while before I can provide some feedback as I may be out of the office for awhile due to a medical issue. Once I get back, I will provide some feedback on these solutions. Thanks again for all of your help.........
Yeah, don't worry, no Pb, take your time, I had seen you actually first checking our Forum before going to SOF and posting there, I thought "Grrr...!!, WTF...!?, that's an Interesting Qt, why SOF...!?" :evil: Ah-ah...! That's why I reacted on SOF, as I normally never or very-very-very rarely answer Threads there, always complete Hassle with their Rep-System... :roll:
I've seen you've already "accepted" my Answer, even without testing it, ah-ah...! That's a lot of Confidence, I would think, ah-ah...! :shock:
(And Thanks of course... 8) )

But don't worry, I honestly think they all 6 work..., and I actually forgot a Sol_7 I wanted to mention..., ah-arrggghhh, but nope..., wouldn't work for you as you are on iMB v10.3: But I still mention it anyway:
=> Simply using the 'EVENT' Mode, with or without ID, I think the 'EVENT' Mode doesn't use any 'FORM' Info to locate an Element, especially without ID...
But hum, I don't find the 'EVENT' Mode without ID very "reliable", as Scripts "easily" get broken if any Content changes on the Page, shifting all 'DIV' Elements up or down... Can be "improved" a bit or avoided with some Workaround I have to implement some 'Relative Positioning' within the 'EVENT' Mode (never posted yet, I think...), but it's a bit cumbersome/complex, another time, and you don't need it anyway, ah-ah...! :wink:

Hum, and my "Rep" on SOF went from 40 Pts to 75 Pts now, woaw-woaw-woaw...!, maybe I can post more than 5 Answers now, I'll have to check... 8)
Hum, until a few Users downvote all my Answers again, ah-ah...! :twisted:

Hum, and not "too bad" I hope the "medical issue"... :wink:

Hum, and the Thread will probably get moved to the 'General' Sub-Forum, as it's not really related to the 'Scripting Interface', all Sols I mentioned would work in all Browsers..., well, except Sol_7 which then would only work in iMacros Versions supporting the 'EVENT' of course...