Page 1 of 1 1
Topic Options
#195661 - 2009-08-28 10:34 PM Script to include Message to End Users
Ken_Thomas Offline
Fresh Scripter

Registered: 2007-02-09
Posts: 6
We've been using Kixtart as our login script to map network drives for over 5 years now. The script rarely changes and is pretty basic. Here it is:

 Code:
; =====================================================
; ===========BEGIN DRIVE MAPPINGS======================
; =====================================================
;
;
; MAPS H: TO USER HOME DIRECTORY
	USE H: "\\FILE\HOME\%USERNAME%"
;
; MAPS K: TO SHARED DRIVE
	USE K: "\\FILE\SHARED"
;
; MAPS M: TO MAS90 DIRECTORY
	IF INGROUP("MAS90") = 1
		USE M: "\\FINANCE\SAGE"
	ENDIF
;
; MAPS N: TO "\\FILE\CREATIVESERVICES"
	IF INGROUP("CS") = 1
		USE N: "\\FILE\CREATIVESERVICES"
	ENDIF
;
; MAPS P: TO INSTALL DIRECTORY ON FILE SERVER
	IF INGROUP("Domain Admins") = 1
		USE P: "\\FILE\INSTALL"
	ENDIF
;
; MAPS R: TO ARCHTICS DIRECTORY
	IF INGROUP("ArchticsUsers") = 1
		USE R: "\\ARCHTICS\ARCHSHARE"
	ENDIF
;
; MAPS S: TO STONETIMBERRIVER DIRECTORY
	IF INGROUP("STRUsers") = 1
		USE S: "\\APP3\STONETIMBERRIVER"
	ENDIF
;
; MAPS W: TO SCARBOROUGH DIRECTORY ON APP3
	IF INGROUP("Scarborough") = 1
		USE W: "\\APP3\SCARBOROUGH"
	ENDIF
;
; =====================================================
; =============END DRIVE MAPPINGS======================
; =====================================================
;
EXIT


Not sure if that is the best way to map drives. It was in place before I got here. What I've wanted was sort of like a MOTD but it never changes or could be changed later. Right now when the script runs a small DOS box appears and then quickly dissapears. I would like the box to stay open and display a message like "Please leave your computers powered ON, but log OFF at the end of your day. Please also help save energy and the life of your monitor by powering it off when not in use. Thank you!" or "Server Maintenance tonight at 9PM". The text would be a bright yellow or something that they wouldn't easily over look. The box would also stay open until they "PRESS ANY KEY TO CONTINUE & ACKNOWLEGE" or something like that.

I've searched with my friend Google and also on here. The MOTD scripts people have talked about were more complex than my idea.

I'm open to suggestions and code examples.

Thanks in advance!
Ken


Edited by Glenn Barnas (2009-08-28 11:32 PM)
Edit Reason: fixed code tag

Top
#195665 - 2009-08-28 11:37 PM Re: Script to include Message to End Users [Re: Ken_Thomas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Welcome to KORG!

What you want is fairly easy. Create a message text file on a share somewhere that the users have read access to. You can employ the following code:
 Code:
; MOTD for all users
If Exist('\\server\share\motd_all.txt')
  Display '\\server\share\motd_all.txt'
  Sleep 4
EndIf
; MOTD for users of the XXX group
If InGroup('XXX')
  If Exist('\\server\share\motd_XXX.txt')
    Display '\\server\share\motd_XXX.txt'
    Sleep 4
  EndIf
EndIf
This displays the message file if it exists, delays a short time, and then displays messages if users are members of a specific group. The group-specific code can be repeated as many times as necessary to accomodate different groups.

You can use MessageBox() to pop up a box, or simply a
 Code:
"Press any key to confirm:"
Get $C
? 
code fragment to wait for an acknowledgement.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#195666 - 2009-08-29 02:38 AM Re: Script to include Message to End Users [Re: Glenn Barnas]
Ken_Thomas Offline
Fresh Scripter

Registered: 2007-02-09
Posts: 6
Wow, that was quick. Thanks a bunch Glenn. Although I couldn't get your suggestion to work. I kept getting an invaide Line 14 message. I did find my way to your website, and grabbed some code off of one of your demo kix files and implemented this. It works.

 Code:
  Color Y+/n	; use a bright color for demo so you can tell it's the external display script!

  'PLEASE REMEMBER TO LOG OUT, BUT LEAVE YOUR COMPUTER ON AT ' ? ?
  'THE END OF THE DAY. PLEASE ALSO TURN OFF YOUR MONITOR WHEN '? ?
  'NOT IN USE. THANK YOU! ' ?

  Color c+/n
  '' ?
  'Logon accepted for ' @FULLNAME ', validated by '@LSERVER ?
  ' with ' @PRIV ' access rights in the ' @DOMAIN ' domain.' ? ?
;  'OS Type: ' @PRODUCTTYPE ' / Version '  @DOS ?


  Color W+/n


"Press any key to continue:"
Get $C
? 


I would like to get get something like a salutation at the top to work with a time of day greeting that would be nice. Maybe too much? I found this but couldn't get it to work either.

 Code:
;prepare salutation
Select
Case Val("$hour") < 12
$Salutation = "Good Morning"

Case Val("$Hour") > 12 And Val("$Hour") < 18
$Salutation = "Good Afternoon"

Case Val("$Hour") > 18
$Salutation = "Good Evening"

At (4, 0) $salutation + " " + @FULLNAME



Thanks again. I now have what I've been wanting for a LONG time. Have a great weekend everyone!

Ken

Top
#195677 - 2009-08-29 05:29 PM Re: Script to include Message to End Users [Re: Ken_Thomas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Be careful using "AT" functions.. you need to keep track of where the cursor is, and should generally start with a clear screen. I tend to avoid it in login scripts..

My earlier example is untested - You'll need to take that as a coarse example and look at the manual to insure the syntax. I'm an instructor by trade, and expect my students to get their hands dirty after a good shove in the right direction. ;\) The use of external files for MOTD is much more flexible - you don't want to mess with the login script once its written. That's why our commercial script is tokenized and uses an external config file to define disk, printer, message, and command resources.

Since login scripts need to be fast and unobtrusive, I generally avoid MessageBox in favor of short delays when important messages are displayed. Without any message delays, our script can process over 40 resource decisions, then mapp 10-12 drives and 2-3 printers in under 4 seconds on a LAN, and under 12 seconds on a 256Kbps WAN link. This leaves plenty of time to display MOTD type messages.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


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

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.047 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

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