Page 1 of 1 1
Topic Options
#28785 - 2002-09-10 07:11 PM InGroup (script only works for the very first group in the script)
Wolven Offline
Fresh Scripter

Registered: 2002-09-10
Posts: 8
Hey guys, I have generated a login script that takes advantage of the "InGroup" feature. But my login script only works for the very first group in the script. To get the script to map drives according to the group I have to move that group to the top of the script, subsequently the other group mappings fail. No error message.

Has anyone seen this before?

(MCA: extend subject)

[ 05. December 2002, 01:17: Message edited by: MCA ]

Top
#28786 - 2002-09-10 07:17 PM Re: InGroup (script only works for the very first group in the script)
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Wolven,

Are you using CASE statements ... or IF statements ? Might want to post a little snippet of code on this one.

Top
#28787 - 2002-09-10 07:18 PM Re: InGroup (script only works for the very first group in the script)
Wolven Offline
Fresh Scripter

Registered: 2002-09-10
Posts: 8
Additional Information: Windows NT environment, Clients are 9x-2k. The script is simply exiting before the entire script has run.
Top
#28788 - 2002-09-10 07:21 PM Re: InGroup (script only works for the very first group in the script)
Wolven Offline
Fresh Scripter

Registered: 2002-09-10
Posts: 8
Thanks for the response Shawn. Just using the "IF" statement. Here is a sample of my code:

code:
$Drive="f"
$Share="\\darla\statements"

If InGroup (HOUBANK)

If InGroup ("HOUBANK")
? "Mapping drive $Drive to $Share"
Use "$Drive:" /Delete
Use "$Drive:" $Share
If @error = 0
? " Map Successful"
eLSE
? " Error mapping drive $Drive to $Share"
EndIf

$Drive="j"
$Share="\\darla\HOUBANK"

If InGroup ("HOUBANK")
? "Mapping drive $Drive to $Share"
Use "$Drive:" /Delete
Use "$Drive:" $Share
If @error = 0
? " Map Successful"
eLSE
? " Error mapping drive $Drive to $Share"
EndIf

$Drive="r"
$Share="\\buckwheat\ri"

If InGroup ("HOUBANK")
? "Mapping drive $Drive to $Share"
Use "$Drive:" /Delete
Use "$Drive:" $Share
If @error = 0
? " Map Successful"
eLSE
? " Error mapping drive $Drive to $Share"
EndIf

$Drive="f"
$SHARE="\\darla\statements"

If InGroup (Accounting)

; input time synchronization command
If InGroup("accounting")
? "Mapping drive $Drive to $Share"
Use "$Drive:" /Delete
Use "$Drive:" $Share
If @error = 0
? " Map Successful"
eLSE
? " Error mapping drive $Drive to $Share"
EndIf

$Drive="k"
$Share="\\darla\cos"

If InGroup("accounting")
? "Mapping drive $Drive to $Share"
Use "$Drive:" /Delete
Use "$Drive:" $Share
If @error = 0
? " Map Successful"
eLSE
? " Error mapping drive $Drive to $Share"
EndIf

$Drive="l"
$Share="\\darla\data"

If InGroup("accounting")
? "Mapping drive $Drive to $Share"
Use "$Drive:" /Delete
Use "$Drive:" $Share
If @error = 0
? " Map Successful"
eLSE
? " Error mapping drive $Drive to $Share"
EndIf

$Drive="s"
$Share="\\stymie\Program Files"

If InGroup("accounting")
? "Mapping drive $Drive to $Share"
Use "$Drive:" /Delete
Use "$Drive:" $Share
If @error = 0
? " Map Successful"
eLSE
? " Error mapping drive $Drive to $Share"
EndIf

This is replicated on down for each department respectively.

Thanks for the help

(MCA: correct layout)

[ 05. December 2002, 01:20: Message edited by: MCA ]

Top
#28789 - 2002-09-10 07:27 PM Re: InGroup (script only works for the very first group in the script)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
You are missing a couple of ENDIF. Each IF requires a corresponding ENDIF. Please see the KiXtart Manual for correct IF-ENDIF syntax.

Example
code:
$Drive='S'
$Share='\\stymie\Program Files'

If InGroup('accounting')
? 'Mapping drive '+$Drive+' to '+$Share
USE $Drive+':' /Delete
USE $Drive+':' $Share
IF @ERROR
? ' Error mapping drive '+$Drive+' to '+$Share
ELSE
? ' Map Successful'
ENDIF
ENDIF

_________________________
There are two types of vessels, submarines and targets.

Top
#28790 - 2002-09-10 07:46 PM Re: InGroup (script only works for the very first group in the script)
Wolven Offline
Fresh Scripter

Registered: 2002-09-10
Posts: 8
Thanks for the input Sealeopold, I tried your suggestions and I get the same result. KIX2001.DOC, Kixtart.chm have very limited information on the "InGroup" feature from what I could search on. Bear in mind, that if I move any of the groups my test user is a member of to the top of the script then the drive mappings will work.

Thanks.

Top
#28791 - 2002-09-10 07:51 PM Re: InGroup (script only works for the very first group in the script)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Have you added all of the missing ENDIFs? Run your script through KiXXStrip ( http://home.wanadoo.nl/scripting ) to check the syntax. Also, have you refreshed the token cache for KiXtart?
_________________________
There are two types of vessels, submarines and targets.

Top
#28792 - 2002-09-10 09:21 PM Re: InGroup (script only works for the very first group in the script)
Wolven Offline
Fresh Scripter

Registered: 2002-09-10
Posts: 8
Hey Thanks to you both, I figured it out from both of your inputs. Correct Syntax below:
code:
SELECT
CASE InGroup("Group")
$Drive="drive letter"
$SHARE="\\servername\share"
? "Mapping drive $Drive to $Share"
Use "$Drive:" /Delete
Use "$Drive:" $Share
If @error = 0
? " Map Successful"
eLSE
? " Error mapping drive $Drive to $Share"
EndIF

$Drive="drive letter"
$Share="\\servername\share"
? "Mapping drive $Drive to $Share"
Use "$Drive:" /Delete
Use "$Drive:" $Share
If @error = 0
? " Map Successful"
eLSE
? " Error mapping drive $Drive to $Share"
EndIF
ENDSELECT

FYI for other novices; Each "GROUP" must have only a single CASE statement following the SELECT statemet with all the subsequent drive mappings underneath. Only use the "ENDSELECT" statement at the very end of your script.

Once Again, Thanks to All!

{edit} Bullock - added code tags.

[ 10. September 2002, 21:35: Message edited by: Howard Bullock ]

Top
#28793 - 2002-09-10 09:41 PM Re: InGroup (script only works for the very first group in the script)
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Wolven, for a script that maps multiple drives, you may want to investigate a UDF to make adding mappings easier.

MapDrive("h:", "MyFileServer", "MyShareName")

code:
Function MapDrive($Drive, $Server, $Share)
Dim $Drive, $Server, $Share
Color c+/n
If $Drive<>"" and $Server<>"" and $Share<>""
$LogText="Connecting $Drive to \\$Server\$Share"
? $LogText
USE $Drive /Delete /Persistent
USE $Drive "\\$Server\$Share"
If @error=0
color g+/n
$x=" - Success"
"$x"
Else
color r+/n
$x=" - Failed: Error @error"
"$x"
$ErrorState=1
Endif
;WriteLog ($LogText + $x) ;UDF in UDF Library
Color w+/n
Else
;UDF in UDF Library
;WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'")
Endif
Endfunction

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

Top
#28794 - 2002-09-10 10:10 PM Re: InGroup (script only works for the very first group in the script)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
You should also be aware that SELECT-CASE-ENDSELECT will only process the first TRUE evaluation. Therefore, if a user is a member of multiple groups, it'll process only the first group. Also, CASE accepts any logical validation, thus you can combine multiple conditions with AND/OR.
_________________________
There are two types of vessels, submarines and targets.

Top
#28795 - 2002-12-05 01:16 AM Re: InGroup (script only works for the very first group in the script)
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

With our tool kixstrip you can verify your script.
With the call
kixstrip input.kix output.kix /block_check
we get
code:
 $drive="f"
$share="\\darla\statements"

IF InGroup (houbank)

IF InGroup ("HOUBANK")
? "Mapping drive $Drive to $Share"
USE "$Drive:" /delete
USE "$Drive:" $share
IF @error = 0
? " Map Successful"
ELSE
? " Error mapping drive $Drive to $Share"
ENDIF

$drive="j"
$share="\\darla\HOUBANK"

IF InGroup ("HOUBANK")
? "Mapping drive $Drive to $Share"
USE "$Drive:" /delete
USE "$Drive:" $share
IF @error = 0
? " Map Successful"
ELSE
? " Error mapping drive $Drive to $Share"
ENDIF

$drive="r"
$share="\\buckwheat\ri"

IF InGroup ("HOUBANK")
? "Mapping drive $Drive to $Share"
USE "$Drive:" /delete
USE "$Drive:" $share
IF @error = 0
? " Map Successful"
ELSE
? " Error mapping drive $Drive to $Share"
ENDIF

$drive="f"
$share="\\darla\statements"

IF InGroup (accounting)

; input time synchronization command
IF InGroup("accounting")
? "Mapping drive $Drive to $Share"
USE "$Drive:" /delete
USE "$Drive:" $share
IF @error = 0
? " Map Successful"
ELSE
? " Error mapping drive $Drive to $Share"
ENDIF

$drive="k"
$share="\\darla\cos"

IF InGroup("accounting")
? "Mapping drive $Drive to $Share"
USE "$Drive:" /delete
USE "$Drive:" $share
IF @error = 0
? " Map Successful"
ELSE
? " Error mapping drive $Drive to $Share"
ENDIF

$drive="l"
$share="\\darla\data"

IF InGroup("accounting")
? "Mapping drive $Drive to $Share"
USE "$Drive:" /delete
USE "$Drive:" $share
IF @error = 0
? " Map Successful"
ELSE
? " Error mapping drive $Drive to $Share"
ENDIF

$drive="s"
$share="\\stymie\Program Files"

IF InGroup("accounting")
? "Mapping drive $Drive to $Share"
USE "$Drive:" /delete
USE "$Drive:" $share
IF @error = 0
? " Map Successful"
ELSE
? " Error mapping drive $Drive to $Share"
ENDIF

;($begin)
;
; thu 05-dec-2002 01:17:51 (kix 4.10 vs 3.20e)
;
;Informative KIXSTRIP: input=95 output=95 skip=0
;
;Warning KIXSTRIP: 9 errors in block structure(s). missing statement(s).
; - do:until [0:0]
; - for|each:in|to:step|next [0|0:0|0:0|0]
; - function:endfunction [0:0]
; -ERROR- - if:else:endif [16:7:7]
; - select:case:endselect [0:0:0]
; - while:loop [0:0]
;Warning KIXSTRIP: some lines contains errors or possible errors.
;Informative KIXSTRIP: 16 block_structures found.
;Informative KIXSTRIP: no UDF's found.
;Informative KIXSTRIP: no labels found.
;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE
;Informative KIXSTRIP: 14 USE
;
;($end)
;($begin)
;
;
;($end)

greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#28796 - 2002-12-05 01:20 AM Re: InGroup (script only works for the very first group in the script)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
couldn't find any older post [Eek!]

wow, you must be really digging as there has been at least 1000 topics after this... huh.
_________________________
!

download KiXnet

Top
#28797 - 2002-12-05 01:47 AM Re: InGroup (script only works for the very first group in the script)
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear Lonkero,

For us it is very easy to find an older one. Examples of them are F1-1 and F2-1.
Only we are searching at this moment for topics, which doesn't have all answers for
the question in it and which answer can more complete with additional information.
In this case readers/members doesn't need first to download our tool to see
possibilities.
greetings.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#28798 - 2002-12-05 01:50 AM Re: InGroup (script only works for the very first group in the script)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22333
Loc: OK
yeah, but still the search for such an topic without "good" result is manual job.

cheers
cheers [Wink]
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 191 anonymous users online.
Newest Members
thequeen, ameliaryan, shalomsalami, dkdssdk, Vroon
17639 Registered Users

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