Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting multiple list box items in web page
#1
Quote:Hi Gindi,

I am trying to select multiple combo box items. The code below runs on http://jobsearch.usajobs.gov/

I can't get both Postal Service and Supply to be selected. Sometimes I might want 5 or 10 things selected. Any ideas or if you can add to wish list that'd be great.


str a b
a = "Postal Service"
b = "Supply"
Htm el=htm("SELECT" "jbf571" "" win(" Internet Explorer" "IEFrame") 0 1 0x121)
key+ C
el.CbSelect(a)
1
el.CbSelect(b)

Use this function. Select first item without flags, other items with flag 1.
Member function Htm.CbSelect2
Code:
Copy      Help
function VARIANT'item [flags] ;;Selects combobox item.  item can be item index (0-based) or text (exact or with *?).  flags: 1 add to selection
if(!el) end ES_INIT

MSHTML.IHTMLSelectElement elsel=+el
int index

sel item.vt
,case VT_I4
,index=item
,if(index>=elsel.length) end "item not found"
,
,case VT_BSTR
,str s(item) ss
,MSHTML.IHTMLOptionElement elop
,index=-1
,foreach elop elsel
,,ss=elop.text
,,if(!matchw(ss s)) continue
,,index=elop.index; goto g1
,end "item not found"
,
,case else end ES_BADARG

;g1
if flags&1
,MSHTML.IHTMLOptionElement oe=elsel.item(index)
,if(oe.selected) ret
,oe.selected=-1
else
,if(index=elsel.selectedIndex) ret
,elsel.selectedIndex=index

err+ end _error

#opt err 1 ;;_iever>=0x532
MSHTML.IHTMLElement3 e=+elsel
e.FireEvent("onchange")
err+
#opt err 0

Macro
Code:
Copy      Help
str a b
a = "Postal Service"
b = "Supply"
Htm el=htm("SELECT" "jbf571" "" win(" Internet Explorer" "IEFrame") 0 1 0x121)
el.CbSelect2(a)
el.CbSelect2(b 1)


Forum Jump:


Users browsing this thread: 1 Guest(s)