Jump to content

Recommended Posts

Posted

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 :D

Posted

_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

Posted

_InetGetSource and then StringInStr or StringRegExp.

Mega

Hmm.. What about cookies ?

This need be logged to FB in oder to see the account name.

Posted

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?

Posted

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.

Posted

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.

Posted

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&amp;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 ?

Posted (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+&amp;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 by Authenticity
Posted

$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+&amp;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 :D

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&amp;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 ?

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
×
×
  • Create New...