Question Find specific text from html files?

techwiz24

Well-known member
Joined
Jun 2, 2010
Messages
51
Programming Experience
Beginner
Ok, so I had an idea today while modding a game I play. I decided to make a mod-manager.

In order to start the game with mods, you have to go to the website, log in, click playnow and view the source of the html file. From there you get the sessionID variable and add it to a shortcut on your desktop. I wanted to be able to automate this process by doing the following:

on button1.click: somehow parse the source of the html file to locate the line that looks like chis:
VB.NET:
var sessionId = 'random26charSessionID';
and take what is inside of the ' ' and add it to textbox1.text

Any ideas? Not sure if it will be in the same line every time with add banners and stuff...so I wanted to parse the doccument.
 
You're going to want to bind to Internet Explorer, or create a new instance.


Dim tempString as String
dim sessionID as String


myTempText = MSIE.Document.Body.InnerHTML
tempString = Split(myTempText,"var sessionId = '"
sessionID = Split(tempString(1),"'")

textbox1.text = sessionID(0)



I did this freehand without testing, but it should work.

If the site has frames, you will have to reference it:

myTempText = MSIE.Document.Frames("frame_name").Document.Body.InnerHTML


I can give more specific code if I can see the site.
 
Back
Top