Jump to content

Stringbetween


Recommended Posts

#include <GUIConstants.au3>

#include <IE.au3>

#include <INet.au3>

#include <string.au3>

#include <file.au3>

$oIE = _IECreate ("http://test.html")

-------edit for brevity----

navigate page

navigate page

-------edit for brevity----

$String = _INetGetSource($oIE)

$CertGet = _StringBetween($String, "md5=", '">')

MsgBox(0, "Complete", $CertGet)

I am trying to capture data from an IE page between md5= and ">.

I don't use the var $oIE again so I am suspecting that it will use the current page to scan for the info.

From what I gather I want to use inetgetsource to gather the source of the page without having to use a tempfile and then running stringbetween to parse out what I am looking for. I read the help files and have searched a bunch, am I missing something or does the stringbetween function only output arrays? and if it does, what may I be able to use to capture and output the text between the two points?

Thanks in advance,

Link to comment
Share on other sites

It returns array.

Look at example from HelpFile:

#include <String.au3>
#include <array.au3>

$aArray1 = _StringBetween('[18][20][3][5][500][60]', '[', ']');Not using SRE
_ArrayDisplay($aArray1, 'Default Search')
$aArray2 = _StringBetween('[18][20][3][5][500][60]', '\[', '\]', -1, 1);Using SRE
_ArrayDisplay($aArray2, 'StringRegExp Search')

EDIT:

_StringBetween() uses StringRegExp()

so use directly StringRegExp() with parametres to return non array value

Edited by Zedna
Link to comment
Share on other sites

#include <GUIConstants.au3>
#include <IE.au3>
#include <INet.au3>
#include <string.au3>
#include <file.au3>
$oIE = _IECreate ("http://test.html")
-------edit for brevity----
navigate page
navigate page
-------edit for brevity----
$String = _INetGetSource($oIE)
$aArray1 = _StringBetween($String, "md5=", '">')
_ArrayDisplay($aArray1, 'Stuff I am looking for')

I am using this now and am still not getting what I expect for a response.

I expect it to be something like l5456a4er6r5wg4df56fg6465sdfg4d56sfg4&domainID=029345oi24tjklfsdgil5096059780598

Does _INetGetSource($oIE) get the current page source code or does it revert back to http://test.html ?

Thanks,

Link to comment
Share on other sites

Hi,

can you post the string and the result you expect, then we are able to show things work.

So long,

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

The snippit from the html page I am looking to pull from looks like this:

<TD ALIGN="CENTER">

<FONT FACE="arial">

<A HREF="./view-cert.xuda?md5=65s4fsdg564dfg56dfs56g4dfg564fg&domainID=54sdfg564sd65fg4sd56fg4456787s9dfg823">

I need this

7421bc9b96dc7878cfbe1e5cdc502926&domainID=515847bdf41b73850b5811e36a0358ad4d1922b5

I try to do the inetgetsource and then print the result but I don't get anything back.

I used the following and it works. I am not familiar with Arrays at all. How do I print the only result from the _arraydisplay to string or variable?

$String = _IEBodyReadHTML($oIE)
$aArray1 = _StringBetween($String, "md5=", '">')
_ArrayDisplay($aArray1, 'Stuff I am looking for')

How do I replace the _arraydisplay line with a var capture of the only response in the array?

$infoIamlookingfor = _ArrayToString($aArray1, 0)
MsgBox(0, "Complete", $infoIamlookingfor)

the preceding snippit doesn't reply with the array data.

Link to comment
Share on other sites

Hi,

example:

#include<String.au3>
Global $str = 'HREF="./view-cert.xuda?md5=65s4fsdg564dfg56dfs56g4dfg564fg&domainID=54sdfg564sd65fg4sd56fg4456787s9dfg823">'
$a = _StringBetween($str, "md5=", '">')
MsgBox(0,"", $a[0])

So long,

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

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