HarvEX / Turbo-Sniper :: Macro Processor

This page presents the HarvEX Auction Macro Processor Tutorial, the Macro API Description & the Macro Example Collection.

Why macros? 

Macro Skripts enable free & easy automation all around eBay ! Combined automation runs of any type, custom data interfaces, new basic functions, adding new function to the HarvEX menu. Even complex permanent executing background task are possible !
The example collection on this page provides you with many examples - ready for immediate copy & run, or for easy adaptation.
You want the maximum !? See our Power Macros  : more complex applications running efficiently and stable on top of the HarvEX Macro Platform !

 A Python style script language is used in HarvEX Macros: most easy to learn for beginners & extremely powerful on the other side. 

The Macro API is new in v2.05 and extended in the futures. Thus, you check back to this page from time to time.

Contents of this Page:

A Custom programming service is offered here : Request Form

Feel also free to feedback@xellsoft.com.

 

HarvEX Main Page

14-Day Free Trial ::
(v2.06/Windows/1.7MB)

Buy Now!

Features

Tutorial

FAQ / Tips & Tricks

FAQ / Macros

FAQ / Trouble Shooting

Software Update

System Requirements

Custom Automations

Power-Macros
Auto Search&Buy
Excel Bulk Sniping
Auction Search Manager


 

 


Quick Start Tutorial : HarvEX Macros

Getting Started:  

  1. Run HarvEX. Go to the HarvEX Macro Processor page
  2. In the macro list double-click the preloaded hello_world macro -> The macro script appears in the script edit window.
  3. Click Execute or use [Ctrl-Return] or [F5] from inside the script text body -> The Script runs, a text appears in the Output window and a MessageBox is coming up.

First macro : "Touching the Bid Manager", Storing & Loading the macro ::

  1. Hit the New Button for a fresh macro script. Type the following lines to the script editor or copy & paste : mark the stuff > Ctrl-C (=copy) > place cursor to script editor > Ctrl-V (=paste)
    b = bm.GetItem(1234567890)    # should be a valid auction ID in bid manager
    print b.mybid

     

  2. Hit Execute Button -> you've extracted a mybid value from this auction !
  3. Save this fresh macro to the intern macro list by pressing Save As -> you are asked to enter a macro name; e.g.: my_first_macro
  4. Store this macro to a disk file : Mouse-right-click on the macro inside the list and select Save to File from the popup context menu.
  5. Loading a macro from disk file : Mouse-right-click somewhere in the macro list and select Load a Macro from File

Free Logic Bidding:

  1. A free logical sniping condition is the most simply type of (special) macro: A logical bidding condition as one-liner function in the Bid Edit Dialog: If it computes a zero value, the bid sniping is not executed. ( This type of  "Macro" is not used from HarvEX Macro Processor Page )
  2. Create a new bid sniping in the bid manager
  3. Test with dummy conditions: In the bid Condition field in the Bid Edit Dialog enter a "0";  press the "!" button -> sniper bid would not be executed; enter a "1" (or "---"); press the "!" button -> sniper bid would always be executed. 
  4. Enter a real world condition in the Condition field by selecting a template from the drop-down list. e.g. "BMItem(123456789).won() ->  the sniper bid on current auction is only exectued when this other item #123456789 is already won : maybe you want to win a stereo amplifier only when the fitting stereo receiver is already won.

Please Consider: For executing certain critical functions in the examples below, you are requested (by error message) to set the sandbox restrictions to a lower level. This "sandbox" level system is useful for protecting yourself from unintentionally executing critical actions.

 
"High Restrictions" Policy No direct I/O, no critical manipulation in the HarvEX application. E.g.: changing sniper bid values not allowed
"Medium Restrictions" Policy Enables non-critical I/O and advanced internal manipulations. E.g.: manipulating bids, preparing emails in MS Outlooks draft folder, limited Internet access (ScanItem, ...), reading disk files, ...
"Low Restrictions" Policy Enables critical I/O : directly sending out email, free HTTP/URL access, writing disk files, ... 

 

Macro Editor

The macro/script editor is Python aware.

Keyboard Bindings:

Macro Examples & Templates Collection

This section shows a set of examples - ready for copy & paste. 

Preloaded examples: Some of this examples are preloaded after HarvEX installation from *.hxpy files in the HarvEX directory. If you edit the preloaded examples, they are not automatically stored on disk but only in the HarvEX main internal application database. You may write them to disk by a right-click Save to file form inside the macro list. But if you delete or rename the preloaded examples in the macro processor, the original ones are again loaded from file. If you don't want them to be auto-reloaded from the .hxpy's, move those .hxpy files out from the HarvEX directory. If you want to have your own macros in (permanent) pre-load position, save them as .hxpy files to the HarvEX directory.

Copy & Paste & Run macro stuff: mark the specific macro text > Ctrl-C (=copy) > place cursor to macro script editor > Ctrl-V (=paste) > maybe press "Save-As" > press "Execute" or [F5] or [Ctrl-Return]

Example Index

The examples ready for copy & paste:

Hello World
[ hello_world ]

# Welcome to HarvEX Automation Macros !
# The Famous Hello World Macro :

print "Hello World !"

print "Bid Manager has", bm.GetCount(), "Items"

MessageBox("Welcome to HarvEX Macro Processor !")

Bulk Sniping
[ bulk_sniping ]

# Bulk-snipe selected bid manager items with a common bid value 2.01 !

for item in bm.GetSelectedItems():
  b=bm.GetItem(item)
  b.mybid=2.01
  b.set_snipe()

[ bulk_sniping_gui_and_se ]

items = bm.GetSelectedItems()
titles = [bm.GetItem(item).title for item in items]
print titles
value=util.GetSimpleInput("N=%s: %s"%(len(items),str(items)),"1.00")
if not value: exit()
value=util.Str2Money(value)
for item in items:
  b=bm.GetItem(item)
  b.mybid=value
  b.set_snipe(se=1)     # snipe also SE server based
MessageBox("%s set for %s items: %s" % (value, len(items), titles) )

Custom filter for search results
[ filter_search ]

# Example: filter search results
# keep only auctions with 1..4 bids on

intab = searchpage.GetMatrix()
outtab = [ line for line in intab if 0<line.nbid<5 ]
searchpage.SetMatrix( outtab )
searchpage.Show()

Notes:

modified example with case insensitve search in the title:

outtab = [ line for line in matrix if not re.search('(?i)laptops?|notebooks?',line.title) ]
(  not : inverse condition;  (?i) : case insensitive search ; ..s? : s character either present or not;  )

feed output to scan page instead of search-page:  scanpage.SetMatrix( outtab )

 

Bulk extract tabular data from eBay 'Sold Item' notification emails out of MS Outlook
[ scan_emails_sold ]



(copying: click into the script + press Ctrl-A + press Ctrl-C ; in Macro Processor click "New" and Paste the macro )

An extended version of that script calculates the price+shipping total to an extra column:

 

A complete Bulk Congratulations Mailer reacting to eBay 'Sold Item' notification emails ( MS Outlook )
[ bulk_congratulations_mailer ]



You can evolve & simulate this macro savely when having "send_or_prepare=0" : The generated emails are sent to the "Drafts" folder of MS Outlook. Only after setting send_or_prepare=1, the emails are going directly to the "Outbox".

(copying: click into the script + press Ctrl-A + press Ctrl-C ; in Macro Processor click "New" and Paste the macro )

 

Render some bid manager item info into table + file
[ render_bm_info_to_file ]

FILE=open("C:/MYOUTFILE.txt","w")
print >>FILE, "time:", time.asctime()
l=[]
for b in bm.Iter():
  columns = [b.item,b.currentbid,b.title]
  print >>FILE, '\t'.join( map(str,columns) )   #\t = TAB spaced columns! 
  l.append( columns )
FILE.close()
scanpage.SetMatrix(l , "$item;$currentbid;$title" )
scanpage.Show()

 

Simple column statistics on search results
[ simple_stat ]

# Example: quick statistics over bids in the search results.
# counts only auctions with at least 1 real bid

matrix = searchpage.GetMatrix()
stat = matrix.ColumnStat('bid')
print stat
print "bid : Count=%d Average=%.2f Variance=%.2f" % (stat.count,stat.avg,stat.var)

  
Manual statistics on search results with more control
[ special_stat ]

# Example: manual statistics over content in the Search Window.
# Counts auctions where at least one real bid on

sum_count=0
sum_nbid=0
sum_bid=0.0
for line in searchpage.GetLines():
    if line.nbid>0:
        sum_count += 1
        sum_bid += line.bid
        sum_nbid += line.nbid

if sum_count: avg_bid = sum_bid / sum_count
else:         avg_bid = 0.0

print sum_count,"Auctions with bid; ", sum_nbid,"bids total; average bid:%.2f" % avg_bid

  
Walk through the bid manager and manipulate bids
[ inc_flat_bids ]

# Example: navigate in the Bidmanager and manipulate bids
# by incrementing flat value bids (0.50ct round) by 0.03 

for b in bm.Iter():
    print b.item, b.mybid, b.currency, b.comment
    if b.is_active_snipe() and 0.00 == b.mybid%0.50:
        MessageBox("incrementing %s %s (%s) !" % (b.item,b.title,b.mybid) )
        b.mybid += 0.03

 
Execute a combined multiple search for 3 categories
[ search_3_cat ]

# do a multiple search for 3 categories
# ( requires HarvEX+ )

q=AuctionQuery()
q.subjects='Pentium Computer'
q.maxpages=1
#q.completed=True
#q.searchurl='http://search.ebay.ca/search/search.dll?abc...'

categories=[
  '160',
  '12576',
  '20710',
]

for cat in categories:
    q.cat = cat
    DoSearchAuctions( q , adding=True , cached=SC_CACHEDORDOWNLOAD )

# result goes to the search page !

 

Bulk extract listing fees and data from eBay 'Listing Confirmed' notification emails out of MS Outlook
[ scan_listing_fees ]

 

Raw scan bid + shipping total costs to a table (items from bid manager or from search page)
[ scan_shipping_raw ]

( a raw scan example! $ship and $total are now also valid pre-computed scan columns variables since v2.05/build166 )

l=[]
##for b in searchpage.GetLines():
for b in bm.Iter():
  o = ScanItem(b.item,cached=SC_CACHEDORDOWNLOAD)
  if not o: continue
  ship = re.search("(?s)(?i)(?:Shipping and handling|Verpackung und Versand):.*?([\d,.]+)</b>",o.html)
  if ship:
    ship = ship.group(1)
    total = util.Money2Str( util.Str2Money(o.bid) + util.Str2Money(ship) )
  else:
    ship="???"
    total=o.bid+" ?"
  ##print o.bid,ship,total,o.nbid,o.title
  l.append([b.item,o.bid,ship,total,o.nbid,o.currency,o.titlewords])
scanpage.SetMatrix(l , "$item;$bid;$ship;$total;$nbid;$currency;$titlewords" )
scanpage.Show()

  

Render MyBid + Shipping = MyTotal into the comment column (bid manager)
[ bm_mytotal_comment ]

l=[]
for b in bm.Iter():
  o = ScanItem(b.item,cached=SC_CACHED)
  ##o = ScanItem(b.item,cached=SC_CACHEDORDOWNLOAD)
  if not o: continue
  if o.ship.startswith('?'):
    mytotal = '?'+str(b.mybid)
    currtotal = '?'+o.bid
  else:
    mytotal = b.mybid + util.Str2Money(o.ship)
    currtotal = util.Str2Money(o.bid) + util.Str2Money(o.ship)
  b.comment = util.xcomment( 'MTO', mytotal, b.comment )
bm.Show()

( util.xcomment auto-updates if 'MTO=...' is already present in the comment ; alternative currtotal is also computed but not rendered;  )

 

Feed TurboLister with listings computed from the bid manager (or from anywhere)
[ turbolister_feed ]


 Interface for calling HarvEX+ from outside through file interface & polling
[ cmd_interface ]

#!init 777
#test: write "test()" into a file "hx-cmd-in.txt".

cmd_in = "hx-cmd-in.txt"
cmd_out= "hx-cmd-out.txt"
def test():
    print "test"
    return 4
def poll():
    if util.isfile(cmd_in):
        cmd=open(cmd_in).read()
        util.remove(cmd_in)
        ret=eval(cmd)
        open(cmd_out,'wb').write(repr(ret))

util.Schedule(poll,1, id=177)
print "cmd_interface scheduled"

( util.xcomment auto-updates if 'MTO=...' is already present in the comment ; alternative currtotal is also computed but not rendered;  )

 

Play a sound everytime the current-bid value of an auction in bid manger changes
[ bid_change_sound ]

#!init 777
# toggle the process

dBids={}

def StepBidChange():
  #print "step"
  for b in bm.Iter():
    if b.item in dBids and dBids[b.item].currentbid!=b.currentbid:
    print "bid change", b.item, b.currentbid
    util.xc(777,"e.PlayFile('bidding.wav')")
    dBids[b.item]=b

util.xc(777,"e.PlayFile('bidding.wav')")
print "BidChangeSound started"
util.Schedule(StepBidChange,3, id=100)

( util.xcomment auto-updates if 'MTO=...' is already present in the comment ; alternative currtotal is also computed but not rendered;  )

 

Macro Language & HarvEX(+) API

Annotation: "[HX+]" in the following marks functions available only with HarvEX+ license level - most of them are available during the 14 day trial period.

The Python Macro Language

HarvEX(+) has a Python Language interpreter built-in. A general introduction and tutorials for the Python language itself are found here.

This chapter shows HarvEX specific Python usage (about: invoking other macros, returning macro return values, persistent data and more).
The following chapters document the HarvEX Python API.

#   '#' starts a comment
CallMacro('hello_world')      # call another macro (sub macro call)
value = CallMacro('hello_world', a=1, b=2)        #call another macro with arguments
print a,b       # print the arguments which are 
                # available directly in the namespace of the called macro
raise Return, [1,'hello world',2.0]    # exit and return a list from this macro to (an optional) caller
exit( [1,'hello world',2.0] )          # alternate return statement
raise Exit      # exit a macro (before its natural end)
if MessageBox('really process mails?','Congratulations Mailer',1) != 1: raise Exit
MessageBox('really process mails?','Congratulations Mailer',1) != 1 or exit()        # the same
if not hasattr(ps,'a'): ps.a=0        # ps is the global persistent namespace : data persists between consecutive macro calls!
print ps.a                            # prints 0 1 2 3 4 5 6 7 ... iteratively
ps.a += 1
fps = util.FilePersistent( 'C:/mypersist.hxp' )
if not hasattr(fps,'a'): fps.a=0       # a disk persistent namespace : data persists between HarvEX runs ("OO-Database")
print fps.a                            # prints 0 1 2 3 4 5 6 7 ... iteratively even if HarvEX is restarted
fps.a += 1

time,re,string,sets and math are pre-imported python modules in HarvEX scripts. 
e.g. use "print time.time(); print math.sqrt(2)" without importing time or math !

Upon HarvEX startup the macro [init] is called if present. This script can be edited in order to get all customization done. For example install +Tools menu commands for quick access.

Top Level Functions

q = AuctionQuery()     [HX+]

Create a query object for usage in the 'DoSearchAuctions' and 'SearchAuctions' Functions. See also GetQueryFromForm.

Example: 

q = AuctionQuery()
q.subjects = 'Pentium Computer'
q.completed = True
DoSearchAuction( q )

Query object attributes:

Normal query object attributes can be generated by the "Gen. Macro" button in the search form.

q.searchurl = "http://search.ebay.de/search/search.dll?MfcISAPICommand=GetResult&ht=1&query=...." f

If this attribute is used, this direct search URL is used. All other attributes are ignored, thus the URL is not computed.

 

Beep()

Create a 'beep' sound signal.

DoSearchAuctions( query/url , adding=0 , cached=0, quiet=0)      [HX+]

Searches Auctions. The output goes to the search page. In case of quiet=1 the resulting lines are the return value and do not go to the search page.

Arguments: 

query / url : a AuctionQuery() object or flat url string
adding : 1 = add to existing content in the search page
cached : 0 = no/download; SC_CACHED=cached only; SC_CACHEDORDOWNLOAD
quiet : 0="GUI":same as manual search to search page; 
           1="return string": returns only TAB/NEWLINE spaced result string of all
           2=same as 0 but no error message boxes; 
           5="return list of search item objects": [<OSearchItem>, ..] 
[return] : 1 = search result OK (quiet=0/2)

Example: 

DoSearchAuction( q )

q=GetQueryFromForm()          [HX+]

Create a query object (see AuctionQuery) pre-filled from the current selections in the Search Form page ! Use full for creating "Multi-Searcher" macros

Arguments: 

[q] : query object

Example: 

q=GetQueryFromForm() 
print q                # see attributes you may alter in q !

i = MessageBox( text="test", title="Macro Message", opts=0)

Arguments: 

opts : 1=Add Cancel Button, 16 = Error Box, 48 = Information Box 
[i] : 1 = OK pressed

Example: 

scanpage.Show()    #shows the scan page

oscan = ScanItem( itemno, cached=SC_CACHED )

Arguments: 

cached : SC_CACHED, SC_DOWNLOAD [HX+], SC_CACHEDORDOWNLOAD [HX+]
[oscan] : <scan item object> with attributes : item,title,endtime,currentbid,... like Scan Page / Config table columns. 

See also: <oscan> object

Example: 

o = ScanItem(1234567890)
print o.nbids

...

Top Level Objects

bidmanagerpage

The Bid Manager Object

Shortname: bm

Access / Examples: 

bid = bm.GetItem("1234567890")    # returns a <Bid> object
print bid.get_mybid(),bid.title
bid = bm.AddItem("1234567890")    # creates new or returns existing
bm.DelItem("1234567890")
items = bm.GetItems()             # returns item numbers of all Bid Manager items
items = bm.GetSelectedItems()
for bid in bm.Iter(): 
    print bm.title    #iterates directly over bid objects
bid = bm.GetItem("1234567890")
bid.mybid = 7.03
bid.set_snipe()
bid.ExecBid(no_msg=True)

See also: <bid> object

Bid Manager Functions

AddItem

scanpage

Shortname: scp

Examples: 

scanpage.Show()    #shows the scan page
scanpage.SetMatrix( [ ['abc','def'],['ghi','jkl'], ... ] )   [HX+]
scanpage.SetLines( [ 'abc\tdef' , 'ghi\tjkl',... ] )   [HX+]
m = scanpage.GetMatrix()
print m[0,0]

See also: <oscan> object

searchpage

Shortname: sep

Examples: 

searchpage.Show()      #shows the search page
searchpage.SetMatrix( [ ['abc','def'],
                        ['ghi','jkl'],  ] )   [HX+]  

macropage

Shortname: mp

Examples: 

macropage.Show()            #shows the macr page
macropage.ClearOutput()

persistent

carries variable values over the execution time of a macro. 

Shortname: ps

Example: 

try: persistent.my_globalcounter
except: persistent.my_global_counter = 0

persistent.my_global_counter += 1
print persistent.my_global_counter

...

Modules

util

Utility functions.

ls = util.ScanOutlook( folder, filter=..., pattern=..., errorlevel=1)

[ HX+ required for scanning more than 10 emails ]

Arguments: 

folder : MS Outlook folder in directory slash (/) notation like "inbox/somewhere/ebay_in". "inbox" is language independent lockation for the Mail Inbox, the rest of the dirs are identical with your Outlook folder names

[ls] : list of strings of result lines; strings tab spaced columns according to the pattern.

Example:  ( see more real world example in the template section ! )

# retrieve buyer email addressses from german ebay.de emails

outlookfolder   = "inbox/ebaynew"
subjectcontains = "Sold Item|Verkaufter Artikel"  # read only emails containing this
columns = '$item;$email;$ebayname;$fullname;$street'
pa_all  = [
'(\d{8,10})', # extractor pattern for: item no.
'Käufer:.*?([\w.+-]+@[\w.+-]+)',                  # email address
'Mitgliedsname:(.*)',
'Name:(.*)',
'Straße:(.*)',
]

l = ScanOutlook(
   folder=outlookfolder,
   filter=subjectcontains,
   pattern=pa_all,
   errorlevel=0
)
print l

scanpage.SetList( l, headers=columns )
scanpage.Show()

 

f = util.Str2Money( s )   

Example: 

print util.Str2Money('2,345.50')      

print util.Str2Money('2.345,50')      

s = util.Money2Str( floatvalue ) 
s = util.Money2StrUS( floatvalue ) 
s = util.Money2StrDE( floatvalue ) 

( The first one uses the current country settings. )

Example: 

print util.Money2Str(2345.50')      

print util.Money2StrDE(2345.50')      

s = util.ExtractCurrency( "EUR 230,00" ) 
s = util.ExtractMoney( "EUR 230,00" ) 

-> "EUR"
-> "230.00"
works for any currency and country specific format ( , .  style etc. )

s = util.matrix2text( matrix )

Parameter: 

matrix : list of lists like [[11,12],[21,22],[31,32]]

Example: 

util.matrix2text([[11,12],[21,22],[31,32]])   #-> Tab & Newline spaced text 

m = util.lines2matrix( lines )

Turn tab spaced lines into a list-of-list-matrix.

Parameter: 

matrix : list of lists like [[11,12],[21,22],[31,32]]

Example: 

util.lines2matrix(['abc\tdef','ghi\tjkl') #-> [['abc','def'],[...]]

util.isfile(path)
util.isdir(path)
util.remove(path)

os functions within sandbox.

TL = util.ReadTurboListerCSV( fname )    [HX+]  

Read and understand a TurboListerCSV (template) file. Details: See the extensive example above.

It is not wise/possible to create a TurboLister file from scratch, because there are around 100 fields to be set. The field layout  may also change in future releases of TurboLister. 
Best practice: Use a template file already exported from TurboLister (TL/menu/File/Export to CSV) and load it with util.ReadTurboListerCSV, then manipulate the fields in this template and write the final TL CSV file and re-import in TurboLister.

Using a TL Object:

TL = util.ReadTurboListerCSV( "C:/data/mylistings.csv" ) 
print TL.headers        #--> check the list of TL attributes
t=TL.copy(0)            # take the first listing ( #0 )

print t['Title']        #--> 'Nice Auction' 
t['Description']='my nice auction: this is my new text'
t['Category 1']='1234'  # set the new category number
TL.clear(); TL.add(t);  # clear all other listings, set only the modified and ..
TL.write("C:/data/modified_listings.csv")   # .. create file for re-import in TurboLister

SetMenuMacro( title, macroname_or_function, id=None , pos=1000 )

Set a menu item in the "+Tools" menu of the HarvEX GUI. 'id = None' always appends. 'id = 123' writes or overwrites a certain item. using 'pos' you can control the exact position of the menu item.

util.SetMenuMacro( '&Filter Search Results with 1..4 bids on [filter_search]', 'filter_search', 202 ) 
def hello():
    print "hello"
    print "this is a function"
util.SetMenuMacro( '&Hello',  hello ) 
util.SetMenuMacro( '&Hello', lambda:MessageBox("Hello HarvEX User") ) 

mailitem = CreateOutlookMail( subject="hello", text="this is a message",
                                                     toaddr="hello@hello.world.net" , send=0 )   [HX+]  

Set a menu entry in the "+Tools" menu of the HarvEX GUI.

folder = util.GetOutlookFolder(folder='inbox/my/sub/folder')     [HX+]  

Return a folder object from folder path.

url_or_data = util.GetItemPicture( item, url=1):    [HX+]  

url=1 : return the picture URL; url=0: return the downloaded binary picture data. You could save this to a file or FilePersistent database.

data=GetItemPicture( '1234567890',url=0)
open('mypic.jpg','wb').write(data)

w = util.WaitCursor():    [HX+]  

A WaitCursor will be displayed until the w object disapears.

s = util.GetUrl("http://xx.yy.com/mydoc.html")    [HX+]  

Gets the content of a url page

s = util.GetUrlEbaySignin(ebayurl [,userpwd='otheruser'])    [HX+]  

Gets the content of a url page at eBay where eBay Sign-In is required. the main ebay account from config page or 'otheruser' is used. These passwords have to be registered in menu/Config/Mulitple Accounts.

s = util.GetClipboardText()

-> "Hello-Text from Clipboard"

util.SetClipboardText("Hello!")

Sets the Windows clipboard text

s = util.GetMainEbayUser()

-> "my_nice_account"

t = util.GetSyncedTime( bmitem.endtime )

Translates a linear server (auction) time to the local synchronized time ready for comparing it to time.time() (current PC time) values.

s = util.GetSimpleInput(name="", s="")

Requests an input string from the user. name is the question/term presented.

name : promt string
s : pre-filled string

util.SetAuctionRetrieveHandler( handler_func, id=1)    [HX+]  

Installs a function to be called after auction data update in bid manager. The handler_func is called with one parameter bid : a bid manager bid object. For example: Such handler may be used to post-process auction data after retrieving from ebay. E.g.: generate computed comments; 
Several handlers maybe installed with different id's - handlers with lowest id's are called first.  Setting a handler again with the same id overwrites. Setting None or lambda bid:None  uninstalls the handler with ID id.

util.Schedule( macro_or_func, period_or_pattern=2, id=None )

Installs a periodically executed background macro or function. It is recommend to use a function, because of 2 reasons: 1) A function has far less time overhead when being called. 2) You can use the persistent namespace of your macro.

period_or_pattern : Period in seconds
id : Example: id=123 : Scheduling a job with same id replaces the old job with that id

Example "Command execution through file interface & polling"

#init 777
cmd_in = "hx-cmd-in.txt"
cmd_out= "hx-cmd-out.txt"

def poll():
    if util.isfile(cmd_in):
        cmd=open(cmd_in).read()
        util.remove(cmd_in)
        ret=eval(cmd)
        open(cmd_out,'wb').write(repr(ret))

util.Schedule(poll,1, id=177)

util.COMDispatch( com_name )    [HX+]

Retrieve a COM Interface in order to control other applications like MS Excel, MS Word, etc. on this computer.

xl=util.COMDispatch("Excel.Application")
xl.Visible=1                            # want to see it live!
workbook=xl.Workbooks.Add()             # new .XLS workbook
sheet=workbook.Sheets(1)                # get first Sheet of that
sheet.Cells(1,1).Value = "First Cell!"
sheet.Cells(2,1).Value = 1.0            # 2nd row, 1st column
sheet.Cells(3,3).Value = "=SQRT(2+3)"   # Excel computed expression
tab=[
     [1, 2, 3, 4],
     [5, 6, 7, 8],
     ]
sheet.Range( sheet.Cells(4,1), sheet.Cells(5,4) ).Value=tab

# write some Bid Manager values out to Excel :
for ix,item in enumerate(bm.GetSelectedItems()):  # bm.GetItems() for all
    bid=bm.GetItem(item)
    sheet.Cells( 7+ix, 1 ).Value = bid.item
    sheet.Cells( 7+ix, 2 ).Value = bid.title
    sheet.Cells( 7+ix, 3 ).Value = bid.mybid
workbook.Save()

Objects

Bidmanager Item Object <bid>

Get a bid object like: bid=bm.GetItem("1234567890"); for bid in bm.Iter(): print bid.title

Setting of certain attributes requires [HX+]

<bid> Object Attributes:

item       : read-only
endtime    : read-only
comment 
mybid 
state 
currentbid : read-only
seller     : read-only
high_bidder: read-only
finished   : read-only
group          # bid.group="watch"; bid.group="bike(2)"
title      : read-only
on_sale    : read-only
quant      : read-only # Quantity of items in this auction
currency   : read-only
alarmdt=300    #alarm 300seconds before auction end
               #bid.alarmdt=0  #OFF
userpwd_ex     #bid.userpwd_ex = ("ebay_freak","secret_passwd"); 
               #bid.userpwd_ex = None;  
set_snipe(standalone=1,se=0) 
               # Activates Sniping or SE sniping  [HX+]
               # bid.set_snipe()
ExecBid(no_msg=False, bidcmd=0) 
               # Execute a Bid/auto-Buy-Now (bidcmd=0) or force Buy-Now (bidcmd=1)  [HX+]
               # bid.ExecBid(no_msg=True) 

Scan Item Object <oscan>

Get a scan item object like: oscan=ScanItem("1234567890",SC_CACHEDORDOWNLOAD)

<oscan> Object Attributes & Default Values:

item=""
title=""
words=""
titlewords=""     # title+words
buynow=0          # buynow only auction ? (no bids)
finished=0
on_sale=1         # Quantity : how many items are on sale
privat=0          # privat auction
bid=0.0
currency='?'      # "US $"
currencybid='??'  # "US $34.50"
bidq="0.0"        # "?" in front if auction not finished
nbid=0            # number of bids up to now
da=ti=""
dati=""
dati_local=""
ownbuy=0
endtimetime=0
scantimetime=0
high_bidder=""
seller=""
sellerhighbidder=""
ship="???"
total="?"

Search Item Object <OSearchItem>

Get a search item object like: l_osi=DoSearchAuctions(q,quiet=5); osi=l_osi[4]; print osi.title,osi.htmlitem

<OSearchItem> Object Attributes & Default Values:

    item=''
    bid=''              # as string
    buynowprice=''
    buynow=0            # flag
    currency='?'
    nbid='-'            # as string
    remtime=''          # time mark as string as delivered by Search
    htmlitem=''         # total HTML code of this single search item
    get_nbid()          # deliver integer of nbid or 0, if N/A
    get_bid()           # deliver float bid value
    get_buynowprice()   # get separate buy now price or 0.0 if N/A; #may be NotImplemented

Auction Query Object <query>

The "Generate Query Template" button in the Search Form page help to generate a template query. Example :

<query> Object Usage:

query=AuctionQuery()
query=GetQueryFromForm()
query.cat="#1234"         # Categorie with (eBay) ID 1234
DoSearchAuctions(query)
q=AuctionQuery()
q.searchurl="http://www.ebay.com/..."         # search from a URL
q.maxpages=10
for osi in DoSearchAuctions(q,quiet=5):       # returns a list of <OSearchItem>'s
    print osi.title,osi.get_nbid()

<query> Object Attributes & Default Values:

subjects,excl,cat,region,minPrice,maxPrice,anddesc,searchopt=("","","","0","","",0,"1")
completed=0
daysback=30
buynow=0
morethan1=0
paypal=0
sortby=0
resultsperpage="50"
worldlocation=0
available_to="0"
located_in="0"
searchurl=''   #complete search URL! Overrides: if set, no other form attributes take effect !
maxpages=1

 


New API suggestions: feedback@xellsoft.com.

Continue reading the FAQ, Tips & Trick page.

 

Power Macros (Commercial)

This chapter describes the "Power Macros" for HarvEX(+). They are sold/customized in addition to HarvEX.

Questions / Buying / Custom solutions or New Applications : Request Form  /  sales@xellsoft.com


Automatic Search and Buy-It-Now 

Searches for certain Buy-It-Now items or auctions and buys/snipes them automatically within configurable criteria

Price       :  US$ 40
Benefits   :  Facilitates screening a specific market

Buy / Question / Test : sales@xellsoft.com

The head of this macro shows how to configure it:

# searches and buys Buy-It-Now and/or bids on auctions
simulation=1               # simulation=0 : really buy/bid!
max_items_per_buy=10       # 
price_min=5.99
price_max=15.00
sellers_allowed=[]                                            # empty list: all sellers allowed
#sellers_allowed=['disneyauctionears','disneyauctionears2']   #list of allowed sellers
pause=30                                                      # seconds to pause betweed trials
max_search_items=10       # only top N auctions first ending first are analyzed

#search pattern ...
q=AuctionQuery()
q.cat='#44035 Lilo & Stitch < Disney < TV, Movie, Character Toys < Toys & Hobbies < All'
q.subjects='stitch le 500'
q.sortby=1
q.maxpages=1
q.buynow=1
q.searchurl=''   #complete search URL! If set, no other form attributes take effect !

# program ...
...

 

Excel Driven Bulk Sniping

Sets up sniping bids in the bid manager using data from an Excel Table (columns: itemno, my_max_bid, [group, group-N] ...)

Price       :  ~ US$ 50
Benefits   :  Aggressive mass bid sniping after preparing max. bid values in Excel

Buy / Question / Test : sales@xellsoft.com

Details:


Search Special Auction Details 

Searching and Bulk Extraction of Details of Auctions to a Table : e.g. Sport Event Tickets Data

Price       :  Starting from US$ 30; solution depends strongly on specific business.
Benefits   :  Facilitates screening a specific market

Buy / Question / Test : sales@xellsoft.com


Converter: Reseller-Data to TurboLister : Grabs product data from a Reseller Web Page and pre-computes eBay listings for TurboLister

Price       :  Starting from US$ 200 ; solutions depends on specific business.
Benefits   :  Enables efficient eBay re-selling of many different products

Buy / Question : sales@xellsoft.com

Details:


Automated multiple bulk SEARCH manager with filters for eBay cross trading

Price        :  ~ US$ 100 
Benefits   :  Enables superior eBay cross trading businesses

Buy / Question : sales@xellsoft.com

Details:


Questions / buying / similar custom solutions or new applications : Request Form

 

Macro FAQ

" What can I do and not do with macros "

" What language/syntax is used for HarvEX macros? "

" How do I most quickly learn this macro system? "

Top of this Page


webmaster@xellsoft.com    -   © 2009 Xellsoft.com. All Rights Reserved    -    Online Privacy  -  Affiliate - Company