Jump to content

Grab a number off a link


Recommended Posts

; Once you get the full link, here's one way to get the number

$fullLink = "http://www.site.com/person-28882.html"

$number = StringTrimRight( StringReplace($fullLink,"http://www.site.com/person-","") , 5)

MsgBox(0,"Result", $number)

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

; Once you get the full link, here's one way to get the number

$fullLink = "http://www.site.com/person-28882.html"

$number = StringTrimRight( StringReplace($fullLink,"http://www.site.com/person-","") , 5)

MsgBox(0,"Result", $number)

So i could make it tab to the link and push the Ctrl+C then use the ClipGet cmd so $FullLink = ClipGet() or no?

Link to comment
Share on other sites

So i could make it tab to the link and push the Ctrl+C then...

Does this work for you when you do it manually? Open the web page, tab to the link of interest, manually press Ctrl-c, open notepad, press Ctrl-v... did it work? Probably not.

Bring the page down to a local file using InetGet

Open the file via FileOpen

Read each line of that file using the sample code in the help file under FileReadLine

Once you get that code to work, you will need to figure out how to stop the While/WEnd loop on the link of interest. Perhaps the same way you were going to stop the tabbing in your original post.

After you get the loop to stop on the line of interest, then a version of what CyberSlug posted should get you that number.

Post back if you can not figure out how to make this work for you.

If you really want to stick with the "tab around" method... then once you are on the link, use shift-F10 and copy the link into the Window's clipboard and go from there.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Ok like i want a script that will tab onto a link with http://www.site.com/ and save the whole link so lets say its http://www.site.com/person-28882.html.

I need it to remove the http://www.site.com/person- and the .html and just keep the number. Is this possible?

I'm not certain that I understand you question, but using IE.au3, the following will retrieve the href text from all <A> links on a page:
#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.site.com")

$oAs = _IETagNameGetCollection($oIE.document, "a")

For $oA in $oAs
    ConsoleWrite($oA.href & @CR)
Next

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...