Shawn, Rad & Kent
Check this out! It works!
Have Fun & thanks for the help along the way.
No gripes about long lines, please?
{edit}
I need to clean it up... I have some left over
junk in it still (Beta Code)
{/edit}
code:
; IEComboBox.kix
; Thursday, June 27, 2002 Dana Eddy
; It is compatable with Kix 4.xx tested in 4.02
break on
;SETCONSOLE("HIDE")
$ElementArray="Please Select","DomainMachine1","DomainMachine2","DomainMachine3","DomainMachine4","DomainMachine5","DomainMachine6","DomainMachine7","DomainMachine8"
$OK = HTMLComboBox("Your Selection...","Manage WorkStations","Enter","Cancel")
EXIT
;***********************************************************
;HTML Combo Box:
; SYNTAX:
; HTMLComboBox("HTML Message", OPTIONAL "Window Title", OPTIONAL "Button Text", OPTIONAL "Alt Button Text", OPTIONAL "Alt Button Return Value")
;;################################
FUNCTION HTMLComboBox($L_Prompt, OPTIONAL
$L_Title, OPTIONAL $L_ButtonText, OPTIONAL $L_AltButtonText, OPTIONAL $L_AltButtonReturnValue)
$timeout = 0
$SelectedVal = "Not Selected"
IF $L_Title = "" $L_Title = "Question..." ENDIF
IF $L_ButtonText = "" $L_ButtonText = "Submit" ENDIF
IF $L_AltButtonReturnValue = "" $L_AltButtonReturnValue = -1 ENDIF
$L_TextColor = "FFFF00"
$L_BGColor = "000000"
$HTML = '<HTML>' +
'<BODY scroll=no TEXT=' + $L_TextColor + ' BGCOLOR=' +
$L_BGColor + '>' +
'<TITLE>' + $L_Title + '</TITLE><B>' +
$L_Prompt + '</B>' +
'<form name=MyForm>' +
'<BR>' +
'<OBJECT ID="ComboBox" WIDTH=200 HEIGHT=26 CLASSID="CLSID:8BD21D30-EC42-11CE-9E0D-00AA006002F3"></OBJECT> '+
'<input id=Submitted name=Submitted type=hidden value=0>' +
'<input id=Submit name=Submit type=button value=" ' +
$L_ButtonText + ' "' +
' onclick="MyForm.Submitted.value=1" Tabindex="2">'
IF $L_AltButtonText <> ""
$HTML = $HTML + '<input id=AltButton name=AltButton type=button value=" ' +
$L_AltButtonText + ' "' +
' onclick="MyForm.Submitted.value=2" Tabindex="3">'
ENDIF
$Bottomtext = "Select Workstation - Then Click: </BR><H1>Enter Two Times</H1><BR>To start the Image Restore Process." +
" Or Select CANCEL to End the Process."
$HTML = $HTML + '<Center><BR>$Bottomtext</BR></Center></FORM>'
$html = $html + '<TABLE ALIGN="Center" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
<TR ALIGN="Center" VALIGN="middle">
<TH>Status</TH></tr>
<TR ALIGN="Center" VALIGN="middle">
<TD><H1><input id=ReturnVal name=ReturnVal Size=25 MaxLength=25 value="$SelectedVal"></H1></TD></TR>
</TABLE></BODY></HTML>'
$appIE = CREATEOBJECT("InternetExplorer.Application")
;Set IE Object Properties
$appIE.top = 180
$appIE.left = 262
$appIE.height = 450
$appIE.width = 450
$appIE.addressbar = 0
$appIE.menubar = 0
$appIE.toolbar = 0
$appIE.statusbar = 0
$appIE.resizeable = 0
$appIE.FullScreen = 0
$appIE.Offline = False
$appIE.navigate("about:blank")
WHILE $appIE.busy <> 0 AND @ERROR = 0
LOOP
;Write the HTML code to the document
$appIE.document.write($HTML)
IEComboBox($AppIE,$ElementArray) ;pass array
WHILE $appIE.busy <> 0 AND @ERROR = 0 LOOP
;Make IE visible and set focus
$appIE.visible = 1
$focus= SETFOCUS("about:blank - Microsoft Internet Explorer")
$appIE.document.GetElementById("ComboBox").focus
DIM $L_LastBoxValue,$L_LastBoxValueCache
WHILE $appIE.document.GetElementById("Submitted").value <> 2
IF $appIE.document.GetElementById("Submitted").value = 1
$L_LastBoxValue = $appIE.document.GetElementById("ComboBox").value
If $L_LastBoxValue <> "Please Select"
$L_LastBoxValueCache = $L_LastBoxValue
$SelectedVal = "Processing " + $L_LastBoxValue
$appIE.document.GetElementById("ReturnVal").value = $SelectedVal
;Place your commands here;;;;;;;;;;;;;;;;;;
? "You sellected: " + $SelectedVal
sleep(2) ;only here to show it works
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$appIE.document.GetElementById("Submitted").value = 0
$combobox.value=$ElementArray[0]
$SelectedVal = "Please Select"
$appIE.document.GetElementById("ReturnVal").value = $SelectedVal
ENDIF
ENDIF
LOOP
$appIE.QUIT
$appIE = ""
ENDFUNCTION
;***********************************************************************************************
Function IEComboBox($Window,$ElementArray)
WHILE $window.busy <> 0 AND @ERROR = 0 LOOP
$combobox = $AppIE.document.GetElementById("combobox")
for each $element in $ElementArray
$=$combobox.additem("$Element")
next
$combobox.value=$ElementArray[0]
EndFunction
[ 27 June 2002, 22:38: Message edited by: Dana Eddy ]