Stev Posted April 3, 2009 Share Posted April 3, 2009 I need my script check for a word in the page. The website is facebook and I need check the account name (ex: Joe Doe). I'll use a var ($name = "Joe Doe") to compare it. If the word is there, continue. If not exit. I'm using Google Chrome, no IE Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 3, 2009 Share Posted April 3, 2009 _InetGetSource and then StringInStr or StringRegExp. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Stev Posted April 3, 2009 Author Share Posted April 3, 2009 _InetGetSource and then StringInStr or StringRegExp.MegaHmm.. What about cookies ?This need be logged to FB in oder to see the account name. Link to comment Share on other sites More sharing options...
Kate Posted April 3, 2009 Share Posted April 3, 2009 Hmm.. What about cookies ?This need be logged to FB in oder to see the account name.Do you want the script to automate logging into FB as well? Or will a user already be logged into FB when the script runs? Link to comment Share on other sites More sharing options...
Stev Posted April 3, 2009 Author Share Posted April 3, 2009 Do you want the script to automate logging into FB as well? Or will a user already be logged into FB when the script runs?The script already login to FB.I want to check the name to know if it's logged or something was wrong.If I can see the right account name, it's logged.If not something fail. Link to comment Share on other sites More sharing options...
Kate Posted April 3, 2009 Share Posted April 3, 2009 The script already login to FB.I want to check the name to know if it's logged or something was wrong.If I can see the right account name, it's logged.If not something fail.Okay, then Xenobiologist's answer is your best bet. I checked and my name shows up in my FB home page source code when I successfully log in (it does not if I type in the wrong password. Use _InetGetSource to turn the page source code into a string and then use StringInStr or StringRegExp to search for your name. Link to comment Share on other sites More sharing options...
Stev Posted April 4, 2009 Author Share Posted April 4, 2009 Okay, then Xenobiologist's answer is your best bet. I checked and my name shows up in my FB home page source code when I successfully log in (it does not if I type in the wrong password. Use _InetGetSource to turn the page source code into a string and then use StringInStr or StringRegExp to search for your name. Okey, I have something done... Global $name = "Joe Doe" #include <INet.au3> $source = ConsoleWrite(_INetGetSource('http://www.facebook.com')) ; $html = '<a href="http://www.facebook.com/profile.php?id=5360150392&ref=name">Joe Doe</a>' $regex = StringRegExp($source, "regex here", 1); need learn regex If Not @error Then MsgBox(0, "Regex", "You are logged: " & $regex) If @error Then MsgBox(0, "Regex", "No Logged") Exit EndIf Can you help me with regex ? Link to comment Share on other sites More sharing options...
Authenticity Posted April 4, 2009 Share Posted April 4, 2009 (edited) $source = ConsoleWrite ; Now $source = amount of characters written to the console. ;]You mean:$source = _INetGetSource('http://www.facebook.com') ConsoleWrite($source & @LF)One pattern or expression to the StringRegExp can be:"(?i)<a.*?>\Q" & $name & "\E"Not restrictive as:'(?i)\Q<a href="http://www.facebook.com/profile.php?id=\E\d+&ref=name">\Q' & $name & '\E</a>'\Q..\E is so the RexExp engine relating the inner text as it's without any metacharacters, etc.. special meaning.Edit: ... Edited April 4, 2009 by Authenticity Link to comment Share on other sites More sharing options...
Stev Posted April 4, 2009 Author Share Posted April 4, 2009 $source = ConsoleWrite ; Now $source = amount of characters written to the console. ;] You mean: $source = _INetGetSource('http://www.facebook.com') ConsoleWrite($source & @LF) One pattern or expression to the StringRegExp can be: "(?i)<a.*?>\Q" & $name & "\E" Not restrictive as: '(?i)\Q<a href="http://www.facebook.com/profile.php?id=\E\d+&ref=name">\Q' & $name & '\E</a>' \Q..\E is so the RexExp engine relating the inner text as it's without any metacharacters, etc.. special meaning. Edit: ... It's working fine! Thanks Global $name = "myname" #include <INet.au3> $source = _INetGetSource('http://www.facebook.com') ConsoleWrite($source & @LF) ;$html = '<a href="http://www.facebook.com/profile.php?id=5360150392&ref=name">Joe Doe</a>' $regex = StringRegExp($source, "(?i)<a.*?>\Q" & $name & "\E", 1) If Not @error Then MsgBox(0, "Regex", "You are logged") If @error Then MsgBox(0, "Regex", "No Logged") Exit EndIf I have tried the script now and I can't get logged. This get the "index" source as not logged. Is there any way to get the source as logged user ? Link to comment Share on other sites More sharing options...
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