Page 1 of 1 1
Topic Options
#150259 - 2005-10-19 10:42 PM fnMapped not working...
michaeli Offline
Fresh Scripter

Registered: 2005-10-18
Posts: 14
Loc: Tucson,AZ
I am trying to use the UDF "fnMapped" function to no avail.
I am new to the UDF world and am probably missing something....
I am including some lines of script for review. Only the "fnMapped" portion is failing. Any ideas?

;---------------------- MAPPED DRIVE ERROR CHECKING -------------------------
;
;USE L: /DELETE ;(FOR DEBUGGING)
;
$DL="F:\"
IF EXIST ("F:\") GOSUB "CHECKG" ELSE GOTO "ERROR" ENDIF
;
:CHECKG
$DL="G:\"
IF EXIST ("G:\") GOSUB "CHECKG2" ELSE GOTO "ERROR" ENDIF
;
:CHECKG2
fnMapped(\\ADMIN\COMMON) ?
IF fnMapped(\\ADMIN\COMMON)=(G:\) GOSUB "CHECKH" ELSE GOTO "MISDIRECT" ENDIF
;
:CHECKH
$DL="H:\"
IF EXIST ("H:\") GOSUB "CHECKI" ELSE GOTO "ERROR" ENDIF
;
:CHECKI
$DL="I:\"
IF EXIST ("I:\") GOSUB "LOGON" ELSE GOTO "ERROR" ENDIF
;
;
;---------------------- MESSAGE BOX PROMPTED TO USER ------------------------
;
:MISDIRECT
BEEP
MESSAGEBOX
("Your login to the SUSD Network has reported an error."
+ CHR(10) + "Some network resources may not be available."
+ CHR(10) + "Your $DL network drive did not connect correctly."
+ CHR(10) + "Please report this to your I.T. Department."
+ CHR(10) + "Your account has been validated by @LSERVER."
+ CHR(10) + "The time is @DAY, @TIME, @DATE."
+ CHR(10) + " Have a nice day ;o) !!"
+ CHR(10) + "", "Sunnyside USD #12 - ERROR - $DL Drive Failed to Connect", 48, 45)
GOSUB "END"
;
:ERROR
BEEP
MESSAGEBOX
("Your login to the SUSD Network has reported an error."
+ CHR(10) + "Some network resources may not be available."
+ CHR(10) + "Your $DL network drive did not connect correctly."
+ CHR(10) + "Please report this to your I.T. Department."
+ CHR(10) + "Your account has been validated by @LSERVER."
+ CHR(10) + "The time is @DAY, @TIME, @DATE."
+ CHR(10) + " Have a nice day ;o) !!"
+ CHR(10) + "", "Sunnyside USD #12 - ERROR - $DL Drive Missing", 48, 45)
GOSUB "END"
;
;
;
;
:LOGON
MESSAGEBOX
("Welcome to the Sunnyside USD Computer Network."
+ CHR(10) + "Your account has been validated by @LSERVER."
+ CHR(10) + "The time is @DAY, @TIME, @DATE."
+ CHR(10) + " Have a nice day ;o) !!!",
"Sunnyside USD #12 - LOGIN SUCCESSFUL !!!", 64, 45)
;
:END
;----------- TELLS THE SCRIPT INTERPRETER THAT THE SCRIPT IS DONE -----------
COOKIE1
EXIT
;
; UDF DEFINITIONS
;---fnMapped---
Function fnMapped($sUNC)
Dim $oDrives,$oDrive
$oDrives = CreateObject("Scripting.FileSystemObject").Drives
If Not VarType($oDrives) & 9 Exit 1 EndIf
For Each $oDrive in $oDrives
If $oDrive.DriveType = 3 AND $sUNC = $oDrive.ShareName
$fnMapped = $oDrive.DriveLetter + ":"
EndIf
Next
EndFunction


Edited by michaeli (2005-10-19 11:00 PM)

Top
#150260 - 2005-10-19 10:57 PM Re: fnMapped not woring...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
lets start with the rules...
string always inside quotes.
so, this:
Code:

fnMapped(\\ADMIN\COMMON) ?
IF fnMapped(\\ADMIN\COMMON)=(G:\) GOSUB "CHECKH" ELSE GOTO "MISDIRECT" ENDIF



should be:
Code:

fnMapped("\\ADMIN\COMMON") ?
IF fnMapped("\\ADMIN\COMMON")="G:\" GOSUB "CHECKH" ELSE GOTO "MISDIRECT" ENDIF

_________________________
!

download KiXnet

Top
#150261 - 2005-10-19 11:11 PM Re: fnMapped not woring...
michaeli Offline
Fresh Scripter

Registered: 2005-10-18
Posts: 14
Loc: Tucson,AZ
Thank you ...(sigh)...I've been looking at it too long now.
Still no success though....I ran debug and it does not see a problem but the function(UDF)simply does not run..?
I have appended(pasted from source)the UDF in question to bottom of my script and saved. Is there another step? Insatallation of some kind that I am missing?

Top
#150262 - 2005-10-19 11:13 PM Re: fnMapped not woring...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
What version @KiX?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#150263 - 2005-10-19 11:26 PM Re: fnMapped not woring...
michaeli Offline
Fresh Scripter

Registered: 2005-10-18
Posts: 14
Loc: Tucson,AZ
4.51.0.0
I believe the newest...

Top
#150264 - 2005-10-20 01:34 AM Re: fnMapped not woring...
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
fnMapped() returns the driver letter without the forward slash ('G:').
Top
#150265 - 2005-10-20 01:59 AM Re: fnMapped not working...
michaeli Offline
Fresh Scripter

Registered: 2005-10-18
Posts: 14
Loc: Tucson,AZ
Affirmative, I just discovered that by noticing the output echoed back to the screen was G: as opposed to G:\ and through various changes in repetition.
You are right on the money. And it works nicely at this point.
Thank you for all your input.
An isolated section of script looks as follows:
;fnMapped("\\ADMIN\NOGROUP$") ? ;(Uncomment to echo drive letter output to window.)
IF NOT fnMapped("\\ADMIN\NOGROUP$") = (G:) GOSUB "CHECKH" ELSE GOTO "MISDIRECT" ENDIF

Thanks again,

Michael

Top
#150266 - 2005-10-20 06:47 AM Re: fnMapped not working...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no.
G: is a string.
this is not perl but kixtart.

thus:
IF NOT fnMapped("\\ADMIN\NOGROUP$") = "G:" GOSUB "CHECKH" ELSE GOTO "MISDIRECT" ENDIF

or even:
IF fnMapped("\\ADMIN\NOGROUP$") <> "G:" GOSUB "CHECKH" ELSE GOTO "MISDIRECT" ENDIF

or even better:
IF fnMapped("\\ADMIN\NOGROUP$") <> "G:"
GOSUB "CHECKH"
ELSE
GOTO "MISDIRECT"
ENDIF

and best would be to get rid of all those goto's
_________________________
!

download KiXnet

Top
#150267 - 2005-10-20 09:08 AM Re: fnMapped not working...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Even better, use the SetOptions and do away with the GOTO routines.

If he posts more of his code I'm sure we could easily help him eliminate all the GOTO code and have a more solid script.

Top
#150268 - 2005-10-21 12:43 AM Script needs general review.
michaeli Offline
Fresh Scripter

Registered: 2005-10-18
Posts: 14
Loc: Tucson,AZ
OK, I am just going to post the script entirely here and the let you guys have a look at it. Anything you'll can do to help, I'm all ears. Yes I know the code is a bit cavemanish but, I've been trying to teach myself....
The script does work correctly, but I'm sure is not very graceful in motion...

Here it is:
-------------------------------------------------------------------------------
; DOADMIN.KIX
;
; Logon Script for SUSD
;
;
;
;
; Script Author: Michael Ingrando
; Date: 10-21-05
;
;------- OVERWRITE THIS SECTION TO KEEP THE LAST KNOWN EDITOR CURRENT -------
;
; Last Modified by:
; Date:
;
;DEBUG ON ;(Uncomment for debugging feature)
;
;------------------------ CANCEL SCRIPT IF SERVER ---------------------------
;
IF @wksta = "ADM-DC1" OR
@wksta = "ADM-PRT" OR
@wksta = "ADMIN-DO" OR
@wksta = "ADM-GHT" OR
@wksta = "ADMIN" OR
@wksta = "ADMIN-IT" OR
@wksta = "ADMININET" OR
@wksta = "HMSQ"
;
COOKIE1 EXIT ENDIF
;
;
;--------------------- PROGRESS DIALOG BOX PRESENTED ------------------------
;
CLS
SMALL
$TopLeftRow = 0
$TopLeftCol = 0
$BtmRtRow = 30 ;Height
$BtmRtCol = 80 ;Width
;
Color c/c
BOX($TopLeftRow, $TopLeftCol, $BtmRtRow, $BtmRtCol, SINGLE)
;
Color r/c+
AT(10, 10) "Please Standby While Network Resources are Established..."
Sleep 1
;
Color n/c
AT(13,18) "Reviewing User Account Information.........."
Sleep 1
;
;
;
;------------------------------ SET VARIBLES --------------------------------
; ****** Notice: Always put quotes around all strings. ******
;
$AMN ="\\ADMIN"
$ADO ="\\ADMIN-DO"
$ADG ="\\ADM-GHT"
$DC1 ="\\ADM-DC1"
$AIN ="\\ADMININET"
$PRT ="\\ADM-PRT"
$ITS ="\\ADMIN-IT"
$HSQ ="\\HMSQ"
;
$Common = $AMN + "\Common"
$Apps = $AMN + "\Apps"
$Nurses = $HSQ + "\Nurses$"
$Itshare = $ITS + "\It-Share$"
$FOOD = $AMN + "\Food Services$"
;
;----------- SET GROUPSHARE VARIABLE (Based on group membership.) -----------
; DEFAULT $GroupShare to NOGROUP$ to prevent script from crashing on assumed variable!
; (THE EFFECT OF MULTIPLE MEMBERSHIP IS THE LAST MAPPING TAKES PRECEDENCE.)
;
$GroupShare = $AMN + "\NOGROUP$"
;
;
IF INGROUP ("Business & Finance") $GroupShare= $AMN + "\Business & Finance$" ENDIF
;
IF INGROUP ("Career Ladder") $GroupShare= $AMN + "\Career Ladder$" ENDIF
;
IF INGROUP ("Curriculum") $GroupShare= $AMN + "\Curriculum & Instruction$" ENDIF
;
IF INGROUP ("Domain Admins") $GroupShare= $ITS + "\Infotech$" ENDIF
;
IF INGROUP ("Educational Services") $GroupShare= $AMN + "\Educational Services$" ENDIF
;
IF INGROUP ("Food Services") $GroupShare= $AMN + "\Food Services$" ENDIF
;
IF INGROUP ("INFOTECH") $GroupShare= $ITS + "\InfoTech$" ENDIF
;
IF INGROUP ("Language Aquisition") $GroupShare= $AMN + "\Language Aquisition$" ENDIF
;
;IF INGROUP ("Leadership Developement") $GroupShare= $AMN + "\Leadership Developement$" ENDIF
;
IF INGROUP ("MAINTENANCE") $GroupShare= $AMN + "\Maintenance$" ENDIF
;
IF INGROUP ("MultiMedia Services") $GroupShare= $AMN + "\MultiMedia Services$" ENDIF
;
IF INGROUP ("Native American Edu") $GroupShare= $AMN + "\Native American Edu$" ENDIF
;
IF INGROUP ("Operations") $GroupShare= $AMN + "\Curriculum & Instruction$" ENDIF
;
IF INGROUP ("Personnel Services") $GroupShare= $AMN + "\Personnel Services$" ENDIF
;
IF INGROUP ("Public Relations") $GroupShare= $AMN + "\Public Relations$" ENDIF
;
IF INGROUP ("Purchasing Property Control") $GroupShare= $AMN + "\Purchasing Property Control$" ENDIF
;
IF INGROUP ("Research Evaluation") $GroupShare= $AMN + "\Research Evaluation$" ENDIF
;
IF INGROUP ("Special Services") $GroupShare= $AMN + "\Special Services$" ENDIF
;
IF INGROUP ("Staff Development") $GroupShare= $AMN + "\Staff Development$" ENDIF
;
IF INGROUP ("Student Services") $GroupShare= $AMN + "\Student Services$" ENDIF
;
IF INGROUP ("Superintendent") $GroupShare= $AMN + "\Superintendent$" ENDIF
;
IF INGROUP ("Title I") $GroupShare= $AMN + "\Title I$" ENDIF
;
IF INGROUP ("TRANSPORTATION") $GroupShare= $AMN + "\TRANSPORTATION$" ENDIF
;
;
;------------------ CONTINUE PREVIOUS PROGRESS DIALOG BOX -------------------
;
AT(16,22) "Thank You, Login will continue....."
Sleep 1
CLS
;
;---------------------------- MAP GLOBAL DRIVES -----------------------------
;
Color n/c
AT (1,14) "Mapping District Standard Global Network Drives......"
SLEEP 1
;
;----------- MAP STANDARD DRIVES FOR ALL SITES (Global Mappings) ------------
;
USE F: $Apps
;
USE G: $GroupShare
;
USE I: $Common
;
IF INGROUP ("Nurses") USE N: $Nurses ENDIF
;
IF INGROUP ("Domain Admins") USE O: $Itshare ENDIF
;
IF INGROUP ("Food Services") USE W: $Food ENDIF
;
;
;
;------- THE NEXT MAPPINGS PORTION OF THE SCRIPT IS UNIQUE TO THE SITE ------
;
;----------------------------- MAP LOCAL DRIVES -----------------------------
;
Color n/c
AT (3,14) "Mapping Site-Based Local Network Drives.............."
SLEEP 1
;
;
;------------------ MAP SITE OR APPLICATION SPECIFIC DRIVES -----------------
;
;IF INGROUP ("Domain Users") USE M: ENDIF
;
;
;-------------------------- MAP CDROM TOWER DRIVES --------------------------
;------------------------ (NOT IN USE AT THIS TIME) -------------------------
;
;
;------------------ END UNIQUE MAPPINGS PORTION OF SCRIPT -------------------
;
;
;
;------------------------------- CHECK UPDATES ------------------------------
;
Color n/c
AT (5,14) "Checking for Updates and Configuration Changes......."
SLEEP 1
;
;----------------------- CREATE UPDATES IN THIS SECTION ---------------------
;
;----------------------- REGISTRY MODIFICATION SECTION ----------------------
;
;---------------------------- UPDATES COMPLETED -----------------------------
;
Color n/c
AT (7,14) "Updates and Configuration Changes Completed.........."
SLEEP 1
;
;-------------------------- DISPLAY USER SETTINGS ---------------------------
;
SMALL
Color g+/n
BOX (10,14,18,66,FULL)
Color w+/n
AT ( 11,20)"Userid : " ; User Login Information Window Text Strings
AT (12,20) "Full name : "
AT (13,20) "Privilege : "
AT (14,20) "Workstation : "
AT (15,20) "Domain : "
AT (16,20) "Logon Server : "
AT (17,20) "Script Used : "
Color y+/n
AT ( 11,37) @userid ; Associated Macro's
AT (12,37) @fullname
AT (13,37) @priv
AT (14,37) @wksta
AT (15,37) @domain
AT (16,37) @lserver
AT (17,37) @scriptname
sleep 3
;
;
;--------------------- CONFIRM GLOBALLY MAPPED DRIVES ----------------------
;
Color n/c
AT (21,14) "Verifying Globally Mapped Network Drive Connections..."
SLEEP 1
;
;
;---------------------- MAPPED DRIVE ERROR CHECKING -------------------------
;
;USE L: /DELETE ;(FOR DEBUGGING)
;
$DL="F:\"
IF EXIST ("F:\") GOSUB "CHECKG" ELSE GOTO "ERROR" ENDIF
;
:CHECKG
$DL="G:\"
IF EXIST ("G:\") GOSUB "CHECKG2" ELSE GOTO "ERROR" ENDIF
;
:CHECKG2
;fnMapped("\\ADMIN\NOGROUP$") ? ;(Uncomment to echo drive letter output to window.)
IF fnMapped("\\ADMIN\NOGROUP$") <> "G:" GOSUB "CHECKH" ELSE GOTO "MISDIRECT" ENDIF
;
:CHECKH
$DL="H:\"
IF EXIST ("H:\") GOSUB "CHECKI" ELSE GOTO "ERROR" ENDIF
;
:CHECKI
$DL="I:\"
IF EXIST ("I:\") GOSUB "LOGON" ELSE GOTO "ERROR" ENDIF
;
;
;---------------------- MESSAGE BOX PROMPTED TO USER ------------------------
;
:MISDIRECT
BEEP
MESSAGEBOX
("Your login to the SUSD Network has reported an error."
+ CHR(10) + "Some network resources may not be available."
+ CHR(10) + "Your $DL network drive to security group association has failed."
+ CHR(10) + "Please report this to your I.T. Department."
+ CHR(10) + "Your account has been validated by @LSERVER."
+ CHR(10) + "The time is @DAY, @TIME, @DATE."
+ CHR(10) + " Have a nice day ;o) !!"
+ CHR(10) + "", "Sunnyside USD #12 - ERROR - $DL Drive Association Failed ", 48, 15)
GOSUB "END"
;
:ERROR
BEEP
MESSAGEBOX
("Your login to the SUSD Network has reported an error."
+ CHR(10) + "Some network resources may not be available."
+ CHR(10) + "Your $DL network drive did not acquire a connection."
+ CHR(10) + "Please report this to your I.T. Department."
+ CHR(10) + "Your account has been validated by @LSERVER."
+ CHR(10) + "The time is @DAY, @TIME, @DATE."
+ CHR(10) + " Have a nice day ;o) !!"
+ CHR(10) + "", "Sunnyside USD #12 - ERROR - $DL Drive Missing", 48, 15)
GOSUB "END"
;
;
;
;
:LOGON
MESSAGEBOX
("Welcome to the Sunnyside USD Computer Network."
+ CHR(10) + "Your account has been validated by @LSERVER."
+ CHR(10) + "The time is @DAY, @TIME, @DATE."
+ CHR(10) + " Have a nice day ;o) !!!",
"Sunnyside USD #12 - LOGIN SUCCESSFUL !!!", 64, 15)
;
:END
;----------- TELLS THE SCRIPT INTERPRETER THAT THE SCRIPT IS DONE -----------
COOKIE1
EXIT
;
;--------------------------- UDF DEFINITIONS --------------------------------
;------------------------------ fnMapped ------------------------------------
;
Function fnMapped($sUNC)
Dim $oDrives,$oDrive
$oDrives = CreateObject("Scripting.FileSystemObject").Drives
If Not VarType($oDrives) & 9 Exit 1 EndIf
For Each $oDrive in $oDrives
If $oDrive.DriveType = 3 AND $sUNC = $oDrive.ShareName
$fnMapped = $oDrive.DriveLetter + ":"
EndIf
Next
EndFunction

Top
#150269 - 2005-10-21 01:39 AM Re: Script needs general review.
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Well, the first thing I would suggest is get rid of all those IF/ENDIF's and go with the SELECT/CASE/ENDSELECT ... much easier on the eyes and prolly lot faster too...

btw - this assumes that your user's can't be a member of more than one of these groups ... that they're mutually exclusive ...

Code:

SELECT

CASE INGROUP ("Business & Finance")

$GroupShare= $AMN + "\Business & Finance$"

CASE INGROUP ("Career Ladder")

$GroupShare= $AMN + "\Career Ladder$"

CASE INGROUP ("Curriculum")

$GroupShare= $AMN + "\Curriculum & Instruction$"

; ETC, ETC, ETC ...

CASE 1

ENDSELECT


Top
#150270 - 2005-10-21 06:09 AM Re: Script needs general review.
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Michael,

Please use the UBB TAGS for posting code. It makes it soooooo much easier to read and understand when used.
When you post you should see items there for editing your post. Those are called UBB TAGS.

Instant UBB Code
URL Email Image
List Start List Item List End
Bold Italics Underline
Quote Code

 
The board even has an FAQ on what they all mean and how to use all of them.


Thanks

Top
#150271 - 2005-10-21 09:25 AM Re: Script needs general review.
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Okay, here is a little re-write of your code.
You need to review it for any obvious errors or missing / invalid information as applies to your environment.

I tried not to stray too far off of what I think you're attempting to do here.

I would probably clean it up more and do some things a bit different, but you should get the general idea here.

This script does away with the GOTO and GOSUB routines by using User Defined Functions

I also set the SetOptions so that you are forced to write cleaner code.

Let us know how it goes. Notice that the use of the Select / EndSelect will ONLY check for membership in 1 group. Once that group is found it will quit checking the other statements. If you have users that are in more then one group and you need to map multiple drives based on multiple memberships then you will need to use some IF/ENDIF statements to handle those.

NOTE: I wrote this script for use with KiXtart 4.5
It may work fine with earlier versions but I can't say for sure.
 



;------------------------------------------------------------------------------- 
; DOADMIN.KIX
;
; Logon Script for SUSD
;
;
; Script Author: Michael Ingrando
; Date: 10-21-05
;
;------- OVERWRITE THIS SECTION TO KEEP THE LAST KNOWN EDITOR CURRENT -------
;
; Last Modified by: NTDOC
; Date: 2005-10-21
;
; DEBUG ON ;(Uncomment for debugging feature)
;
;------------------------ CANCEL SCRIPT IF SERVER ---------------------------
;
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

;Declare the variables
Dim $NoMap,$TopLeftRow,$TopLeftCol,$BtmRtRow,$BtmRtCol
Dim $Common,$Apps,$Nurses,$Itshare,$FOOD
Dim $AMN,$ADO,$ADG,$DC1,$AIN,$PRT,$ITS,$HSQ
Dim $GroupShare,$GroupError

;Abort the script for these workstations
$NoMap=Split("ADM-DC1|ADM-PRT|ADMIN-DO|ADM-GHT|ADMIN|ADMIN-IT|ADMININTET|HMSQ","|")
If AScan ($NoMap,@WKSTA)>=0
COOKIE1
Quit 1
EndIf
;
;
;--------------------- PROGRESS DIALOG BOX PRESENTED ------------------------
;
CLS
SMALL
$TopLeftRow = 0
$TopLeftCol = 0
$BtmRtRow = 30 ;Height
$BtmRtCol = 80 ;Width
;
Color c/c
BOX($TopLeftRow, $TopLeftCol, $BtmRtRow, $BtmRtCol, SINGLE)
;
Color r/c+
AT(10, 10) "Please Standby While Network Resources are Established..."
Sleep 1
;
Color n/c
AT(13,18) "Reviewing User Account Information.........."
Sleep 1
;
;------------------------------ SET VARIBLES --------------------------------
; ****** Notice: Always put quotes around all strings. ******
;
$AMN ="\\ADMIN"
$ADO ="\\ADMIN-DO"
$ADG ="\\ADM-GHT"
$DC1 ="\\ADM-DC1"
$AIN ="\\ADMININET"
$PRT ="\\ADM-PRT"
$ITS ="\\ADMIN-IT"
$HSQ ="\\HMSQ"
;
$Common = $AMN + "\Common"
$Apps = $AMN + "\Apps"
$Nurses = $HSQ + "\Nurses$"
$Itshare = $ITS + "\It-Share$"
$FOOD = $AMN + "\Food Services$"
;
;----------- SET GROUPSHARE VARIABLE (Based on group membership.) -----------
; DEFAULT $GroupShare to NOGROUP$ to prevent script from crashing on assumed variable!
; (THE EFFECT OF MULTIPLE MEMBERSHIP IS THE LAST MAPPING TAKES PRECEDENCE.)
;
$GroupShare = $AMN + "\NOGROUP$"
;
;Map a different drive for different groups or set the preference for first
;located group. Once first group is found the section of code will complete

Select
Case InGroup(@DOMAIN+"\Business & Finance")
;FYI - Though supported it is not a good idea to have the & sign in the name of
;an object. This can easily cause issues with some programs.
$GroupShare= $AMN + "\Business & Finance$"
Case InGroup(@DOMAIN+"\Career Ladder")
$GroupShare= $AMN + "\Career Ladder$"
Case InGroup(@DOMAIN+"\Curriculum")
$GroupShare= $AMN + "\Curriculum & Instruction$"
Case InGroup(@DOMAIN+"\Domain Admins")
$GroupShare= $ITS + "\Infotech$"
Case InGroup(@DOMAIN+"\Educational Services")
$GroupShare= $AMN + "\Educational Services$"
Case InGroup(@DOMAIN+"\Food Services")
$GroupShare= $AMN + "\Food Services$"
Case InGroup(@DOMAIN+"\INFOTECH")
$GroupShare= $ITS + "\InfoTech$"
Case InGroup(@DOMAIN+"\Language Aquisition")
$GroupShare= $AMN + "\Language Aquisition$"
Case InGroup(@DOMAIN+"\Leadership Developement")
$GroupShare= $AMN + "\Leadership Developement$"
Case InGroup(@DOMAIN+"\MAINTENANCE")
$GroupShare= $AMN + "\Maintenance$"
Case InGroup(@DOMAIN+"\MultiMedia Services")
$GroupShare= $AMN + "\MultiMedia Services$"
Case InGroup(@DOMAIN+"\Native American Edu")
$GroupShare= $AMN + "\Native American Edu$"
Case InGroup(@DOMAIN+"\Operations")
$GroupShare= $AMN + "\Curriculum & Instruction$"
Case InGroup(@DOMAIN+"\Personnel Services")
$GroupShare= $AMN + "\Personnel Services$"
Case InGroup(@DOMAIN+"\Public Relations")
$GroupShare= $AMN + "\Public Relations$"
Case InGroup(@DOMAIN+"\Purchasing Property Control")
$GroupShare= $AMN + "\Purchasing Property Control$"
Case InGroup(@DOMAIN+"\Research Evaluation")
$GroupShare= $AMN + "\Research Evaluation$"
Case InGroup(@DOMAIN+"\Special Services")
$GroupShare= $AMN + "\Special Services$"
Case InGroup(@DOMAIN+"\Staff Development")
$GroupShare= $AMN + "\Staff Development$"
Case InGroup(@DOMAIN+"\Student Services")
$GroupShare= $AMN + "\Student Services$"
Case InGroup(@DOMAIN+"\Superintendent")
$GroupShare= $AMN + "\Superintendent$"
Case InGroup(@DOMAIN+"\Title I")
$GroupShare= $AMN + "\Title I$"
Case InGroup(@DOMAIN+"\TRANSPORTATION")
$GroupShare= $AMN + "\TRANSPORTATION$"
Case 1
$GroupError=1319
;The specified group does not exist. You can check for this error code
;and take appropriate actions if wanted. I did not add any code to
;the script to do anything if it gets set.
EndSelect
;
;------------------ CONTINUE PREVIOUS PROGRESS DIALOG BOX -------------------
;
AT(16,22) "Thank You, Login will continue....."
Sleep 1
CLS
;
;---------------------------- MAP GLOBAL DRIVES -----------------------------
;
Color n/c
AT (1,14) "Mapping District Standard Global Network Drives......"
SLEEP 1
;
;----------- MAP STANDARD DRIVES FOR ALL SITES (Global Mappings) ------------
;
USE F: $Apps
;
USE G: $GroupShare
;
USE I: $Common
;
If InGroup(@DOMAIN+"\Nurses") USE N: $Nurses EndIf
;
If InGroup(@DOMAIN+"\Domain Admins") USE O: $Itshare EndIf
;
If InGroup(@DOMAIN+"\Food Services") USE W: $Food EndIf
;
;
;------- THE NEXT MAPPINGS PORTION OF THE SCRIPT IS UNIQUE TO THE SITE ------
;
;----------------------------- MAP LOCAL DRIVES -----------------------------
;
Color n/c
AT (3,14) "Mapping Site-Based Local Network Drives.............."
SLEEP 1
;
;
;------------------ MAP SITE OR APPLICATION SPECIFIC DRIVES -----------------
;
;IF INGROUP ("Domain Users") USE M: ENDIF
;
;
;-------------------------- MAP CDROM TOWER DRIVES --------------------------
;------------------------ (NOT IN USE AT THIS TIME) -------------------------
;
;
;------------------ END UNIQUE MAPPINGS PORTION OF SCRIPT -------------------
;
;
;
;------------------------------- CHECK UPDATES ------------------------------
;
Color n/c
AT (5,14) "Checking for Updates and Configuration Changes......."
SLEEP 1
;
;----------------------- CREATE UPDATES IN THIS SECTION ---------------------
;
;----------------------- REGISTRY MODIFICATION SECTION ----------------------
;
;---------------------------- UPDATES COMPLETED -----------------------------
;
Color n/c
AT (7,14) "Updates and Configuration Changes Completed.........."
SLEEP 1
;
;-------------------------- DISPLAY USER SETTINGS ---------------------------
;
SMALL
Color g+/n
BOX (10,14,18,66,FULL)
Color w+/n
AT ( 11,20)"Userid : " ; User Login Information Window Text Strings
AT (12,20) "Full name : "
AT (13,20) "Privilege : "
AT (14,20) "Workstation : "
AT (15,20) "Domain : "
AT (16,20) "Logon Server : "
AT (17,20) "Script Used : "
Color y+/n
AT ( 11,37) @userid ; Associated Macro's
AT (12,37) @fullname
AT (13,37) @priv
AT (14,37) @wksta
AT (15,37) @domain
AT (16,37) @lserver
AT (17,37) @scriptname
sleep 3
;
;
;--------------------- CONFIRM GLOBALLY MAPPED DRIVES ----------------------
;
Color n/c
AT (21,14) "Verifying Globally Mapped Network Drive Connections..."
SLEEP 1
;
;
;---------------------- MAPPED DRIVE ERROR CHECKING -------------------------
;
If Not Exist('F:\')
Dim $Msg,$DL
$DL='F:'
$Msg=MapErr('F:')
$Msg=MessageBox($Msg,"Sunnyside USD #12 - ERROR - "+$DL+" Drive Missing", 48, 15)
EndIf

If Not Exist('G:\')
Dim $Msg,$DL
$DL='G:'
$Msg=MapErr('G:')
$Msg=MessageBox($Msg,"Sunnyside USD #12 - ERROR - "+$DL+" Drive Missing", 48, 15)
EndIf

If fnMapped("\\ADMIN\NOGROUP$") <> "G:"
Dim $Msg,$DL
$DL='G:'
$Msg=MisDirect('G:')
$Msg=MessageBox($Msg,"Sunnyside USD #12 - ERROR - "+$DL+" Drive Association Failed ", 48, 15)
QUIT 1
EndIf

If Not Exist('H:\')
Dim $Msg,$DL
$DL='H:'
$Msg=MapErr('H:')
$Msg=MessageBox($Msg,"Sunnyside USD #12 - ERROR - "+$DL+" Drive Missing", 48, 15)
EndIf

If Not Exist('I:\')
Dim $Msg,$DL
$DL='I:'
$Msg=MapErr('I:')
$Msg=MessageBox($Msg,"Sunnyside USD #12 - ERROR - "+$DL+" Drive Missing", 48, 15)
EndIf

;All drive mappings were succesful so show logon message
$Msg=LogonMsg()
$Msg=MessageBox($Msg,"Sunnyside USD #12 - LOGIN SUCCESSFUL !!!", 64, 15)
;
;----------- TELLS THE SCRIPT INTERPRETER THAT THE SCRIPT IS DONE -----------
COOKIE1
Exit 1
;
;--------------------------- UDF DEFINITIONS --------------------------------
;------------------------------ fnMapped ------------------------------------
;

Function fnMapped($sUNC)
Dim $oDrives,$oDrive
$oDrives = CreateObject("Scripting.FileSystemObject").Drives
If Not VarType($oDrives) & 9 Exit 1 EndIf
For Each $oDrive in $oDrives
If $oDrive.DriveType = 3 AND $sUNC = $oDrive.ShareName
$fnMapped = $oDrive.DriveLetter + ":"
EndIf
Next
EndFunction
;
;---------------------- MESSAGE BOX PROMPTED TO USER ------------------------
;
Function MisDirect($DL)
$MISDIRECT="Your login to the SUSD Network has reported an error."+@CRLF+
"Some network resources may not be available."+
"Your " + $DL + " network drive to security group association has failed."+
"Please report this to your I.T. Department."+
"Your account has been validated by " + @LSERVER + "."+
"The time is " +@DAY +","+@TIME+","+ @DATE+"."+
" Have a nice day ;o) !!"
EndFunction

Function MapErr($DL)
$MapErr="Your login to the SUSD Network has reported an error."+@CRLF+
"Some network resources may not be available."+@CRLF+
"Your " + $DL + " network drive did not acquire a connection."+@CRLF+
"Please report this to your I.T. Department."+@CRLF+
"Your account has been validated by " + @LSERVER+"."+@CRLF+
"The time is "+@DAY+","+@TIME+","+@DATE+"."+@CRLF+
" Have a nice day ;o) !!"
EndFunction

Function LogonMsg()
$LogonMsg ="Welcome to the Sunnyside USD Computer Network."+@CRLF+
"Your account has been validated by "+@LSERVER+"."+@CRLF+
"The time is "+@DAY+","+@TIME+","+@DATE+"."+@CRLF+
" Have a nice day ;o) !!!"
EndFunction

 

Top
#150272 - 2005-10-22 07:42 AM Re: Script needs general review.
michaeli Offline
Fresh Scripter

Registered: 2005-10-18
Posts: 14
Loc: Tucson,AZ
WOW, Thanks tons for the rewrite.... really unexpected.
This forum is awesome ( your efforts especially).
This will give me something to really sink my teeth into. I'm getting in late tonight, but I'll be reviewing it this weekend do some trials at work next week. Thanks again for your support, this really blows me away.

Regards, Michael

Top
Page 1 of 1 1


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

Who's Online
0 registered and 874 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.067 seconds in which 0.029 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