WLGades Posted June 30, 2004 Posted June 30, 2004 Hello, I've searched the forums but nothing popped up. I may have missed it, though, so if this is a repeat I apologize (and please, point me to where I can find it). How can I click a specific link on the page, if I don't know where it necessarily shows up? Is it possible go through all links until a certain link is found, then hit {ENTER} or some such?
WLGades Posted June 30, 2004 Author Posted June 30, 2004 (edited) Hm, but what if the link text isn't unique, while the link is? Say there are a lot of links that say "link" but they go to different pages. Is it still possible to find where they point to? edit: Actually, I can't even seem to get that to work. :-) I did a search for the name of the link, and it finds it correctly, but when I hit tab it starts at the beginning. Is it not working because of frames? edit2: Another way I just thought of is to tab through all the links, then do copy shortcut and search the returned string. Edited June 30, 2004 by WLGades
trids Posted July 4, 2004 Posted July 4, 2004 edit: Actually, I can't even seem to get that to work. :-) I did a search for the name of the link, and it finds it correctly, but when I hit tab it starts at the beginning. Is it not working because of frames?I think you're right about the frames: for me it works fine on MSIE 5.5 & 6 .. until I try a frames site: then the found text stays highlighted, and focus seems to shift to the entire frame itself - and a subsequent tab (sometimes!) takes me to the first link in that frame. I think your suggestion to walk the links and inspect the shortcuts is the safest. Since it sounds like such a pain, it might make a good UDF to share on Scripts and Scraps
tutor2000 Posted July 4, 2004 Posted July 4, 2004 I think you're right about the frames: for me it works fine on MSIE 5.5 & 6 .. until I try a frames site: then the found text stays highlighted, and focus seems to shift to the entire frame itself - and a subsequent tab (sometimes!) takes me to the first link in that frame. I think your suggestion to walk the links and inspect the shortcuts is the safest. Since it sounds like such a pain, it might make a good UDF to share on Scripts and Scraps How you gonna read the string that has been tabbed to then?Rick
trids Posted July 4, 2004 Posted July 4, 2004 WLGades was going to do a "copy shortcut" and inspect that.
WLGades Posted July 4, 2004 Author Posted July 4, 2004 This is what I came up with a few days ago, and it seems to work. The StatusbarGetText call of course relies on the window, etc. I don't think there's a way to find the text without knowing it beforehand. Func FindLink($link) $i = 0 While $i < 500 $x = StatusbarGetText("Microsoft Internet Explorer") if ($x = $link) Then Return(1) Send("{TAB}") $i = $i + 1 WEnd Return(0) EndFunc
tutor2000 Posted July 4, 2004 Posted July 4, 2004 This is what I came up with a few days ago, and it seems to work. The StatusbarGetText call of course relies on the window, etc. I don't think there's a way to find the text without knowing it beforehand. Func FindLink($link) $i = 0 While $i < 500 $x = StatusbarGetText("Microsoft Internet Explorer") if ($x = $link) Then Return(1) Send("{TAB}") $i = $i + 1 WEnd Return(0) EndFuncSo you're reading the status bar to see what the link is? Clever hope there's no mouse over status bar functions to mess that up Rick
WLGades Posted July 5, 2004 Author Posted July 5, 2004 Yeah, and that it actually displays the link instead of some weird text. :-) No problems yet, though.
tutor2000 Posted July 5, 2004 Posted July 5, 2004 This is what I came up with a few days ago, and it seems to work. The StatusbarGetText call of course relies on the window, etc. I don't think there's a way to find the text without knowing it beforehand. Func FindLink($link) $i = 0 While $i < 500 $x = StatusbarGetText("Microsoft Internet Explorer") if ($x = $link) Then Return(1) Send("{TAB}") $i = $i + 1 WEnd Return(0) EndFuncI just tried the status bar thing to a junkemail responder I wrote for hotmail and it works great thanks guys! I added a mousemove to 0,0 to make sure the mouse wouldn't cause any status bar text Thanks Rick
trids Posted July 5, 2004 Posted July 5, 2004 (edited) You might want to try this too .. Send("{TAB}") ;Next link Send("{APPSKEY}t{ENTER}") ;Copy destination to clipboard .. it gets the link destination first-hand, from the horse's mouth Edited July 5, 2004 by trids
trids Posted July 5, 2004 Posted July 5, 2004 This is probably a better option, if you're free to scan a download separately from the browser.I prefer this way, cos it's independent of the browser and its (MSIE's) truculent ways HTH
WLGades Posted July 5, 2004 Author Posted July 5, 2004 Nice implementation. Not something I'd use because I think it's more than I need, but well done. I thought about doing the Copy Shortcut, too, but scanning links is faster, and if it works, then I'd rather do it that way. :-)
jhbell Posted July 13, 2004 Posted July 13, 2004 I'm just getting into this with a goal of automating my standard Web info accesses. The above opinion was that there was no way to get the name of the link off the web page. Seems to me though that they are in the page source so.. while you gather the links why not gather the web text at the same time. eg: in this forum I look at the source and following the link for each note author is the text name. eg: WLGades..trids but.. since I don't know much about html maybe this is not always the case. Comments?
SlimShady Posted July 13, 2004 Posted July 13, 2004 (edited) Some time ago I made my own version of "Link Lister".You say you want the link names too?Allright then.I'll clean my script up and add it.Edit:Here it is: http://www.autoitscript.com/fileman/users/public/SlimShady/ExtractURLs.au3I used my UDFs in this script. So instead of AutoIt including them, I did it manually.When you run it, it will ask you for the URL of a webpage.When it is done, it creates a textfile and shows it.It will delete the file one second after notepad opens the file.Just above the part where notepad is run, you can use the array $Links.$Links[n][d] n stands for the link number or link name number.d can be 0 or 1.0 is the dimension with links.1 is the dimension with the link names.Have fun. Edited July 13, 2004 by SlimShady
WLGades Posted July 13, 2004 Author Posted July 13, 2004 Thanks for the script. I'm trying to do this without getting the source, but I'm sure other people will find that it's helpful.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now