Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Woohoo! Got this to pull names from the domain and populate IE!!!
code:
BREAK ON
; Set initially to string
$elementarray=""
; -- Build Internet Explorer Window $window = IECreateWindow("This Damn Thing",300,300,640,480)
IEWrite($window,"hello","Arial","4","#00ff00") IEWrite($window,"hello1",,"2","#ff0000") IEWrite($window,"hello2","Courier","5","#0000ff") IEWrite($window,"hello3")
; Enumerate hostnames in the domain
$cont = getobject("WinNT://" + @domain + ",domain") $cont.filter = "computer","" FOR EACH $machine IN $cont $obj = $machine.name $elementarray=$elementarray + ", "+$obj ; append to string, comma-delimed NEXT
; Morph the comma-delimed string into an array ...
$=execute('$$ElementArray = split($$ElementArray,",")')
;******************
; Enumerate the array ...
FOR EACH $element IN $elementarray ;Test to see array ? "Element=" $element NEXT
IEComboBox($window,"This Damn Thing","Test IT",$element) ;pass array $b1=IEAddButton($window,"Button1",10,0,50,25) $b2=IEAddButton($window,"Button2",70,0,50,25) $b3=IEAddButton($window,"Button3",130,0,50,25)
?"pause..." GET$k
$window.quit $window = 0 EXIT 1
;****************** ; -- Functions used ;****************** FUNCTION IECreateWindow($title,$left,$top,$width,$height, optional $html) $ie = createobject("internetexplorer.application") $ie.addressbar = 0 $ie.menubar = 0 $ie.toolbar = 0 $ie.statusbar = 0 $ie.top = $top $ie.left = $left $ie.width = $width $ie.height = $height $ie.navigate("about:blank") WHILE $ie.busy AND $ie.readystate <> 4 AND @error = 0 LOOP $ie.document.body.scroll = no IF $html $ie.document.write('$html') ELSE $ie.document.write('<title>$title</title>') ENDIF $ie.document.body.bgcolor = "threedface" $ie.document.body.border = "1px solid #cccccc" $iecreatewindow = $ie $ie.visible = 1 WHILE setfocus("$title") <> 0 LOOP ENDFUNCTION FUNCTION IEWrite($window,$text, optional $font, optional $size, optional $color, optional $clear) IF NOT $font $font='Verdana, Helvetica, sans-serif' ENDIF IF NOT $size $size='3' ENDIF IF NOT $color $color='#000000' ENDIF IF NOT $bgcolor $bgcolor='#ffffff' ENDIF $html = '<font size="$size" FACE="$font" color="$color">$text<br></font>' $window.document.write($html) WHILE $window.busy <> 0 AND @error = 0 LOOP ENDFUNCTION ;****************** FUNCTION IEComboBox($window,$title,$text,$element)
$html='<HTML><HEAD><TITLE>$title</TITLE></HEAD><BODY><BR>$text<BR> <OBJECT ID="ComboBox" WIDTH=200 HEIGHT=24 CLASSID="CLSID:8BD21D30-EC42-11CE-9E0D-00AA006002F3"> </object></body></html> ' $window.document.write('$html')
WHILE $window.busy <> 0 AND @error = 0 LOOP
$combobox = $ie.document.getelementbyid("combobox")
FOR EACH $element IN $elementarray $=$combobox.additem("$Element") NEXT
$combobox.value=$elementarray[0]
ENDFUNCTION ;****************** FUNCTION IEAddButton($window,$caption,$left,$top,$width,$height) DIM $button $button = $window.document.createelement("input") $button.type = "Button" $button.value = $caption $button.style.position = "Absolute" $button.style.pixeltop = $top $button.style.pixelleft = $left $button.style.pixelwidth = $width $button.style.pixelheight = $height $button = $window.document.body.appendchild($button) $ieaddbutton = $button ENDFUNCTION ;****************** FUNCTION IESetBackColor($window,$color) $window.document.body.bgcolor = $color ENDFUNCTION ;****************** FUNCTION IEInputBox($title, Optional $prompt, optional $ok, optional $cancel) DIM $click, $html, $window, $status, $click, $button, $box
IF NOT $prompt $prompt = "Please enter your password." ENDIF IF NOT $ok $ok = "OK" ENDIF IF NOT $cancel $cancel = "Cancel" ENDIF
$html = ' <html><head><title>$title</title><style> <!---body{ background-color: silver; color: black;font-family: tahoma, arial; font-size: 10pt; margin: 3px "input.tbox { border: lpx black solid;}td { font: 10pt tahoma; }---> </style></head> <body scroll=no > <table align=center> <form name=frm> <tr> <td align=right>$prompt </td> <td colspan=2><input id=input value="" class=tbox></td> </tr> <tr> <td><input id=ok type=button value=" $ok " onclick="frm.status.value=1"> <input type=hidden id=status name=status value=0></td> <td align=right><input id=cancel type=button value=" $Cancel " onclick="frm.status.value=2"></td> </tr> </form> </table></body></html>'
$window = IECreateWindow($title,100,100,300,130,$html) WHILE $window.busy AND $window.readystate <> 4 AND @error = 0 LOOP $window.document.getelementbyid("input").focus $status = $window.document.getelementbyid("status") $click = $window.document.getelementbyid("input") $button= 0 $box=0 WHILE @error = 0 AND $button = 0 $button=$status.value $box=$click.value SELECT CASE $button = "1" $ieinputbox = $box CASE $button = "2" $ieinputbox = "Cancel" ENDSELECT LOOP $window.quit $window="" ENDFUNCTION
Cool Stuff!
Kent
|