Jump to content

Recommended Posts

Posted (edited)

I am trying to get the search input information, so that I can input text and submit the search via a script...I believe this is the prudent code, and this is what I am trying to do. Nothing happens, no errors, and it doesn't type anything into the search input. I have tried using IE Builder, but I cannot figure out how to input text into that search field...I have done this on other websites...but this isn't working right...maybe you can look at the source snippet and see. The first snippet is what IE Builder gave me under the "form elements". 2nd code is some actual HTML source snippets. 3rd is my script trying to interact with it.

IE-Builder v2.0.0
Object Type  Object Count  
DispHTMLFormElement 4 

Elements for form 0
Index Tag Name Id Extra Information Object Type 
0 INPUT q   Form Input Type: text
Value: Search DispHTMLInputElement 
1 SELECT Category    DispHTMLSelectElement 
2 SELECT searchFP    DispHTMLSelectElement 
3 INPUT  Form Input Type: submit
Value: Search DispHTMLInputElement

HTML Source snippet

<form class="searchForm" method="get" action="/search/query/p/">
<div>
[<a href="http://&#()#.com/SearchHelp" onclick="openwin(href); return false;">help me with search</a>]
<label accesskey="S">Search</label>

<select name="searchFP" tabindex="3">
<option value="p" selected="selected">Posts</option>
<option value="f" >Files</option>
<!--<option value="n" >NFOs</option>
-->
</select>
<input type="submit" value="Search" tabindex="4" />
</div>
</form>
</div> <!-- }}} -->

<div id="Main">

not going to post the whole script, just the part that isn't working, the entering text into search input and clicking search

;Search
    $oSearchInput = _IEGetObjByName($oIE, 'SearchFP')
    _IEFormElementSetValue($oSearchInput , 'SEARCH I SAY')

Edit: Removed other form elements returned by IE-Builder, only need form 0

Edited by dufran3
  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

Another little snippet....

<label accesskey="S">Search</label>
<input type="text" value="Search&hellip;" onfocus="if (value=='Search&hellip;') value='';" onblur="if(value=='') value='Search&hellip;';" size="25" name="q" tabindex="1" />

See, the name says "q" so I tried to use that but didn't work....

Posted

Were you able to obtain the Form object? Once that's done, you should be able to access "SearchFP" using _IEFormElementGetObjByName.

Posted

Were you able to obtain the Form object?

I'm not sure how to obtain the form object? _IEFormGetCollection?? tried that, but not sure if it is returning anything, or how to use that function...

Posted

Yes, you would use _IEFormGetCollection.

Example:

$oForm = _IEFormGetCollection ($oIE, 0) ;This would grab the first form
$oSearchInput = _IEFormElementGetObjByName($oForm, 'SearchFP')
_IEFormElementSetValue($oSearchInput , 'SEARCH I SAY')
Posted

When using this:

$oForm = _IEFormGetCollection ($oIE, 0) ;This would grab the first form
    $oSearchInput = _IEFormElementGetObjByName($oForm, 'SearchFP')
    _IEFormElementSetValue($oSearchInput , 'SEARCH I SAY')oÝ÷ Ú­¶)ඬzºè­«­¢+Ø´´ØÈì%¹ÔÌ]ɹ¥¹É½´Õ¹Ñ¥½¸}%½ÉµÑ
½±±Ñ¥½¸°ÀÌØí}%MÑÑÕÍ}9½5Ñ (´´ØÈì%¹ÔÌÉɽÈɽ´Õ¹Ñ¥½¸}%½Éµ±µ¹ÑÑ=©    å9µ°ÀÌØí}%MÑÑÕÍ}%¹Ù±¥ÑQåÁ(´´ØÈì%¹ÔÌÉɽÈɽ´Õ¹Ñ¥½¸}%½Éµ±µ¹ÑMÑY±Õ°ÀÌØí}%MÑÑÕÍ}%¹Ù±¥ÑQåÁ(Ðíá¥Ð½èÀQ¥µèÄďĨØ
Posted

How about

$oForms = _IEFormGetCollection ($oIE)
MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page")

If this source code is present:

CODE
<form class="searchForm" method="get" action="/search/query/p/">

<div>

[<a href="http://&#()#.com/SearchHelp" onclick="openwin(href); return false;">help me with search</a>]

<label accesskey="S">Search</label>

<select name="searchFP" tabindex="3">

<option value="p" selected="selected">Posts</option>

<option value="f" >Files</option>

<!--<option value="n" >NFOs</option>

-->

</select>

<input type="submit" value="Search" tabindex="4" />

</div>

</form>

Then, _IEFormGetCollection should find something.

Posted

When using this code

#include<IE.au3>

$oIE = _IECreate()
_IENavigate($oIE,'www.google.com')oÝ÷ Ùh^îØb³­;Ú)z{.¥¦åjy0whÂØ^^Ë©jw°Â)Ý£    Ú¾(µçm¢ØZµ§]­ë,I©Â+a¶¬r^jëh×6#include<IE.au3>

$oIE = _IECreate('www.google.com')
Posted (edited)

If you already have an IE window open while running the _IECreate function, have you tried attaching?

_IECreate("www.google.com", 1)

Maybe you need to brush up on the IE.au3 help files?

Edit: There aren't any frames, are there?

Edited by GMK
Posted

Could try,

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oQuery = "LULZ I R GUD SERCHER"
$oHTTP.Open("GET", "http://www.newzbin.com/search/query/p/?q=" & $oQuery & "&Category=-1&searchFP=p")
$oHTTP.Send()
ConsoleWrite($oHTTP.ResponseText & @CRLF)

But then again, Httprequests are my answers to everything.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Posted

searchFP is a select box so you can only set its "selected" value.

p is the input text box which you need to set your search value.

Without knowing how your program flows you could cut out the middleman altogether and build your search query into the url string rather than manipulate the form and navigate directly to the results page:

$q="test"

$Category =-1

$searchFP="p"

$searchstring ="http://www.newzbin.com/search/query/p/?q=" & $q & "&Category=" & $Category & "&searchFP=" & $searchFP

builds

http://www.newzbin.com/search/query/p/?q=t...&searchFP=p

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...