Page 2 of 2 <12
Topic Options
#140190 - 2005-05-26 12:05 AM Re: Ingroup
parkaw Offline
Fresh Scripter

Registered: 2005-05-23
Posts: 17
Oh, I posted the summary of what it is.
Here is the unabriged.
Code:
 use k: /DELETE
use s: /DELETE
use j: /DELETE
use p: /DELETE
use t: /DELETE
use k: \\tmc\goldmine
use s: \\scanserve\archive
use j: \\cxsrv1\jfsrvr\data
use p: "\\cxsrv1\CommerceCenter 10.5"
use t: \\mail\pb


;*************************************************************************

addprinterconnection("\\mcsrv\Conf")
addprinterconnection("\\mcsrv\LongColor")
addprinterconnection("\\mcsrv\LongCSR")
addprinterconnection("\\mcsrv\RAINSHINE")
addprinterconnection("\\mcsrv\VANCCOLOR")
addprinterconnection("\\mcsrv\VANCCTR")
addprinterconnection("\\mcsrv\SSFWareH")
addprinterconnection("\\mcsrv\SSFLaser")
addprinterconnection("\\mcsrv\RanchoCo")
addprinterconnection("\\mcsrv\SanBerna")
addprinterconnection("\\mcsrv\SanRosa")


IF INGROUP('LONGUP')
setdefaultprinter('\\mcsrv\LONGCSR')
ELSE
IF INGROUP('mallory.local/Mallory/LONGFC')
setdefaultprinter('\\mcsrv\LONGFC')
ELSE
IF INGROUP('mallory.local/Mallory/VANC')
setdefaultprinter('\\mcsrv\VANCCTR')
ELSE
IF INGROUP('mallory.local/Mallory/Rancho')
setdefaultprinter('\\mcsrv\RanchoCo')
ELSE
IF INGROUP('mallory.local/Mallory/SanBerna')
setdefaultprinter('\\mcsrv\SanBerna')
ELSE
IF INGROUP('mallory.local/Mallory/SanRosa')
setdefaultprinter('\\mcsrv\SanRosa')
ELSE
IF INGROUP('mallory.local/Mallory/SSFWareh')
setdefaultprinter('\\mcsrv\SSFWareh')
ELSE
IF INGROUP('mallory.local/Mallory/SSF')
setdefaultprinter('\\mcsrv\SSFLaser')
ELSE
? '[really really long marker]'

ENDIF



;*************************************************************************





Top
#140191 - 2005-05-26 12:12 AM Re: Ingroup
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
What about trying Iffin's suggestion of flushing the Token Cache and trying again?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#140192 - 2005-05-26 12:20 AM Re: Ingroup
parkaw Offline
Fresh Scripter

Registered: 2005-05-23
Posts: 17
you mean
RUN:=> \\tmc\NETLOGON\kix32.exe /f \\tmc\NETLOGON\apark.kix
That?
Yes, I've tried that 20 times so far.
I still get the same results.
I remember someone saying something about flushing those from the registry.
Is that something I should try, and if so, then what is the hive path to the subkey(s) I need to delete?

Top
#140193 - 2005-05-26 12:28 AM Re: Ingroup
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
The INGROUP construct is not correct:
Code:

IF INGROUP('LONGUP')
setdefaultprinter('\\mcsrv\LONGCSR')
ELSE
IF INGROUP('Mallory\LONGFC')
setdefaultprinter('\\mcsrv\LONGFC')
ELSE
IF INGROUP('Mallory\VANC')
setdefaultprinter('\\mcsrv\VANCCTR')
ELSE
IF INGROUP('Mallory\Rancho')
setdefaultprinter('\\mcsrv\RanchoCo')
ELSE
IF INGROUP('Mallory\SanBerna')
setdefaultprinter('\\mcsrv\SanBerna')
ELSE
IF INGROUP('Mallory\SanRosa')
setdefaultprinter('\\mcsrv\SanRosa')
ELSE
IF INGROUP('Mallory\SSFWareh')
setdefaultprinter('\\mcsrv\SSFWareh')
ELSE
IF INGROUP('Mallory\SSF')
setdefaultprinter('\\mcsrv\SSFLaser')
ELSE
? '[really really long marker]'

ENDIF



HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#140194 - 2005-05-26 01:09 AM Re: Ingroup
parkaw Offline
Fresh Scripter

Registered: 2005-05-23
Posts: 17
Oh... kay.
What am I doing wrong?

I just used the basic syntax from the example in the command reference

Code:
 If InGroup("Domain Users") 
DISPLAY "z:\users.txt"
EndIf


That one.

What is wrong with it?

Top
#140195 - 2005-05-26 01:13 AM Re: Ingroup
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
There is nothing wrong with this provided you have a Z: Drive mapped with a users.txt file within it. FYI - The Z: Drive is used by Win 9x at login.

Have you tried to step your code through (debug)?

Kent


Edited by kdyer (2005-05-26 01:14 AM)
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#140196 - 2005-05-26 01:38 AM Re: Ingroup
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
What's with all those IF ELSE and only one ENDIF? tsk, tsk!

EVERY IF NEEDS AN ENDIF!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140197 - 2005-05-26 01:39 AM Re: Ingroup
parkaw Offline
Fresh Scripter

Registered: 2005-05-23
Posts: 17
By basic syntax, I mean:
Code:
  
IF INGROUP("Groupname")
;do stuff
ELSE
IF INGROUP("Groupname1")
;do other stuff
ENDIF



I'm trying to figure out what I am doing wrong, I think these questions will help a bit.
If you could take the time to answer them, that would be great.

Is there anything wrong with that basic structure?
If so, what is wrong that basic structure?
Is there anything wrong with the INGROUP statement?
If so, what is wrong with the INGROUP statement?
Is there something wrong with the way I've setup and applied groups?
If so, what is wrong with the way I've setup and applied groups

Top
#140198 - 2005-05-26 01:41 AM Re: Ingroup
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Harumpf!
Still with the incorrect IF ELSE IF ENDIF!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140199 - 2005-05-26 02:14 AM Re: Ingroup
parkaw Offline
Fresh Scripter

Registered: 2005-05-23
Posts: 17
I have that ENDIF thing fixed now fixed now
just 8 of them.
As long as I don't modify the Primary group of the user, it shouldn't restrict their access to any network applications, like CITRIX, should it?

Top
#140200 - 2005-05-26 05:24 AM Re: Ingroup
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Before the group will be listed in by the EnumGroup, the group and membership change will have to replicate to your global catalog server. After that you will have to logoff and log back on. Group assignments are attached to the security token by the GC at logon.

Also try deleting the tokencache.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#140201 - 2005-05-26 06:25 AM Re: Ingroup
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Here is the "game plan"..

(1) Your original code (IF..ELSE). No ENDIFs used
(2) We'll run it through a parser to show what is going on
(3) Show the corrected version
(4) Show the optimized version.


(1) Your original code (IF..ELSE). No ENDIFs used
Looking at your original code -
Code:

IF INGROUP('LONGUP')
setdefaultprinter('\\mcsrv\LONGCSR')
ELSE
IF INGROUP('Mallory\LONGFC')
setdefaultprinter('\\mcsrv\LONGFC')
ELSE
IF INGROUP('Mallory\VANC')
setdefaultprinter('\\mcsrv\VANCCTR')
ELSE
IF INGROUP('Mallory\Rancho')
setdefaultprinter('\\mcsrv\RanchoCo')
ELSE
IF INGROUP('Mallory\SanBerna')
setdefaultprinter('\\mcsrv\SanBerna')
ELSE
IF INGROUP('Mallory\SanRosa')
setdefaultprinter('\\mcsrv\SanRosa')
ELSE
IF INGROUP('Mallory\SSFWareh')
setdefaultprinter('\\mcsrv\SSFWareh')
ELSE
IF INGROUP('Mallory\SSF')
setdefaultprinter('\\mcsrv\SSFLaser')
ELSE
? '[really really long marker]'

ENDIF


This absolutely will not work.

(2) We'll run it through a parser to show what is going on
If we take your original IF..ELSE structure and run it through a parser like KiXStrip, we see what is wrong:
Code:

IF INGROUP('LONGUP')
setdefaultprinter('\\mcsrv\LONGCSR')
ELSE
IF INGROUP('Mallory\LONGFC')
setdefaultprinter('\\mcsrv\LONGFC')
ELSE
IF INGROUP('Mallory\VANC')
setdefaultprinter('\\mcsrv\VANCCTR')
ELSE
IF INGROUP('Mallory\Rancho')
setdefaultprinter('\\mcsrv\RanchoCo')
ELSE
IF INGROUP('Mallory\SanBerna')
setdefaultprinter('\\mcsrv\SanBerna')
ELSE
IF INGROUP('Mallory\SanRosa')
setdefaultprinter('\\mcsrv\SanRosa')
ELSE
IF INGROUP('Mallory\SSFWareh')
setdefaultprinter('\\mcsrv\SSFWareh')
ELSE
IF INGROUP('Mallory\SSF')
setdefaultprinter('\\mcsrv\SSFLaser')
ELSE
? '[really really long marker]'

ENDIF

;($begin)
;
; wed 25-may-2005 21:00:30 (kix 4.20 vs 4.00e)
;
;Informative KIXSTRIP: input=27 output=27 skip=0
;
;Warning KIXSTRIP: 7 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 [8:8:1]
; - select:case:endselect [0:0:0]
; - while:loop [0:0]
;Warning KIXSTRIP: some lines contains errors or possible errors.
;Informative KIXSTRIP: 8 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
;
;($end)
;($begin)
;
;
;($end)



(3) Show the corrected version
Let's make some changes with it:
Code:

IF INGROUP('LONGUP')
setdefaultprinter('\\mcsrv\LONGCSR')
ENDIF
IF INGROUP('Mallory\LONGFC')
setdefaultprinter('\\mcsrv\LONGFC')
ENDIF
IF INGROUP('Mallory\VANC')
setdefaultprinter('\\mcsrv\VANCCTR')
ENDIF
IF INGROUP('Mallory\Rancho')
setdefaultprinter('\\mcsrv\RanchoCo')
ENDIF
IF INGROUP('Mallory\SanBerna')
setdefaultprinter('\\mcsrv\SanBerna')
ENDIF
IF INGROUP('Mallory\SanRosa')
setdefaultprinter('\\mcsrv\SanRosa')
ENDIF
IF INGROUP('Mallory\SSFWareh')
setdefaultprinter('\\mcsrv\SSFWareh')
ENDIF
IF INGROUP('Mallory\SSF')
setdefaultprinter('\\mcsrv\SSFLaser')
ENDIF
? '[really really long marker]'

;($begin)
;
; wed 25-may-2005 21:04:48 (kix 4.20 vs 4.00e)
;
;Informative KIXSTRIP: no errors found (input=25 output=25 skip=0).
;
;Summary KIXSTRIP: block structures
; - do:until [0:0]
; - for|each:in|to:step|next [0|0:0|0:0|0]
; - function:endfunction [0:0]
; - if:else:endif [8:0:8]
; - select:case:endselect [0:0:0]
; - while:loop [0:0]
;Informative KIXSTRIP: 8 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
;
;($end)



(4) Show the optimized version.
Now, let's optimize your code a bit.. I think this is what you were trying to accomplish in the first place.
When the processor encounters the first true condition, it does what it needs and leaves the structure:
Code:

SELECT
CASE
INGROUP('LONGUP')
setdefaultprinter('\\mcsrv\LONGCSR')
CASE
INGROUP('Mallory\LONGFC')
setdefaultprinter('\\mcsrv\LONGFC')
CASE
INGROUP('Mallory\VANC')
setdefaultprinter('\\mcsrv\VANCCTR')
CASE
INGROUP('Mallory\Rancho')
setdefaultprinter('\\mcsrv\RanchoCo')
CASE
INGROUP('Mallory\SanBerna')
setdefaultprinter('\\mcsrv\SanBerna')
CASE
INGROUP('Mallory\SanRosa')
setdefaultprinter('\\mcsrv\SanRosa')
CASE
INGROUP('Mallory\SSFWareh')
setdefaultprinter('\\mcsrv\SSFWareh')
CASE
INGROUP('Mallory\SSF')
setdefaultprinter('\\mcsrv\SSFLaser')
CASE
? '[really really long marker]'
ENDSELECT

;($begin)
;
; wed 25-may-2005 21:07:12 (kix 4.20 vs 4.00e)
;
;Informative KIXSTRIP: no errors found (input=21 output=21 skip=0).
;
;Summary KIXSTRIP: block structures
; - do:until [0:0]
; - for|each:in|to:step|next [0|0:0|0:0|0]
; - function:endfunction [0:0]
; - if:else:endif [0:0:0]
; - select:case:endselect [1:9:1]
; - while:loop [0:0]
;Informative KIXSTRIP: 1 block_structure 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
;
;($end)



HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#140202 - 2005-05-27 12:04 AM Re: Ingroup
parkaw Offline
Fresh Scripter

Registered: 2005-05-23
Posts: 17
Awesome.
What parser did you use?

Also... how do I replace the error marker at the end with some sort of sound, like... the melody to funky town or something ominous?
That way I can tell the users of the scripts to call me if they hear it.

Top
#140203 - 2005-05-27 12:22 AM Re: Ingroup
parkaw Offline
Fresh Scripter

Registered: 2005-05-23
Posts: 17
Erm, the marker at the end in the last ELSE IF statement means that IF it isn't in any of the other groups that were specified, that it returns a marker.
So perhaps a better way of doing that would be
Code:
 ELSE
?'[Contact information]"
SLEEP 20


?
At least it would probably be more professional than the melody to funky town as I suggested earlier.


Edited by parkaw (2005-05-27 12:33 AM)

Top
#140204 - 2005-05-27 01:06 AM Re: Ingroup
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Since you can only have 1 default printer, Kent's Select Case construct makes more sense than a bunch of IF statements.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140205 - 2005-05-27 01:09 AM Re: Ingroup
parkaw Offline
Fresh Scripter

Registered: 2005-05-23
Posts: 17
Just an oddity.
If you try to print an email address via the print command:?
It snags on the @ symbol because it is a macro marker.
So
Code:
  ? 'Or via email at emailaddress@domain.ext'  


Prints as
Code:
   Or via email at emailaddress

Should I use the ascii code for @?
Or is there some other alternative character I can use to display the @ symbol?
Top
#140206 - 2005-05-27 01:39 AM Re: Ingroup
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Just double up the @ signs. KiXtart views @ as a special character. This is discussed in the documentation for KiXtart.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 2 of 2 <12


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

Who's Online
0 registered and 327 anonymous users online.
Newest Members
Jojo67, MaikSimon, kvn317, kixtarts2025, SERoyalty
17873 Registered Users

Generated in 0.072 seconds in which 0.027 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