Page 1 of 2 12>
Topic Options
#51436 - 2000-09-14 04:39 PM New Logon Script Using OLE!
Anonymous
Unregistered


With all this discussion using KIX, IE, and OLE, I thought that I'd update the 'standard' logon script that everyone seems to have used from the KIX installation.

I even kept the beautiful green, yellow, and blue color scheme.

I will need help from some HTML experts, however.

In the Message Center box, I need to be able to update the text in a table cell. How can I do that without having to reload the whole page?

If someone can show me how to do that, then we can add the ever important progress bar to the screen as well!

Enjoy!

code:

break on


$false = 0
$true = -1
$WindowTop = 100
$WindowLeft = 100
$WindowWidth = 600
$WindowHeight = 460
$BackGround = "http://www.free-clip-art.net/backgrounds/background44_S.gif"

$NoHServerMsg = "Your group setup is incorrect. Please call the Help Desk"
$NoHServerTitle = "Logon Error!"

$Company = "Acme Corp."
$UserName = @USERID
$FullName = @FullName
$Priv = @Priv
$Wksta = @Wksta
$Domain = @Domain
$LServer = @LServer
$HServer = $LServer

GOSUB GetHServer

$StatusMessage = "Running Logon Script"

$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", "$WindowTop")
$nul = oleputproperty($ie, "left", "s", "$WindowLeft")
$nul = oleputproperty($ie, "height", "s", "$WindowHeight")
$nul = oleputproperty($ie, "width", "s", "$WindowWidth")
$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 htmllogon


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


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

sleep 5

;ENTER YOUR NETWORK COMMANDS HERE

;Object cleanup

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

EXIT

; --------------------------------------------------------------------
; Logon Script Subroutines
; Do not modify any lines below this!!!

;----------
:htmllogon
;----------


$html = '
<html>

<head>
<title>Welcome to the $Company Network</title>
</head>

<body background="$BackGround" bgcolor="#0000FF">
<div align="center"><center>

<table border="5" width="400" bgcolor="#000000"
bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#00FF00">
<tr>
<td><p align="center"><font color="#FFFFFF" size="4"><strong>Welcome
to the $Company Network</strong></font></p>
</td>
</tr>
</table>
</center></div>

<p> </p>
<div align="center"><center>

<table border="5" width="400" bgcolor="#000000"
bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#00FF00">
<tr>
<td><p align="left"><font color="#FFFFFF">User ID:</font></p>
</td>
<td><p align="left"><font color="#FFFF00"><strong>$UserName</strong></font></p>
</td>
</tr>
<tr>
<td><p align="left"><font color="#FFFFFF">Full Name:</font></p>
</td>
<td><font color="#FFFF00"><strong>$FullName</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Privilege:</font></td>
<td><font color="#FFFF00"><strong>$Priv</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Workstation:</font></td>
<td><font color="#FFFF00"><strong>$Wksta</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Domain:</font></td>
<td><font color="#FFFF00"><strong>$Domain</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Logon Server:</font></td>
<td><font color="#FFFF00"><strong>$LServer</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Home Server:</font></td>
<td><font color="#FFFF00"><strong>$HServer</strong></font></td>
</tr>
</table>
</center></div>

<p> </p>
<div align="center"><center>

<table border="5" width="400" bgcolor="#000000"
bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#00FF00">
<tr>
<td><font color="#FFFFFF"><strong>Message Center (100% Complete)</strong></font></td>
</tr>
<tr>
<td><font color="#FFFF00">$StatusMessage</font></td>
</tr>
</table>
</center></div>
</body>
</html>
'
return

;----------
:GetHServer
;----------
$s = instr(@COMMENT,"(")
$e = instr(@COMMENT,")")
$l = ($e - $s) - 1
if $s = 0
$HServer = $LServer
$Nul = MessageBox("$NoHServerMsg","$NoHServerTitle",16)
else
if $e > 0
$HSERVER = substr(@COMMENT,$s+1,$l)
else
goto nohome
endif
endif
return


Roneil

Top
#51437 - 2000-09-14 06:57 PM Re: New Logon Script Using OLE!
Shawn Administrator Offline
Administrator
*****

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


AWESOME - It's instructive on how you pulled in the background from some web site somewhere !

Here's how to update your mesage center, but now you need figure out how to change the tbox colors to "blend" in with your schema !


Might take a look at IE style sheets !

code:

break on


$false = 0
$true = -1
$WindowTop = 100
$WindowLeft = 100
$WindowWidth = 600
$WindowHeight = 460
$BackGround = "http://www.free-clip-art.net/backgrounds/background44_S.gif"
$NoHServerMsg = "Your group setup is incorrect. Please call the Help Desk"
$NoHServerTitle = "Logon Error!"
$Company = "Acme Corp."
$Welcome = "Welcome to the $Company Network"
$UserName = @USERID
$FullName = @FullName
$Priv = @Priv
$Wksta = @Wksta
$Domain = @Domain
$LServer = @LServer
$HServer = $LServer
GOSUB GetHServer
$StatusMessage = "Running Logon Script"
$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", "$WindowTop")
$nul = oleputproperty($ie, "left", "s", "$WindowLeft")
$nul = oleputproperty($ie, "height", "s", "$WindowHeight")
$nul = oleputproperty($ie, "width", "s", "$WindowWidth")
$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 htmllogon


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


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


;ENTER YOUR NETWORK COMMANDS HERE


$frmMessage = val ( "&" + olecallfunc ( $doc, "getElementById", "s", "frmMessage" ))


$percent = 25
while $percent < 100
$percent = $percent + 1
if ($percent & rnd () ) = 0 ; simulate activiity
sleep 1
endif
$nul = oleputproperty ( $frmMessage, "value", "s", "Message Center ($percent%) complete" )
loop


?"pause..." gets $k


;Object cleanup


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


EXIT
; --------------------------------------------------------------------
; Logon Script Subroutines
; Do not modify any lines below this!!!


;----------
:htmllogon
;----------


$html = '
<html>
<head>
<title>$Welcome</title>
</head>
<body background="$BackGround" bgcolor="#0000FF">
<div align="center"><center>
<table border="5" width="400" bgcolor="#000000"
bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#00FF00">
<tr>
<td><p align="center"><font color="#FFFFFF" size="4"><strong>$Welcome
</strong></font></p>
</td>
</tr>
</table>
</center></div>
<p> </p>
<div align="center"><center>
<table border="5" width="400" bgcolor="#000000"
bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#00FF00">
<tr>
<td><p align="left"><font color="#FFFFFF">User ID:</font></p>
</td>
<td><p align="left"><font color="#FFFF00"><strong>$UserName</strong></font></p>
</td>
</tr>
<tr>
<td><p align="left"><font color="#FFFFFF">Full Name:</font></p>
</td>
<td><font color="#FFFF00"><strong>$FullName</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Privilege:</font></td>
<td><font color="#FFFF00"><strong>$Priv</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Workstation:</font></td>
<td><font color="#FFFF00"><strong>$Wksta</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Domain:</font></td>
<td><font color="#FFFF00"><strong>$Domain</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Logon Server:</font></td>
<td><font color="#FFFF00"><strong>$LServer</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Home Server:</font></td>
<td><font color="#FFFF00"><strong>$HServer</strong></font></td>
</tr>
</table>
</center></div>
<p> </p>
<div align="center"><center>
<table border="5" width="400" bgcolor="#000000"
bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#00FF00">
<tr>
<td><strong><input type=tbox id=frmMessage size=80></strong></td>
</tr>
<tr>
<td><font color="#FFFF00">$StatusMessage</font></td>
</tr>
</table>
</center></div>
</body>
</html>
'
return
;----------
:GetHServer
;----------
$s = instr(@COMMENT,"(")
$e = instr(@COMMENT,")")
$l = ($e - $s) - 1
if $s = 0
$HServer = $LServer
$Nul = MessageBox("$NoHServerMsg","$NoHServerTitle",16)
else
if $e > 0
$HSERVER = substr(@COMMENT,$s+1,$l)
else
goto nohome
endif
endif
return


Shawn.

Top
#51438 - 2000-09-14 07:16 PM Re: New Logon Script Using OLE!
Shawn Administrator Offline
Administrator
*****

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

Found it - replace this:

code:

<td><strong><input type=tbox id=frmMessage size=80></strong></td>


with something like this:

code:

<td><strong><input type=tbox id=frmMessage size=80 style="background-color:#008080"></strong></td>


or this ...

code:

<td><strong><input type=tbox id=frmMessage size=80 style="background-color: rgb(255,0,0)"></strong></td>


Shawn.

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

Top
#51439 - 2000-09-14 09:15 PM Re: New Logon Script Using OLE!
Anonymous
Unregistered


Hey Shawn,

I also found a couple of things. Instead of using an input textbox, I assigned an ID just to the cell where the message goes. Then, I used the INNERHTML property to set the text within the cell. With this method, the since the text is in the cell, it looks the same as the rest of the page.

Here's the full code.

code:

break on


$false = 0
$true = -1
$WindowTop = 100
$WindowLeft = 100
$WindowWidth = 600
$WindowHeight = 460
$BackGround = "http://www.free-clip-art.net/backgrounds/background44_S.gif"
$NoHServerMsg = "Your group setup is incorrect. Please call the Help Desk"
$NoHServerTitle = "Logon Error!"
$Company = "Acme Corp."
$Welcome = "Welcome to the $Company Network"
$UserName = @USERID
$FullName = @FullName
$Priv = @Priv
$Wksta = @Wksta
$Domain = @Domain
$LServer = @LServer
$HServer = $LServer
$percent = 0
$Status = "Message Center ($percent% complete)"
GOSUB GetHServer

$StatusMessage = "Running Logon Script"
$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", "$WindowTop")
$nul = oleputproperty($ie, "left", "s", "$WindowLeft")
$nul = oleputproperty($ie, "height", "s", "$WindowHeight")
$nul = oleputproperty($ie, "width", "s", "$WindowWidth")
$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 htmllogon


$nul = olecallfunc($doc, "write", "s", "$html")
while setfocus("$welcome") <> 0 loop

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


;ENTER YOUR NETWORK COMMANDS HERE

$frmMessage = val ( "&" + olecallfunc ( $doc, "getElementById", "s", "frmMessage" ))
$frmStatus = val ( "&" + olecallfunc ( $doc, "getElementById", "s", "frmStatus" ))

;Finding Groups
$Percent = 25
$StatusMessage = "Find group membership..."
Gosub Progress

;Mapping Network Drives
$Percent = 50
$StatusMessage = "Mapping network drives..."
Gosub Progress

;Mapping Printers
$Percent = 75
$StatusMessage = "Connecting your printers..."
Gosub Progress

;Running SMS
$Percent = 90
$StatusMessage = "Running SMS now..."
Gosub Progress

;FinishUp
$Percent = 100
$StatusMessage = "Finishing logon script..."
Gosub Progress

?"pause..." gets $k


;Object cleanup


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


EXIT
; --------------------------------------------------------------------
; Logon Script Subroutines
; Do not modify any lines below this!!!


;----------
:htmllogon
;----------


$html = '
<html>
<head>
<title>$Welcome</title>
</head>
<body background="$BackGround" bgcolor="#0000FF" scroll="no">
<div align="center"><center>
<table border="5" width="400" bgcolor="#000000"
bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#00FF00">
<tr>
<td><p align="center"><font color="#FFFFFF" size="4"><strong>$Welcome
</strong></font></p>
</td>
</tr>
</table>
</center></div>
<p> </p>
<div align="center"><center>
<table border="5" width="400" bgcolor="#000000"
bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#00FF00">
<tr>
<td><p align="left"><font color="#FFFFFF">User ID:</font></p>
</td>
<td><p align="left"><font color="#FFFF00"><strong>$UserName</strong></font></p>
</td>
</tr>
<tr>
<td><p align="left"><font color="#FFFFFF">Full Name:</font></p>
</td>
<td><font color="#FFFF00"><strong>$FullName</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Privilege:</font></td>
<td><font color="#FFFF00"><strong>$Priv</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Workstation:</font></td>
<td><font color="#FFFF00"><strong>$Wksta</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Domain:</font></td>
<td><font color="#FFFF00"><strong>$Domain</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Logon Server:</font></td>
<td><font color="#FFFF00"><strong>$LServer</strong></font></td>
</tr>
<tr>
<td><font color="#FFFFFF">Home Server:</font></td>
<td><font color="#FFFF00"><strong>$HServer</strong></font></td>
</tr>
</table>
</center></div>
<p> </p>
<div align="center"><center>
<table border="5" width="400" bgcolor="#000000"
bordercolor="#008000" bordercolordark="#008080"
bordercolorlight="#00FF00">
<tr>
<td id=frmMessage innerhtml=$Status><font color="#FFFFFF"><strong>$Status</strong></font></td>
</tr>
<tr>
<td id=frmStatus innerhtml=$StatusMessage>$StatusMessage</font></td>
</tr>
</table>
</center></div>
</body>
</html>
'
return
;----------
:GetHServer
;----------
$s = instr(@COMMENT,"(")
$e = instr(@COMMENT,")")
$l = ($e - $s) - 1
if $s = 0
$HServer = $LServer
$Nul = MessageBox("$NoHServerMsg","$NoHServerTitle",16)
else
if $e > 0
$HSERVER = substr(@COMMENT,$s+1,$l)
else
goto nohome
endif
endif
return

;----------
:Progress
;----------

$Status = "Message Center ($percent% complete)"
$nul = oleputproperty ( $frmMessage, "innerhtml", "s", '<font color="#FFFFFF"><strong>$Status</strong></font>' )
$nul = oleputproperty ( $frmStatus, "innerhtml", "s", '<font color="#FFFF00">$StatusMessage</font>' )
sleep 1
return


Roneil


[This message has been edited by icatar (edited 14 September 2000).]

[This message has been edited by icatar (edited 14 September 2000).]

[This message has been edited by icatar (edited 15 September 2000).]

Top
#51440 - 2000-09-14 09:33 PM Re: New Logon Script Using OLE!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Oh man - BEAU-TI-FUL !

Talk about your dynamic HTML !

I'm going to try and modify my Service Browser to dynamically load the services drop-down !

Two things though...

1) Might want to get rid of your scroll-bar (<body scroll=no> )

2) Try to get the setfocus() to your logon window happenin' !

Shawn.

Top
#51441 - 2000-09-14 10:10 PM Re: New Logon Script Using OLE!
Anonymous
Unregistered


Allright! Did some 'final' modifications to make the code above more functional. I turned the Progress update into a subroutine that you can call in between commands that you run in the main logon script. This update also changes the actual status message.

I'm not sure what you mean with the setfocus() since my logon window is always on top anyway...

R

Top
#51442 - 2000-09-14 10:34 PM Re: New Logon Script Using OLE!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
playing arround with the OLE and Internet Explorer stuff.

Shawn and I discovered that internet.aplication was not always comming up to the top.

use this code to setfocus() to it.

code:

....
$nul = olecallfunc($doc, "write", "s", "$html")
while setfocus("$welcome") <> 0 loop
....

Bryce

Top
#51443 - 2000-09-15 12:14 AM Re: New Logon Script Using OLE!
Anonymous
Unregistered


Cool. Thanx for the info. Maybe that's a Windows 2000 thing.

When I tested the script at work on NT 4, the window always came to the top. When I went home and ran it on my W2K box, it didn't come to the top.

Anyway, the code is updated.

Thanx.

Roneil

Top
#51444 - 2000-09-18 02:57 PM Re: New Logon Script Using OLE!
Anonymous
Unregistered


The OLE login is awesome, and I am feverishly implementing it. A question, in the sample code posted, what is the "s" in the OLE calls? This does not seem to be documented in my manual (the latest version I can find seems to be for 3.61).

Example

oleputproperty($ie, "menubar", "s", "$false")

The manual only talks about 3 parameters.

Rob

[This message has been edited by Robdyer (edited 18 September 2000).]

Top
#51445 - 2000-09-18 03:30 PM Re: New Logon Script Using OLE!
Anonymous
Unregistered


Rob, Shawn does an awesome job describing the 's' here...
http://kixtart.org/board/Forum2/HTML/000609.html

Top
#51446 - 2000-09-18 05:47 PM Re: New Logon Script Using OLE!
Anonymous
Unregistered


Any chance of the new code with the statusmessage update being posted?

Rob

btw Thanks to 3mgrant5 for his helpful and not say instructuve reference to the "sss" problem.

Top
#51447 - 2000-09-18 06:44 PM Re: New Logon Script Using OLE!
Anonymous
Unregistered


The code above should update the status messages. Let me know if it is not updating the messages.
Top
#51448 - 2000-09-21 10:37 AM Re: New Logon Script Using OLE!
Anonymous
Unregistered


The Login scripts does'nt seem to work with IE 4.0. It fails with an access violation on the following line:-

$frmMessage = val ( "&" + olecallfunc ( $doc, "getElementById", "s", "frmMessage" ))

Any ideas?

Rob

[This message has been edited by Robdyer (edited 21 September 2000).]

Top
#51449 - 2000-09-22 12:59 AM Re: New Logon Script Using OLE!
Anonymous
Unregistered


If I try to test this script, I always get a logon error. Group setup not correct. What could be wrong here?????



Top
#51450 - 2000-09-21 03:30 PM Re: New Logon Script Using OLE!
Anonymous
Unregistered


Rob,

I haven't tested the script on IE4. Does it happen on all the machines with IE4 or just one. Have you tried it on IE5?

MB48,

Just rem out the statement that calls the GetHServer subroutine. This subroutine checks to see if you have a home server specified in your User Profile.

Roneil

Top
#51451 - 2000-09-21 04:09 PM Re: New Logon Script Using OLE!
Shawn Administrator Offline
Administrator
*****

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

Before this line:

$frmMessage = val ( "&" + olecallfunc ( $doc, "getElementById", "s", "frmMessage" ))


Insert this...

?"doc=$doc"

What's the value of $doc - zero ?

Shawn.

Top
#51452 - 2000-09-22 10:54 AM Re: New Logon Script Using OLE!
Anonymous
Unregistered


Shawn,

$doc is 1312980.

Roneil,

It seems to happen on all PCs with IE4. Maybe I'll just upgrade them all to IE55

Rob

Top
#51453 - 2000-09-22 02:14 PM Re: New Logon Script Using OLE!
Shawn Administrator Offline
Administrator
*****

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

Few questions...

1) What version IE4 - sp1 or sp2 ?

2) What version KiX ? Latest ?

3) Are you using the script posted here or have you customized it - if yes - please post.

I'm going to give Roneil's script a try on IE4 SP1, let you know later today !

Shawn.

Top
#51454 - 2000-09-22 03:02 PM Re: New Logon Script Using OLE!
Shawn Administrator Offline
Administrator
*****

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

OK - just tied Roneil's script with IE4 SP1 and the lastest version of KiX. No probs.

Must be running older version ?

My guess - pre 3.60 !

Shawn.

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

Top
#51455 - 2000-09-23 04:49 PM Re: New Logon Script Using OLE!
Anonymous
Unregistered


I use IE 5.5 and kix 3.62. So shouldn't be the problem.
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
1 registered (Allen) and 781 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.061 seconds in which 0.021 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