Jump to content

Query HTML Page


Recommended Posts

Hi Auto-It Community,

I have a small challenge.

Html-Code

<form action="dosomething" method="post" name="doit">
<input type="hidden" value="hm" name="ct">
<input type="hidden" value="u" name="id">
<input class="" type="submit" value="Jetzt testen" name="Submit">
</form>

 

I would like to get the "u" of the value. 

My approach was

$htmltext = _FFReadHtml()
$IwantThatId=_StringBetween($htmltext,'name="id" value="','">')
;Msgbox(64,"showMetheID",$IwantThatId)

Unfortunately I do not get anything back. 

What other options to I have? From what I saw I am lucky that this line only appears once. 

 

Your help is much appreciated.

Link to comment
Share on other sites

  • Developers
3 minutes ago, malreinschaun said:

'name="id" value="'

Where do you see this string in the input?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers
1 hour ago, malreinschaun said:

sorry, the correct code is

$htmltext = _FFReadHtml()
$IwantThatId=_StringBetween($htmltext,'name="hm" value="','">')
;Msgbox(64,"showMetheID",$IwantThatId)

 

Doubt that : Where is 'name="hm" value="' located in your text?
So my point really is: Stop the messing about and post your script you are testing with and please have a close look first yourself!

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers
1 hour ago, malreinschaun said:

sorry, the correct code is

$htmltext = _FFReadHtml()
$IwantThatId=_StringBetween($htmltext,'name="hm" value="','">')
;Msgbox(64,"showMetheID",$IwantThatId)

 

Doubt that : Where is 'name="hm" value="' located in your text?
So my point really is: Stop the messing about and post your script you are testing with and please have a close look first yourself!

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I am so sorry for mixing it up, now I saw my mistake. Here is the corrected example

<form action="dosomething" method="post" name="doit">
<input type="hidden" name="id" value="b">
</form>

 

I would like to get the "b" of the value. 

My approach was

$htmltext = _FFReadHtml()
$IwantThatId=_StringBetween($htmltext,'name="id" value="','">')
;Msgbox(64,"showMetheID",$IwantThatId)
Link to comment
Share on other sites

  • Developers

mmm..   so you really don't want to share what you are really doing and simply fix up some code to share with us. ....right.

Either way ...  the last posted code works fine when you display the first instance of the returned array. The Helpfile is your friend!

 Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Works fine here:

#include <String.au3>
$htmltext='<form action="dosomething" method="post" name="doit"><input type="hidden" name="id" value="b"></form>'
$IwantThatId=_StringBetween($htmltext,'name="id" value="','">')
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $IwantThatId[0] = ' & $IwantThatId[0] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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