Page 1 of 1 1
Topic Options
#86043 - 2002-06-13 04:47 PM IE library update... still need some help
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
OK, These functions work OK now
  • Function IECreateWindow
  • Function IEWrite
  • Function IEInputBox
  • Function IESetBackColor
There is one problem with inputbox... if you just enter, instead of pressing the button, the form clears. Anyone know how work around / fix this?
code:
break on 
;$=setconsole("minimize")

$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")

$b1=IEAddButton($Window,"Button1",10,0,50,25)
$b2=IEAddButton($Window,"Button2",70,0,50,25)
$b3=IEAddButton($Window,"Button3",130,0,50,25)

$box1= IEInputBox("What is your name?", "Enter your name")
IEWrite($Window,"you entered $box1")
?"pause..." get$k

$window.quit
$window = 0
exit 1


;***********************************************************************************************
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 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 IEComboBox($Window,$title,$text,$ElementArray)

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

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#86044 - 2002-06-13 04:57 PM Re: IE library update... still need some help
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
if you want to mess with it, let me know and i'll email/messenger it to you.

It is way too much to reformat
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#86045 - 2004-09-03 06:32 PM Re: IE library update... still need some help
daltilio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 20
Did you every get this working fully?

Thank you.
Brian
_________________________
Brian

Top
#86046 - 2004-09-03 06:37 PM Re: IE library update... still need some help
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
kinda old script...
wonder what you wanted from it...
_________________________
!

download KiXnet

Top
#86047 - 2004-09-03 06:52 PM Re: IE library update... still need some help
daltilio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 20
I am looking for a GUI combobox. The only ones I found were the Excel based ones and the KixForms. Those really aren't viable options for me.

1. Not all machines have Excel
2. Since script will be used on machines other than in-house computers, installing kinxforms isn't an option. That is if you still have to register the DLL on the computer the script is running on.
_________________________
Brian

Top
#86048 - 2004-09-03 09:53 PM Re: IE library update... still need some help
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, you can register the dll per user too.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.126 seconds in which 0.098 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org