Jump to content

Get arguments of jscript function


 Share

Recommended Posts

I'm trying to catch arguments from a javascript function

Exemple:

My_js_Fun(0,24,null,true,'abcd',var) as it appear in html source code

Mu goal is to get all these arguments.

I have no succed with this pattern

$array=StringRegExp ( $html, "(My_js_Fun\(.*\)" , 2)

please help me if you have an other solution (maybe with a IE.au3 ) or with an other better solution

Link to comment
Share on other sites

  • 2 weeks later...

I'm trying to catch arguments from a javascript function

Exemple:

My_js_Fun(0,24,null,true,'abcd',var) as it appear in html source code

Mu goal is to get all these arguments.

I have no succed with this pattern

$array=StringRegExp ( $html, "(My_js_Fun\(.*\)" , 2)

please help me if you have an other solution (maybe with a IE.au3 ) or with an other better solution

i'm not good with regexp either, but there's always more than one way to skin a cat. i would suggest using IE.au3 to read the html code to a string; then parsing out what you want like:

$TheFuncCall = StringInStr($htmlcode, "My_js_Fun(")
$parameters = StringSplit(StringMid($htmlcode, $TheFuncCall + 10, StringLen($htmlcode) - StringInStr(StringRight($htmlcode, StringLen($htmlcode) - $TheFuncCall + 10), ")"), ",")

the forum formatting will probably turn that into several lines, but it's actually just 2. the first identifies the numeric location for the beginning of the function call; that is then used in a couple of places to identify the parameter list, which is seperated by stringsplit and put into array $parameters. $htmlcode is just a representation of whatever variable you use to store the entire contents of the documents's html. the string created using IE.au3 suggestion...

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...