Using the macro recorder, how do I click the second here.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
tommytx
Pro Scripter
Posts: 61
Joined: Mon Dec 22, 2003 3:20 am

Using the macro recorder, how do I click the second here.

Post by tommytx » Tue Jul 04, 2006 6:29 pm

Using the Recorder, how do I change the script to make it select the second "here" on the page.

Click here
Click here

The code below was done using the Wizard but the little bugger only selects the first here and none of the others. I think it is something to do with the index = 0 or index = 1 for second here but I do not know how to use it.


Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"here"}
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,A,TEXT,str:TagValue

Thanks
Tom

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jul 04, 2006 6:37 pm

Yes, where there are two identical links with the same text you can't use the standard TEXT attribute to identify it since that is not unique. Instead you can use INDEX. To identify the value of the index either view the source of the page and count the number of FrameName={""}
Let>FormName={""}
Let>TagValue={"6"}
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,A,INDEX,str:TagValue
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jul 04, 2006 6:37 pm

Yes, where there are two identical links with the same text you can't use the standard TEXT attribute to identify it since that is not unique. Instead you can use INDEX. To identify the value of the index either view the source of the page and count the number of FrameName={""}
Let>FormName={""}
Let>TagValue={"6"}
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,A,INDEX,str:TagValue
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

tommytx
Pro Scripter
Posts: 61
Joined: Mon Dec 22, 2003 3:20 am

Post by tommytx » Tue Jul 04, 2006 7:41 pm

Thanks Marcus, but I must be slow, I still can't get it to work.

The test.htm file looks like below... ? represents the FrameName={""}
Let>FormName={""}
Let>TagValue={"?"}
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,A,TEXT,str:TagValue

### Click on the second here link ###
Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"?"}
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,A,TEXT,str:TagValue

Can you tell me what goes in each tagvalue in this specific case:

tommytx
Pro Scripter
Posts: 61
Joined: Mon Dec 22, 2003 3:20 am

Post by tommytx » Tue Jul 04, 2006 7:47 pm

Boy your html stripper is working great, nothing gets by.

I will try to send the file without the code to make it look like html.

tom1.htm here
tom2.htm here
tom3.htm here
tom4.htm here

Just picture the above files as placed in the html format so that when you click each here it would go to each specific file.

Lets see if this gets by the html stripper as there is no html.

tommytx
Pro Scripter
Posts: 61
Joined: Mon Dec 22, 2003 3:20 am

Post by tommytx » Tue Jul 04, 2006 7:54 pm

Using the wizard the tags come out as follows:
A 0 first here
A 1 second here
A 2 third here
A 3 4th here.

When I placed the 0 thru 3 in the tagvalue it failed click any of them.

### Click the second here ###
Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"1"}
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,A,TEXT,str:TagValue

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jul 04, 2006 8:30 pm

When posting to the forum tick the "Disable HTML in this post" option to prevent html being seen as html and it will therefore just display as text and not be stripped.

Anyway, the reason your code isn't working is that you're still using the TEXT attribute. Use the INDEX attribute:

Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"1"}
LibFunc>hIE,ClickTag,r,%IE[0]%,str:FrameName,str:FormName,A,INDEX,str:TagValue
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

tommytx
Pro Scripter
Posts: 61
Joined: Mon Dec 22, 2003 3:20 am

Post by tommytx » Tue Jul 04, 2006 8:46 pm

Thanks that worked great.

Is there any Recorder samples in the Major script library?
Or any other place to see some examples of working scripts written by the Recorder?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts