Page 1 of 2 12>
Topic Options
#51288 - 2000-09-04 01:24 AM OLE and Internet Explorer
Anonymous
Unregistered


With the recent post about the progress bar and the use of Internet Explorer to display information, would it be possible to capture responses to that information? I want to display a page that the user will be able to respond to (Through drop down boxes and the like) to gain some information about their location and what type of computer they have. This information would ideally then be captured through Kix.

Thanks

Top
#51289 - 2000-09-05 02:25 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
chroy:

The following is a relatively responsive user interface built using Internet Explorer 4+ common dialogs.

To run this, you should have Windows NT or Windows 2000 and have the following software installed on your workstation...

1) Internet Explorer 4+
2) MSAgent 2.5 Core Components
3) MSAgent "Merlin" character
4) MSAgent Text-to-speech engine

MSAgent downloads are here ...


http://msdn.microsoft.com/workshop/imedia/agent/agentdl.asp


This script presents the user with a "television" style remote control that will solicit input and control the speech and actions of our favorite MS Agent - "Merlin" (Sorry - I couldn't think of anything better to control" !


code:


break on


$false = 0
$true = -1
$agentname = "Merlin"
$agentpath = "%windir%\msagent\chars\$agentname.acs"
$agentcontrol = "agent.control.2"


$agent = olecreateobject ( "$agentcontrol" )
if $agent = 0
exit
endif


$ie = olecreateobject ( "internetexplorer.application" )
if $ie = 0
exit
endif


$rs = setconsole ( "minimize" )


$rs = oleputproperty ( $agent, "connected", "s", "1" )
$chars = val ( "&" + olegetproperty ( $agent, "characters" ))
$rs = olecallfunc ( $chars, "load", "ss", "$agentname", "$agentpath" )
$actor = val ( "&" + olecallfunc ( $chars, "character", "s", "$agentname" ))


$rs = oleputproperty ( $ie, "addressbar", "s", "$false" )
$rs = oleputproperty ( $ie, "menubar", "s", "$false" )
$rs = oleputproperty ( $ie, "toolbar", "s", "$false" )
$rs = oleputproperty ( $ie, "statusbar", "s", "$false" )
$rs = oleputproperty ( $ie, "resizeable", "s", "$false" )
$rs = oleputproperty ( $ie, "top", "s", "30" )
$rs = oleputproperty ( $ie, "left", "s", "150" )
$rs = oleputproperty ( $ie, "height", "s", "375" )
$rs = oleputproperty ( $ie, "width", "s", "175" )
$rs = olecallfunc ( $ie, "navigate", "s", "about:blank" )


while olegetproperty ( $ie, "busy" ) <> "0" loop


$doc = val ( "&" + olegetproperty ( $ie, "document" ))


$rs = olecallfunc ( $doc, "open" )


$html = '<html>' +
'<head><title>Agent Remote</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 onresize="window.resizeto(240,120);">'+
; Form
'<form name=remote>'+
'<input id=status name=stat type=hidden value=0>' +
'Message:<br>'+
'<input id=message name=message class=tbox '+
' value="Hello"><br><br>' +
'<input id=x type=button value=" Speak " '+
' onclick="remote.status.value=1">' +
'<input id=x type=button value=" Think " '+
' onclick="remote.status.value=2"><br><br>' +
'Distance:<br>'+
'<input id=distance name=distance class=tbox '+
' value="100"><br>' +
'Speed:<br>'+
'<input id=speed name=speed class=tbox '+
' value="50"><br><br>' +
'<input id=x type=button value=" Up " '+
' onclick="remote.status.value=3">' +
'<input id=x type=button value=" Down "'+
' onclick="remote.status.value=4"><br>' +
'<input id=x type=button value=" Left " '+
' onclick="remote.status.value=5">' +
'<input id=x type=button value=" Right " '+
' onclick="remote.status.value=6"><br><br>' +
'<input id=x type=button value=" Hide " '+
' onclick="remote.status.value=7">' +
'<input id=x type=button value=" Show " '+
' onclick="remote.status.value=8"><br><br>' +
'<input id=exit type=button value=" Exit " '+
' onclick="remote.status.value=99">' +
'</form>'+
'</body>'+
'</html>'


$rs = olecallfunc ( $doc, "write", "s", "$html" )


; Show Agent Remote Control ...


$rs = oleputproperty ( $ie, "visible", "s", "$true" )


; Show Agent ...


$rs = olecallfunc ( $actor, "show" )


while olegetproperty ( $ie, "busy" ) <> "0" loop


$oStatus = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "status" ) )
$oMessage = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "message" ) )
$oDistance = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "distance" ) )
$oSpeed = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "speed" ) )


; Enter command loop ...


while @error = 0


sleep 1


$mMessage = olegetproperty ( $oMessage, "value" )
$mLeft = val(olegetproperty ( $actor, "left" ))
$mTop = val(olegetproperty ( $actor, "top" ))
$mStatus = olegetproperty ( $oStatus, "value" )
$mSpeed = val(olegetproperty ( $oSpeed, "value" ))
$mDistance = val(olegetproperty ( $oDistance, "value" ))


select


case $mStatus = "1" ; SPEAK


$rs = olecallfunc ( $actor, "speak", "s", "$mMessage" )


case $mStatus = "2" ; THINK


$rs = olecallfunc ( $actor, "think", "s", "$mMessage" )


case $mStatus = "3" ; UP


$mTop = $mTop - $mDistance
$rs = olecallfunc ( $actor, "moveto", "sss", "$mLeft", "$mTop", "$mSpeed" )


case $mStatus = "4" ; DOWN


$mTop = $mTop + $mDistance
$rs = olecallfunc ( $actor, "moveto", "sss", "$mLeft", "$mTop", "$mSpeed" )


case $mStatus = "5" ; LEFT


$mLeft = $mLeft - $mDistance
$rs = olecallfunc ( $actor, "moveto", "sss", "$mLeft", "$mTop", "$mSpeed" )


case $mStatus = "6" ; RIGHT


$mLeft = $mLeft + $mDistance
$rs = olecallfunc ( $actor, "moveto", "sss", "$mLeft", "$mTop", "$mSpeed" )


case $mStatus = "7" ; HIDE


$rs = olecallfunc ( $actor, "hide" )


case $mStatus = "8" ; SHOW


$rs = olecallfunc ( $actor, "show" )


case $mStatus = "99" ; EXIT


goto finish


endselect


$rs = oleputproperty ( $oStatus, "value", "s", "0" )


loop


:finish


$rs = olereleaseobject ( $actor )
$rs = olereleaseobject ( $chars )
$rs = olereleaseobject ( $agent )


$rs = olecallfunc ( $ie, "quit" )
$rs = olereleaseobject ( $ie )


exit



Shawn.


[This message has been edited by Shawn (edited 05 September 2000).]

Top
#51290 - 2000-09-05 05:20 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Ok-

For those that don't want to get into this MSAgent business (thingy) - here's a "pure" IE script that will reset account passwords.

Well OK - it won't actually reset them yet - I'll be incorporating ADSI to do that later !

This version will just display the user commands in the dos box !

I could use some help though. How would one set the property of a tbox so that typed text is "hidden" like "*******" ? I'm sure it can be done. Any HTML wizards out there ?

code:


break on


$false = 0
$true = -1


$ie = olecreateobject ( "internetexplorer.application" )
if $ie = 0
exit
endif


; $rs = setconsole ( "minimize" )


$htmDialog = '<html>' +
'<head><title>Password Reset</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 onresize="window.resizeto(240,120);">'+
'<table align=center><form name=frm>'+
'<tr><td align=right>Domain: </td><td colspan=2 >'+
' <input id=domain name=domain value="%userdomain%" class=tbox></td></tr>' +
'<tr><td align=right>Username: </td><td colspan=2>'+
' <input id=username name=username value="%username%" class=tbox></td></tr>' +
'<tr><td align=right>Password: </td><td colspan=2>'+
' <input id=password type=password name=password value="password" class=tbox></td></tr>' +
'<tr><td align=right>Confirm: </td><td colspan=2>'+
' <input id=confirm type=password name=confirm value="confirmation" class=tbox></td></tr>' +
'<tr><td> </td><td>'+
'<input id=reset type=button value=" Reset "' +
' onclick="frm.status.value=1">'+
'<input type=hidden id=status name=status value=0></td>'+
'<td align=right> <input id=close type=button value=" Close "'+
' onclick="frm.status.value=2"> </td></tr>'+
'</form></table> ' +
'</body>'+
'</html>'


$rs = oleputproperty ( $ie, "addressbar", "s", "$false" )
$rs = oleputproperty ( $ie, "menubar", "s", "$false" )
$rs = oleputproperty ( $ie, "toolbar", "s", "$false" )
$rs = oleputproperty ( $ie, "statusbar", "s", "$false" )
$rs = oleputproperty ( $ie, "resizeable", "s", "$false" )
$rs = oleputproperty ( $ie, "top", "s", "100" )
$rs = oleputproperty ( $ie, "left", "s", "275" )
$rs = oleputproperty ( $ie, "height", "s", "200" )
$rs = oleputproperty ( $ie, "width", "s", "300" )
$rs = olecallfunc ( $ie, "navigate", "s", "about:blank" )


while olegetproperty ( $ie, "busy" ) <> "0" loop


$doc = val ( "&" + olegetproperty ( $ie, "document" ))


$rs = olecallfunc ( $doc, "open" )


$rs = olecallfunc ( $doc, "write", "s", "$htmDialog" )


$rs = oleputproperty ( $ie, "visible", "s", "$true" )


$oStatus = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "status" ) )
$oDomain = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "domain" ) )
$oUsername = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "username" ) )
$oPassword = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "password" ) )
$oConfirm = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "confirm" ) )


; Enter command loop ...


while @error = 0


sleep 1


$mStatus = olegetproperty ( $oStatus, "value" )


select


case $mStatus = "1"


gosub resetPassword


case $mStatus = "2"


goto finish


endselect


$rs = oleputproperty ( $oStatus, "value", "s", "0" )


loop


:finish


$rs = olecallfunc ( $doc, "close" )
$rs = olereleaseobject ( $doc )
$rs = olecallfunc ( $ie, "quit" )
$rs = olereleaseobject ( $ie )


exit


:resetPassword


?
?"domain = " olegetproperty ( $oDomain, "value" )
?"username = " olegetproperty ( $oUsername, "value" )
?"password = " olegetproperty ( $oPassword, "value" )
?"confirm = " olegetproperty ( $oConfirm, "value" )

return


Shawn.

[This message has been edited by Shawn (edited 05 September 2000).]

Top
#51291 - 2000-09-05 07:02 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Figured out the password thingy - I re-posted the above !

Shawn.

Top
#51292 - 2000-09-06 05:48 PM Re: OLE and Internet Explorer
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
hey Shawn this pure IE dialog box script.... I can't get it out of my mind! it is so cool!

I have been playing with it and thinking about making a small-footprint frontend for a database that a user wanting to put in place.

This user's original idea was to get IS to install MS Access on ALL! of the store computers (p75's, no cdrom's and a 56k connection back to corporate) just so that they could use a form/frontend for a database he wants to make.

But using kix/IE as a front end seems like a possible solution!

I have been playing around with placing the html into separate form files that would be called from the main script and used them to call other form/html files.

How would you write data from the script to an html form? let say i wanted to write something to the $oPassword of your example.

I really need to get a grasp on this OLE stuff .

Bryce

Top
#51293 - 2000-09-06 08:08 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Bryce:

Here's a script that echo's back to the form, the contents of a message box.

I've broken-out the html and script into seperate files, please change script pointer to your specifics.


[FILE: ECHO.HTM]

code:

<html>

<head><title>IeEcho</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>message: </td><td colspan=2 >
<input id=message name=message value="this is a string"
class=tbox></td></tr>
<tr><td align=right>echo: </td><td colspan=2>
<input id=echo name=echo value=""
class=tbox></td></tr>
<tr><td> </td><td>
<input id=echo type=button value=" Echo "
onclick="frm.status.value=1">
<input type=hidden id=status name=status value=0></td>
<td align=right><input id=close type=button value=" Close "
onclick="frm.status.value=2"></td></tr>
</form></table>
</body>
</html>


[FILE ECHO.KIX]

code:

break on


$htmlEcho = "m:\test\echo.htm"


$false = 0
$true = -1


$rs = setconsole ( "hide" )


$ie = olecreateobject ( "internetexplorer.application" )
if $ie = 0
exit
endif


; Set properties and display form ...


$rs = oleputproperty ( $ie, "addressbar", "s", "$false" )
$rs = oleputproperty ( $ie, "menubar", "s", "$false" )
$rs = oleputproperty ( $ie, "toolbar", "s", "$false" )
$rs = oleputproperty ( $ie, "statusbar", "s", "$false" )
$rs = oleputproperty ( $ie, "resizeable", "s", "$false" )
$rs = oleputproperty ( $ie, "top", "s", "100" )
$rs = oleputproperty ( $ie, "left", "s", "275" )
$rs = oleputproperty ( $ie, "height", "s", "125" )
$rs = oleputproperty ( $ie, "width", "s", "275" )
$rs = olecallfunc ( $ie, "navigate", "s", "$htmlEcho" )
$rs = oleputproperty ( $ie, "visible", "s", "$true" )


while olegetproperty ( $ie, "busy" ) <> "0" and @error = 0 loop


$rs = setfocus ( "IeEcho" ) ; it workie thx Bryce !


; Get a handle to the open document ...


$doc = val ( "&" + olegetproperty ( $ie, "document" ))


; Get a handle to the form controls ...


$oStatus = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "status" ) )
$oMessage = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "message" ) )
$oEcho = val ( "&" + olecallfunc ( $doc, "GetElementById", "s", "echo" ) )


; Enter message loop ...


while @error = 0


sleep 1


; Get the valueof the status control ...


$mStatus = olegetproperty ( $oStatus, "value" )


select


case $mStatus = "1"


; Get the message value ...


$mMessage = olegetproperty ( $oMessage, "value" )


; Pipe it to the echo control ...


$rs = oleputproperty ( $oEcho, "value", "s", "$mMessage" )


case $mStatus = "2"


goto finish


endselect


; Reset the status value to zero ...


$rs = oleputproperty ( $oStatus, "value", "s", "0" )


loop


:finish


; Object cleanup ...


$rs = olecallfunc ( $doc, "close" )
$rs = olereleaseobject ( $doc )
$rs = olecallfunc ( $ie, "quit" )
$rs = olereleaseobject ( $ie )


$rs = setconsole ( "show" )


$rs = setconsole ( "foreground" )


exit



Shawn.

[This message has been edited by Shawn (edited 06 September 2000).]

Top
#51294 - 2000-09-06 08:41 PM Re: OLE and Internet Explorer
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Thanks for the comments!!! having those in there really helped me out!


I reworked the message loop part to get rid of the sleep 1, it was making for slow response time, basically reset the $oStatus handle back to 0 when you are done with it while you are still in the select case.

code:

; Enter message loop ...

while @error = 0
;sleep 1
; Get the valueof the status control ...
$mStatus = olegetproperty ( $oStatus, "value" )

select
case $mStatus = "1"
; Get the message value ...
$mMessage = olegetproperty ( $oMessage, "value" )
; Pipe it to the echo control ...
$rs = oleputproperty ( $oEcho, "value", "s", "$mMessage" )
; Reset the status value to zero ...
$rs = oleputproperty($oStatus, "value", "s", "0" )
case $mStatus = "2"
goto finish
endselect
loop



Bryce

Top
#51295 - 2000-09-06 08:47 PM Re: OLE and Internet Explorer
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
You know, I think Shawn has just found a way to create custom dialog boxes for kix!

Would this stuff work with a win9x box? any one care to try!


Bryce

Top
#51296 - 2000-09-06 08:54 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Bryce:

I re-posted the echo script with some improved windows management "features".

Why can't I get KiX to set initial focus to the dialog box ?

Yeah, comments help.

I'm such a doh-head for not commenting any of this stuff. Will strive to improve in that regard !

Is it starting to "click" yet - me thinks in your case - it is !

By the way, if if you remove the sleep 1 from the script, the application becomes more responsive but at the cost of CPU utilization.

Run task manager while "dialoging" to see for yourself. KiX needs more granularity in it's sleep command, example sleep 0.100 (milliseconds).


Shawn.

Top
#51297 - 2000-09-06 09:03 PM Re: OLE and Internet Explorer
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Yes the OLE stuff is starting to click! at least for now. i guess the hard part about ole is finding the bits that are useful.


I see what you mean about the CPU

89% 1160 121561 2306048 974848 0:00:10.054 KIX32.EXE

why kix! you little hog!

Bryce

[This message has been edited by Bryce (edited 06 September 2000).]

Top
#51298 - 2000-09-06 09:13 PM Re: OLE and Internet Explorer
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
place the setfocus() command here

code:

while olegetproperty ( $ie, "busy" ) <> "0" and @error = 0 loop
$rs = setfocus ( "IeEcho" ) ; why not workie ?

Bryce

Top
#51299 - 2000-09-06 09:26 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
DOH !!!

[Shawn sheepishly reposts above]

Shawn.

Top
#51300 - 2000-09-06 09:45 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
We still haven't heard back from chroy !

chroy !

Calling chroy !!!

Are you still with us ?

Shawn.

[This message has been edited by Shawn (edited 06 September 2000).]

Top
#51301 - 2000-09-08 01:07 AM Re: OLE and Internet Explorer
Anonymous
Unregistered


Thanks for the info. This is just what I am after! I have been doing some testing with it and generally it has been good. (The script hung on a computer running IE 3 so I am writing a switch to detect this) I am working with the Unix and NT Administrators to put a back end in place that allows the user to changes their passwords on any of our 7 or so systems. I'll keep you posted on the progress.

Thanks

PS I actually feel this will be a very useful tool, I had always wanted to provide a GUI interface for Kix and wanted a better way to enter information then via the black box. Our company logo looks far better in the form of a pic then in ASCII. This is a fantastic effort on Shawn's behalf.

Top
#51302 - 2000-09-08 03:45 AM Re: OLE and Internet Explorer
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX

quote:

This is a fantastic effort on Shawn's behalf.


You can say that again!!!

Shawn where/how do you find out all what is avaliable with IE/OLE commands?

Bryce

Top
#51303 - 2000-09-08 04:03 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Guys:

I gave Rollo a headstart with researching OLE in this thread...

Use the IE OLE for input to a CSV---

It's really nice to hear your comments and see some enthusiasm for OLE Automation

Thanks again.

Shawn.

[This message has been edited by Shawn (edited 08 September 2000).]

Top
#51304 - 2000-09-08 10:52 PM Re: OLE and Internet Explorer
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
here is a dropdown example.

code:

break on


$htmlform = @curdir + "\dropdown.html"
$csv = @curdir + "\SIB.csv"
$cr = chr(13) + chr(10)
gosub html


$false = 0
$true = -1


$ie = olecreateobject("internetexplorer.application")
if $ie = 0 exit endif


; Set properties and display form ...


$nul = oleputproperty($ie, "addressbar","s","$false")
$nul = oleputproperty($ie, "menubar", "s", "$false")
$nul = oleputproperty($ie, "toolbar", "s", "$false")
$nul = oleputproperty($ie, "statusbar", "s", "$false")
$nul = oleputproperty($ie, "resizable", "s", "$false")
$nul = oleputproperty($ie, "top", "s", "100")
$nul = oleputproperty($ie, "left", "s", "200")
$nul = oleputproperty($ie, "height", "s", "165")
$nul = oleputproperty($ie, "width", "s", "275")
$nul = oleputproperty($ie, "visible", "s", "$true")
$nul = olecallfunc($ie, "navigate", "s", "about:blank")


while olegetproperty($ie, "busy") <> "0" and @error = 0 loop


; Get a handle to the open document ...
$doc = val("&" + olegetproperty($ie, "document"))
$nul = olecallfunc($doc, "write", "s", "$htmlform")
while setfocus("Dropdown Menu") <> 0 loop ;-------------------------This now works!!!


; Get a handle to the form controls ...
$oStatus = val("&" + olecallfunc($doc,"GetElementById","s","status"))
$oDropdown = val("&" + olecallfunc($doc, "GetElementById","s","dropdown"))

; Main Command Loop
while @error = 0
; Get the valueof the status control ...
$mStatus = olegetproperty ( $oStatus, "value" )
select
case $mStatus = "1"
; Submit was clicked
; Get the Fullname value / clear form...
$dropdown = olegetproperty($oDropdown, "value")
? $dropdown


; Reset the status value to zero ...
$nul = oleputproperty($oStatus,"value","s","0")


case $mStatus = "2"
;close was clicked.
goto finish
endselect
loop


:finish


; Object cleanup ...
$nul = olecallfunc ( $doc, "close" )
$nul = olereleaseobject ( $doc )
$nul = olecallfunc ( $ie, "quit" )
$nul = olereleaseobject ( $ie )
$nul = setconsole ( "show" )
$nul = setconsole ( "foreground" )


exit


:HTML
$htmlform = '<html>' + $cr +
'<head><title>Dropdown Menu</title>' + $cr +
'<style><!---body{ background-color: silver; color: black;' + $cr +
' font-family: tahoma, arial; font-size: 10pt; margin: 3px "' + $cr +
' input.tbox { border: lpx black solid;}' + $cr +
' td { font: 10pt tahoma; }' + $cr +
' ---></style>' + $cr +
'</head>' + $cr +
'<body scroll=no>' + $cr +
'' + $cr +
'<form name=frm>' + $cr +
'<SELECT Id=dropdown>' + $cr +
' <OPTION value=nul>--- Select An Option ---</OPTION>' + $cr +
' <OPTION value=Option1>Option1</OPTION>' + $cr +
' <OPTION value=Option2>Option2</OPTION>' + $cr +
' <OPTION value=Option3>Option3</OPTION>' + $cr +
' <OPTION value=Option4>Option4</OPTION>' + $cr +
' <OPTION value=Option5>Option5</OPTION>' + $cr +
' <OPTION value=Option6>Option6</OPTION>' + $cr +
' <OPTION value=Option7>Option7</OPTION>' + $cr +
' <OPTION value=Option8>Option8</OPTION>' + $cr +
' <OPTION value=Option9>Option9</OPTION>' + $cr +
' <OPTION value=Option10>Option10</OPTION>' + $cr +
' <OPTION value=Option11>Option11</OPTION>' + $cr +
' <OPTION value=Option12>Option12</OPTION>' + $cr +
'</SELECT>' + $cr +
'<input type=hidden id=status value=0><p>' + $cr +
'<input id=enter type=button value=" Submit " onclick="frm.status.value=1">' + $cr +
'<input id=close type=button value=" Close " onclick="frm.status.value=2">' + $cr +
'</form></body>' + $cr +
'</html>' + $cr

return


[This message has been edited by Bryce (edited 08 September 2000).]

[This message has been edited by Bryce (edited 11 September 2000).]

Top
#51305 - 2000-09-11 03:40 PM Re: OLE and Internet Explorer
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
I just fixed the problem with not giving focus to the dropdown box

while setfocus("Dropdown Menu") <> 0 loop

I have updated the dropdown example.

Bryce

Top
#51306 - 2000-09-11 05:28 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Bryce:

Excellent !

I went and read myself an HTML book over the weekend - "a truly dangerous thing" This HTML stuff is actually quite straight-forward. I can see now how to "minimize" the HTML using certain browser assumptions and defaults (ie Tables <tr><td> blah blah ).

And - I think we've got ourselves a way to embed HTML into our scripts without all the 'stuff'+'blahblah' crap.

Check it out. I don't think it causes KiX any trouble, but ???

Plus - I added some radio buttons.

I especially liked the way you subroutined the HTML...

code:

break on


$false = 0
$true = -1


$ie = olecreateobject("internetexplorer.application")
if $ie = 0 exit endif


; Set properties and display form ...


$nul = oleputproperty($ie, "addressbar","s","$false")
$nul = oleputproperty($ie, "menubar", "s", "$false")
$nul = oleputproperty($ie, "toolbar", "s", "$false")
$nul = oleputproperty($ie, "statusbar", "s", "$false")
$nul = oleputproperty($ie, "resizable", "s", "$false")
$nul = oleputproperty($ie, "top", "s", "100")
$nul = oleputproperty($ie, "left", "s", "200")
$nul = oleputproperty($ie, "height", "s", "300")
$nul = oleputproperty($ie, "width", "s", "350")
$nul = olecallfunc($ie, "navigate", "s", "about:blank")


while olegetproperty($ie, "busy") <> "0" and @error = 0 loop


; Get a handle to the open document ...


$doc = val("&" + olegetproperty($ie, "document"))


gosub htmlsurvey


$nul = olecallfunc($doc, "write", "s", "$html")


$nul = oleputproperty($ie, "visible", "s", "$true")


while olegetproperty($ie, "busy") <> "0" and @error = 0 loop


while setfocus("SURVEY") <> 0 loop


; Get a handle to the form controls ...


$oStatus = val("&" + olecallfunc($doc,"getElementById","s","status"))
$oName = val("&" + olecallfunc($doc,"getElementById","s","name"))
$oSex = val("&" + olecallfunc($doc, "getElementById","s","sex"))
$oIncome = val("&" + olecallfunc($doc, "getElementById","s","income"))


; Start message loop ...


while @error = 0


; Get the valueof the status control ...


$mStatus = olegetproperty ( $oStatus, "value" )


select


case $mStatus = "1"


?
?"Name = " olegetproperty ( $oName, "value" )
?"Sex = " olegetproperty ( $oSex, "value" )
?"Income = " olegetproperty ( $oIncome, "value" )


$nul = oleputproperty($oStatus,"value","s","0")


case $mStatus = "2"


goto finish


endselect


loop


:finish


; Object cleanup ...

$nul = olecallfunc ( $doc, "close" )
$nul = olereleaseobject ( $doc )
$nul = olecallfunc ( $ie, "quit" )
$nul = olereleaseobject ( $ie )


$nul = setconsole ( "show" )
$nul = setconsole ( "foreground" )


exit


;----------
:htmlsurvey
;----------


$html = '

<html>

<head>
<style>
<!---body {
background-color: powderblue; color: black;
font-family: courier; font-size: 10pt; margin: 3px
input.tbox { border: lpx black solid;}
td { font: 10pt tahoma; }
}
--->
</style>
</head>

<title>

SURVEY

</title>

<body scroll=no>

<form name=survey>

<input type=hidden id=status name=status value=0>
<input type=hidden id=sex name=sex value=1>

<b><h2 align=center>KIXTART SURVEY</h2></b>

<pre>

Name: <input type=text id=name name=name size=32 maxlength=80 value="%username%">
Sex: <input type=radio name=sx onclick="survey.sex.value=1"> Male
<input type=radio name=sx onclick="survey.sex.value=2"> Female
Income: <select id=income name=income size=1>
<option value=1>Under $25,000
<option value=2>$25,001 to $50,000
<option value=3>50,001 and higher
</select>
</pre>

<br>
<hr>
<table align=center>
<input id=submit type=button value="Submit" onclick="survey.status.value=1">
<input id=close type=button value="Close" onclick="survey.status.value=2">
</table>

<hr>

</form>

</body>
</html>
'

return


Shawn.

sh*t - I gotta go back to double-spacing my scripts !


[This message has been edited by Shawn (edited 11 September 2000).]

Top
#51307 - 2000-09-11 06:12 PM Re: OLE and Internet Explorer
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Made some minor changes to above and changed the background color to a lovely shade of "Powder Blue"

Either that or "Misty Rose", but I thought Powder Blue better hi-lighted my brown eyes, gray hair !

Shawn.


[This message has been edited by Shawn (edited 11 September 2000).]

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 1247 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.07 seconds in which 0.026 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