Jump to content

craigslist how to make search entries


Recommended Posts

I want to do a search on local craigslist every morning...

I am using this script:

********************************

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",1)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE "http://allentown.craigslist.org/"', "", @SW_MAXIMIZE)

WinWait("craigslist: lehigh valley classifieds for ","")

Sleep(3000)

Send("{TAB 11}trailer{SPACE}-travel{space}-boat{space}-jet{space}-mercury{space}-car{ENTER}")

WinWait("classifieds - craigslist - Windows Internet Explorer","")

Sleep(4000)

Send("{TAB 15}500{TAB}2000{ENTER}")

************************************

This works sometimes. When it does not, the limit amounts are not in the proper limit boxes. Is there a better way than tabbing to get to the input boxes.

Thanks! Jim

Edited by speedi
Link to comment
Share on other sites

Here you go:

#include <IE.au3>

$Search = "trailer -travel -boat -jet -mercury -car"
$minAsk = "500"
$maxAsk = "2000"

$oIE = _IECreate("http://allentown.craigslist.org/")
_IELoadWait ($oIE)
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetObjByName ($oForm, "query")
_IEFormElementSetValue ($oQuery, $Search)
_IEFormSubmit($oForm)
_IELoadWait ($oIE)
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetObjByName ($oForm, "minAsk")
_IEFormElementSetValue ($oQuery, $minAsk)
$oQuery = _IEFormElementGetObjByName ($oForm, "maxAsk")
_IEFormElementSetValue ($oQuery, $maxAsk)
_IEFormSubmit($oForm)
Link to comment
Share on other sites

Here you go:

#include <IE.au3>

$Search = "trailer -travel -boat -jet -mercury -car"
$minAsk = "500"
$maxAsk = "2000"

$oIE = _IECreate("http://allentown.craigslist.org/")
_IELoadWait ($oIE)
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetObjByName ($oForm, "query")
_IEFormElementSetValue ($oQuery, $Search)
_IEFormSubmit($oForm)
_IELoadWait ($oIE)
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetObjByName ($oForm, "minAsk")
_IEFormElementSetValue ($oQuery, $minAsk)
$oQuery = _IEFormElementGetObjByName ($oForm, "maxAsk")
_IEFormElementSetValue ($oQuery, $maxAsk)
_IEFormSubmit($oForm)
Foster, I copied and pasted your code and executed it.... I get these errors:

C:\Documents and Settings\Jim Mihalski\My Documents\data\trailer new.au3(10,56) : ERROR: syntax error

$oQuery = _IEFormElementGetObjByName ($oForm, "query") _IEFormElementSetValue

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\Jim Mihalski\My Documents\data\trailer new.au3(14,57) : ERROR: syntax error

$oQuery = _IEFormElementGetObjByName ($oForm, "minAsk") _IEFormElementSetValue

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\Jim Mihalski\My Documents\data\trailer new.au3(14,155) : ERROR: syntax error

$oQuery = _IEFormElementGetObjByName ($oForm, "minAsk") _IEFormElementSetValue ($oQuery, $minAsk) $oQuery = _IEFormElementGetObjByName ($oForm, "maxAsk") _IEFormElementSetValue

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\Jim Mihalski\My Documents\data\trailer new.au3 - 3 error(s), 0 warning(s)

Did I do something wrong??? Thanks!

Link to comment
Share on other sites

Ver 3.2.6 IE7 winxp pro

Got it! It seems somehow I didn't copy the entire script the 1st time....

Works now! Thanks a ton!!!!

Where can I get an explanation of the relevent commands in this script so I better understand it??? Thanks again!!!

Edited by speedi
Link to comment
Share on other sites

@speedi, AutoIt version 3.3.0.0 is already out if you want to update.

Edit: If you use SciTE editor then it's F1 to get to the help file and search for a function in the Index tab. If you don't have (but you do) it's under "Start-> All Programs -> AutoIt v3 -> AutoIt Help File"

Edited by Authenticity
Link to comment
Share on other sites

  • 2 weeks later...

@speedi, AutoIt version 3.3.0.0 is already out if you want to update.

Edit: If you use SciTE editor then it's F1 to get to the help file and search for a function in the Index tab. If you don't have (but you do) it's under "Start-> All Programs -> AutoIt v3 -> AutoIt Help File"

I have used the help and can't quite understand.. I wanted to check "search titles only", but could not figure out how to do it.. How do you know the object names like "query" "minask" "maxask" in your code below?? Thanks for helping me understand if you can...

#include <IE.au3>

$Search = "trailer -travel -boat -jet -mercury -car"

$minAsk = "500"

$maxAsk = "2000"

$oIE = _IECreate("http://allentown.craigslist.org/")

_IELoadWait ($oIE)

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetObjByName ($oForm, "query")

_IEFormElementSetValue ($oQuery, $Search)

_IEFormSubmit($oForm)

_IELoadWait ($oIE)

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetObjByName ($oForm, "minAsk")

_IEFormElementSetValue ($oQuery, $minAsk)

$oQuery = _IEFormElementGetObjByName ($oForm, "maxAsk")

_IEFormElementSetValue ($oQuery, $maxAsk)

_IEFormSubmit($oForm)

Link to comment
Share on other sites

$oChecl = _IEFormElementCheckBoxSelect($oForm, 0, '', 1, 'ByIndex')oÝ÷ Ø(^rKayø«²×!yÉ£®¢Ðr"w^Æ«¨¶íçè®j+Êj{¬y«­¢+ØÀÌØí½EÕÉå}%Ñ=© å9µ ÀÌØí½%°ÅÕ½ÐíÍÉ¡QåÁÅÕ½Ðì¤í¹Ñ¡¸ÕÍ)}%Ñ¥½¸ ÀÌØí½EÕÉä°Ìäí±¥¬Ìäì¤

If you still don't have DebugBar you're doing hard work reading through the HTML source... Link

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