Page 1 of 1 1
Topic Options
#134009 - 2005-02-17 08:37 PM How to remove the GOTO's?
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
I'm having a problem figuring out how to remove the GOTO's in my script.
Although I've used KIX for a number of years I use it to do very basic scripting and ny no means am I coder what so ever.

I would like to remove the GOTO's and maybe clean things up a little....any help is appreciated.

;*************************************************************************
; Script Name: ver423.kix
; Author: Chris Beggs
; Date: 02/14/2005
; Description:
;*************************************************************************
;
;Set Variables
$user =@USERID
$primary =@PRIMARYGROUP
$os_dos =@DOS
$OS = Split(@PRODUCTTYPE)[1]
$CSD = Val(Right(@CSD,1))
$HKLMSCCS ="HKLM\SYSTEM\CurrentControlSet"
$HKCUSMWCV ="HKCU\Software\Microsoft\Windows\CurrentVersion"
$HKLMSMWCV ="HKLM\Software\Microsoft\Windows\CurrentVersion"
$HKLMSMWNTCV ="HKLM\Software\Microsoft\Windows NT\CurrentVersion"
$HKCUSMWNTCV ="HKCU\Software\Microsoft\Windows NT\CurrentVersion"
;
;*************************************************************************
; Run logon scripts visable
;
If @INWIN = ("1")
WriteValue("$HKLMSMWNTCV\winlogon","RunLogonScriptSync","1","REG_DWORD")
EndIf
;*************************************************************************
; Display Initial Greeting To User
CLS
?
Color w+/n
? "*****************************************************************"
? "Welcome to the ROK network."
? "Today is " + @DAY + ", " + @MONTH + " " + @MDAYNO + "."
? "*****************************************************************"
? "Hello " + @FULLNAME + "."
? "You are logged onto the " + @DOMAIN + " domain as " + @USERID + "."
? "Your access level on the domain is " + @PRIV + "."
;? "Your logon server is " + @LSERVER + "
? "You are running " + @PRODUCTTYPE + " SP " + " $csd "
$expire = (@MAXPWAGE - @PWAGE - 1)
? "Your password is " + @PWAGE + " days old and will expire in " + $expire + " days."
? "*****************************************************************"
Color w+/n
?
Sleep 15
;*************************************************************************
; Delete all drive mappings
Use "*" /DELETE /PERSISTENT
If @INWIN =2
DelTree("$hkcu\network\persistent")
EndIf
;*************************************************************************
; Map users home drive For Roberts
Select
Case InGroup("209 Manitou") = 1
Use H: "\\HYPERION\USERS\" + @USERID /persistent
Case InGroup("855 TRILLIUM") = 1
Use G: "\\APOLLO\USERS\" /persistent
If @INWIN = ("2") ;Windows 16 bit OS
EndIf
Case InGroup("209 Manitou") = 1
Use H: "\\HYPERION\USERS\"+ @USERID /persistent
InGroup("855 TRILLIUM") = 1
Use G: "\\APOLLO\USERS\" /persistent
EndSelect
;*************************************************************************
; ; Primary Group Mappings
Select
Case InGroup ("Roberts Estimating") = 1
Use t: "\\hyperion\estimating$"
Case InGroup ("Roberts AC Full Permissions") = 1
Use t: "\\hyperion\airconditioning$"
Case InGroup ("Roberts Mechanical") = 1
Use t: "\\hyperion\mechanical$"
Case InGroup ("Roberts Electrical") = 1
Use t: "\\hyperion\electrical$"
Case InGroup ("Roberts IT") = 1
Use t: "\\hyperion\apps$"
Case InGroup ("Roberts Reception") = 1
Use t: "\\hyperion\reception$"
EndSelect
;*************************************************************************
;
;Secondary Mappings
;*************************************************************************
:sec_1
If InGroup ( "Roberts Accounting" )
If @PRIMARYGROUP = "Roberts Accounting"
GoTo "sec_2"
Use s: "\\hyperion\accounting$"
EndIf
EndIf
;*************************************************************************
:sec_2
If InGroup ( "Roberts Estimating" )
If @PRIMARYGROUP = "Roberts Estimating"
GoTo "sec_3"
Use s: "\\hyperion\estimating$"
EndIf
EndIf
;*************************************************************************
:sec_3
If InGroup ( "Roberts AC Full Permissions" )
If @PRIMARYGROUP = "Roberts AC Full Permissions"
GoTo "sec_4"
Use s: "\\hyperion\airconditioning$"
EndIf
EndIf
;*************************************************************************
:sec_4
If InGroup ( "Roberts AC Read Only Permissions" )
If InGroup ( "Roberts AC Full Permissions" )
GoTo "sec_5"
Use s: "\\hyperion\airconditioning$"
EndIf
EndIf
;*************************************************************************
:sec_5
If InGroup ( "Roberts Mechanical" )
If @PRIMARYGROUP = "Roberts Mechanical"
GoTo "sec_6"
Use s: "\\hyperion\mechanical$"
EndIf
EndIf
;*************************************************************************
:sec_6
If InGroup ( "Roberts Electrical" )
If @PRIMARYGROUP = "Roberts Electrical"
GoTo "sec_7"
Use s: "\\hyperion\electrical$"
EndIf
EndIf
;*************************************************************************
:sec_7
If InGroup ( "Roberts IT" )
If @PRIMARYGROUP = "Roberts IT"
GoTo "sec_8"
Use s: "\\hyperion\apps$"
EndIf
EndIf
;*************************************************************************
:sec_8
If InGroup ( "Roberts Reception" )
If @PRIMARYGROUP = "Roberts Reception"
GoTo "sec_9"
Use s: "\\hyperion\reception$"
EndIf
EndIf
;*************************************************************************
:sec_9
If InGroup ( "Roberts Time and Material" )
Use n: "\\wmest\tandm$"
EndIf
;*************************************************************************
:sec_10
If InGroup ( "Roberts Change Order" )
Use o: "\\hyperion\changeorder$"
EndIf
;*************************************************************************
:sec_11
If InGroup ( "Roberts Databases" )
Use x: "\\hyperion\databases$"
EndIf
;*************************************************************************
:sec_12
If InGroup ( "Roberts Payroll" )
Use p: "\\hyperion\payroll$"
EndIf
;*************************************************************************
:sec_13
If InGroup ( "Roberts Quotes" )
Use q: "\\hyperion\quotes$"
EndIf
;*************************************************************************
:sec_14
If InGroup ( "Roberts Accounting" )
Use s: "\\hyperion\accounting$"
EndIf
;*************************************************************************
:sec_15
If InGroup ( "Roberts Company" )
Use w: "\\hyperion\company$"
EndIf
;*************************************************************************
:sec_16
If InGroup ( "Jonas_Users" )
Use J: "\\Rhea\Jonas"
EndIf
;*************************************************************************
:sec_17
If InGroup ( "Roberts IT" )
Use g: "\\cronus\c$\WINDOWS\sysvol\sysvol\ROK.ca\scripts"
EndIf
;*************************************************************************
:sec_18
If InGroup ( "On Site Company" )
Use w: "\\hyperion\company$"
EndIf
;*************************************************************************
:sec_19
If InGroup ( "Roberts Electrical Estimating" )
Use M: "\\wmest\electrical"
EndIf
;*************************************************************************
:sec_20
If InGroup ( "Roberts Mechanical Estimating" )
Use M: "\\wmest\Mechanical"
EndIf
;*************************************************************************
:sec_21
If InGroup ( "Roberts On Site ROE" )
Use R: "\\hyperion\laserroe"
EndIf
;*************************************************************************
:sec_22
If InGroup ( "Roberts ROE" )
Use g: "\\hyperion\wmrroe"
EndIf
;*************************************************************************
:sec_23
If InGroup ( "Roberts Lisa and Dan" )
Use i: "\\hyperion\lisadan$"
EndIf
;*************************************************************************
:sec_25
If InGroup ( "Roberts Kearsley ROE" )
Use U: "\\hyperion\kelroe$"
EndIf
;*************************************************************************
:sec_26
If InGroup ( "CADUsers" )
Use U: "\\hyperion\CAD$"
EndIf
;*************************************************************************
:sec_27
If InGroup ( "Roberts AC drive mapping" )
Use K: "\\hyperion\airconditioning$"
EndIf
;*************************************************************************
:sec_28
If InGroup ( "Roberts Tand M Kearsley" )
Use I: "\\apollo\databases"
EndIf
;*************************************************************************
:sec_29
If InGroup ( "Roberts Tand M Kearsley" )
Use L: "\\apollo\jobdata"
EndIf
;*************************************************************************
:sec_30
If @USERID = "Shana"
Use M: "\\hyperion\electrical$"
EndIf
;*************************************************************************
:sec_31
If InGroup ( "Maximizer" )
Use M: "\\wmest\maximizer$"
EndIf
;*************************************************************************
:sec_32
If InGroup ( "KE_DB" )
Use H: "\\apollo\DATABASES"
EndIf
;*************************************************************************
:sec_33
If InGroup ( "KE_Jobdata" )
Use Y: "\\apollo\JOBDATA"
EndIf
;*************************************************************************
:sec_34
If InGroup ( "KE_Apps" )
Use Q: "\\apollo\APPS"
EndIf
;*************************************************************************
:sec_35
If InGroup ( "Roberts IT" )
Use z: "\\rhea\d$\chris\music"
EndIf
;*************************************************************************
:END
Exit




Top
#134010 - 2005-02-17 08:45 PM Re: How to remove the GOTO's?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Code:

:sec_1
If InGroup ( "Roberts Accounting" )
If @PRIMARYGROUP = "Roberts Accounting"
GoTo "sec_2"
Use s: "\\hyperion\accounting$"
EndIf
EndIf
;*************************************************************************
:sec_2
If InGroup ( "Roberts Estimating" )
If @PRIMARYGROUP = "Roberts Estimating"
GoTo "sec_3"
Use s: "\\hyperion\estimating$"
EndIf
EndIf



I am really confused here. What are you trying to accomplish? I see no way that the USE S: mapping will ever execute.

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#134011 - 2005-02-17 09:02 PM Re: How to remove the GOTO's?
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
What I'm attempting is this.

Each department will map a primary drive of T: from the previous Select Case statement.

After that, if the user's primary group is already mapped to T: but a member of another department with a mapping of T:, it will then map the drive letter of S:

This is where my coding skills are falling apart and need some help.

Top
#134012 - 2005-02-18 12:28 AM Re: How to remove the GOTO's?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I am concerned that you are just checking for a group membership for the T: drive not anything related to @primaryGroup and then attempting to use @primarygroup for S:.

Code:
; Primary Group Mappings
Select
Case @PrimaryGrpoup = "Roberts Estimating"
Use t: "\\hyperion\estimating$$"
Case @PrimaryGrpoup = "Roberts AC Full Permissions"
Use t: "\\hyperion\airconditioning$$"
Case @PrimaryGrpoup = "Roberts Mechanical"
Use t: "\\hyperion\mechanical$$"
Case @PrimaryGrpoup = "Roberts Electrical"
Use t: "\\hyperion\electrical$$"
Case @PrimaryGrpoup = "Roberts IT"
Use t: "\\hyperion\apps$$"
Case "Roberts Reception"
Use t: "\\hyperion\reception$$"
EndSelect

If InGroup ( "Roberts Accounting" )
If @PRIMARYGROUP <> "Roberts Accounting"
Use s: "\\hyperion\accounting$"
EndIf
EndIf
If InGroup ( "Roberts Estimating" )
If @PRIMARYGROUP <> "Roberts Estimating"
Use s: "\\hyperion\estimating$"
EndIf
EndIf



But even this could have the effect of making multiple attempts to map S: if the users is in more than one group.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#134013 - 2005-02-18 02:49 PM Re: How to remove the GOTO's?
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
I think I understand what you're saying. If the person then belongs to say 3 of these groups, where does the drive mapping happen.

Maybe I'm out to lunch here but I can't wrap my head around how to properly map drive letters.

I've seen the UDF from Jens on mapping drives but I'm not familiar with UDF's. Maybe it's time to learn more about them and how they work.

Top
#134014 - 2005-02-18 04:42 PM Re: How to remove the GOTO's?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The coding will be fairly straight forward. You need to better define the business process of what users need to map to what directories. Once that is clearly define, we can provide coding assistance.

1) Will a person be in more than two groups?
2) What should happen in that case? Map a drive for all group memberships?
3) Only map the primary an one secondary? How to choose?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#134015 - 2005-02-19 12:45 AM Re: How to remove the GOTO's?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You might also want to consider putting the mappings into an appropriately structured .INI file for better maintainability and assign certain shares to specific letters instead of the other way around.

Edited by sealeopard (2005-02-22 02:58 AM)
_________________________
There are two types of vessels, submarines and targets.

Top
#134016 - 2005-02-21 10:51 PM Re: How to remove the GOTO's?
Chris Beggs Offline
Fresh Scripter

Registered: 2001-09-27
Posts: 27
Loc: Kitchener
I'll have a look at changing this around tomorrow and report my success, or failure.
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 1046 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.056 seconds in which 0.025 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