Page 2 of 2 <12
Topic Options
#24987 - 2002-07-16 10:00 PM Re: Problems with script - Gosub command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Another remark. I hope you are aware that in a SELECT-CASE-ENDSELECT only one CASE is used. So, if the first CASE is true, all following CASEs will be skipped.
_________________________
There are two types of vessels, submarines and targets.

Top
#24988 - 2002-07-16 10:01 PM Re: Problems with script - Gosub command
Cazzjh Offline
Fresh Scripter

Registered: 2002-06-04
Posts: 32
Loc: Glasgow, Scotland
yeah - I got that - there are no members of the two groups
_________________________
Cazzjh

Top
#24989 - 2002-07-16 10:39 PM Re: Problems with script - Gosub command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
did you placed the exit in like I suggested?
_________________________
!

download KiXnet

Top
#24990 - 2002-07-16 11:02 PM Re: Problems with script - Gosub command
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Cazzjh,

I've to agree with Lonkero. Where's your exit?
Looking at you script I think the following happens:

MEMBER OF MOVED_USERS --> execute gla, execute gra, return to select, execute pri, return ends script
MEMBER OF GRAMPIAN-GRP --> execute gra, return to select, execute pri, return ends script
MEMBER OF PRIME-GRP --> execute pri, return to select, execute pri, return ends script
MEMBER OF PANDD-GRP --> execute pan, return to select, execute pri, return ends script

Check your SUBS and place an exit

Win95 hint: Does kixtart.log in the windows\temp dir display an error??
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#24991 - 2002-07-16 11:47 PM Re: Problems with script - Gosub command
Cazzjh Offline
Fresh Scripter

Registered: 2002-06-04
Posts: 32
Loc: Glasgow, Scotland
Yeah - I put the exit in - still no joy - although it seems to be working for NT users now but not Windows 95!
_________________________
Cazzjh

Top
#24992 - 2002-07-17 12:02 AM Re: Problems with script - Gosub command
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
What about the kixtart.log and the other suggestions of Lonkero???
quote:
cazz, if you suspect your script is not going to gra do a line:
? "in gra"

just after:
:gra

Please post new code...

[ 17 July 2002, 00:03: Message edited by: MightyR1 ]
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#24993 - 2002-07-17 12:12 AM Re: Problems with script - Gosub command
Cazzjh Offline
Fresh Scripter

Registered: 2002-06-04
Posts: 32
Loc: Glasgow, Scotland
Tried that - it doesn't go to any of the sub routines. Here is the new code:

code:
 SELECT
CASE INGROUP ("MOVED_USERS")
GOSUB gla
CASE INGROUP ("GRAMPIAN-GRP")
GOSUB gra
CASE INGROUP ("PANDD-GRP")
GOSUB pan
CASE 1
; not in any of the above groups
ENDSELECT
EXIT

:GLA
?"in GLA"
? "USERS NAME IS " + @fullname
? "MACHINE NAME IS " + @wksta
? "IP ADDRESS IS " + @ipaddress0
? "CPU IS " + @cpu
? "OPERATING SYSTEM IS " + @producttype
? "SERVICE PACK IS " + @csd
?
?
If @INWIN=1
If InGroup("IT-PRINT1-GRP")
$null=AddPrinterConnection("\\Gfclnt04\CITSL4C1")
$null=AddPrinterConnection("\\Gfclnt04\CITSLJ03")
$null=AddPrinterConnection("\\Gfclnt04\AITSL502")
$null=AddPrinterConnection("\\Gfclnt04\AITSL501")
$null=SetDefaultPrinter("\\Gfclnt04\AITSL502")
? "Added printer connection.........."
ENDIF

IF InGroup("IT-PRINT2_GRP")
$null=AddPrinterConnection("\\Gfclnt04\CITSL4C1")
$null=AddPrinterConnection("\\Gfclnt04\CITSLJ03")
$null=AddPrinterConnection("\\Gfclnt04\AITSL502")
$null=AddPrinterConnection("\\Gfclnt04\AITSL501")
$null=SetDefaultPrinter("\\Gfclnt04\AITSL501")
? "Added printer connection.........."
ENDIF

If InGroup("checkline-grp")
MapDrive("H:","GCKLNT01","wineftnt")
Endif

IF InGroup("MOVED_USERS")
SHELL 'SUBST U: /D '
SHELL 'SUBST U: "\\gfclnt03\users\%username%" '
ENDIF

IF InGroup("RESEARCH-GRP")
MapDrive("Z:","GAPPNT02","RESEARCH")
ENDIF

Else ; Win95

IF InGroup("MOVED_USERS")
MapDrive("U:","gfclnt03","users")
CD U:\users\@userid
ENDIF
Endif

:GRA
?"in GRA"
IF @INWIN = 1
IF InGroup("LOCAL_ADMINS")
SHELL "CMD /C SUBST U: /D"
ELSE
SHELL 'SUBST U: /D '
SHELL 'SUBST U: "\\QCLUNT01\users\%username%" '
ENDIF

ELSE ; win95

MapDrive("U:", "QCLUNT01", "users")
cd U:\users\@USERID
ENDIF

:PAN
?"in PAN"
IF @INWIN = 1
SHELL 'SUBST U: /D '
SHELL 'SUBST U: "\\lbdcnt01\%username%" '

ELSE ; Win95
MapDrive("U:", "lbdcnt01", "Users")
CD U:\users\@userid
ENDIF

IF InGroup("PRIME-GRP")
MapDrive("J:","LAPPNT02","AREV31")
MapDrive("F:","LAPPNT02","PSDATA")
ENDIF

IF InGroup("PANDD-GRP")
MapDrive("J:","LFILNT01","PearlAndDean")
MapDrive("K:","LAPPNT01","ACT")
ENDIF

IF InGroup("Scottish Magazines")
MapDrive("N:","GAPPNT04","ScottishMagazines")
ENDIF

IF InGroup("Solus-Grp")
MapDrive("Q:","GAPPNT04","SolusBookingSystem")
ENDIF

IF InGroup("ADQUICK-GRP")
MapDrive("G:","GTPSNT01","Quick")
ENDIF

IF InGroup("CUSTSERV-GRP")
MapDrive("R:","GAPPNT02","CSDBase")
ENDIF

IF InGroup("SATEAM-GRP")
MapDrive("X:","GMSHNT01","TECH_SUPPORT")
ENDIF

IF InGroup("MOVE-GRP")
MapDrive("J:","GFCLNT04","CentralServices")
ENDIF

IF InGroup("CENTRALS-GRP") ;
MapDrive("J:","GFCLNT04","CentralServices")
ENDIF

IF InGroup("GPNCENTRALS-GRP") ;
MapDrive("N:","QCLUNT01","CentralServices")
ENDIF

IF InGroup("BROADCAS-GRP")
MapDrive("K:","GFCLNT04","Broadcasting")
ENDIF

IF InGroup("BROADDIST-GRP")
MapDrive("I:","GFCLNT04","Broadcasting")
ENDIF

IF InGroup("GPNBROADCAST-GRP")
MapDrive("O:","QCLUNT01","Broadcasting")
ENDIF

IF InGroup("PUBLISHI-GRP")
MapDrive("L:","GFCLNT04","Publishing")
ENDIF

IF InGroup("S1-GROUP")
MapDrive("V:","GAPPNT03","S1")
USE V: "\\GAPPNT03\S1"
ENDIF

IF InGroup("COGNOS-USERS")
MapDrive("Y:","GTPSNT01","cognos")
ENDIF

IF InGroup("SUNDAY-GRP")
MapDrive("S:","GMSHNT01","Sunday")
ENDIF

IF InGroup("STE-GRP")
MapDrive("M:","GFCLNT04","Broadcasting")
ENDIF

IF InGroup("MARKETIN-GRP")
MapDrive("T:","GAPPNT05","Despatch_DB")
ENDIF

IF InGroup("MARKETDB-GRP")
MapDrive("S:","GAPPNT05","NSDOCS")
ENDIF

IF InGroup("MAGASUBS-GRP")
MapDrive("F:","GAPPNT02","MAGAZINES")
ENDIF

IF InGroup("GPNPUBLIC-GRP") ;
MapDrive("Q:","QCLUNT01","Public")
ENDIF

MapDrive("P:","GMSHNT01","Public")

RETURN


;--------------------------------------------------------------------------------------------------
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)
Color w+/n
Else
WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'")
Endif
Endfunction
;--------------------------------------------------------------------------------------------------
Function WriteLog($text)
dim $RC, $text, $LogFile, $Filehandle
$Filehandle = 1
$LogFile = "\\Gfclnt03\Users\LoginLogs\logon.log"
$RC=Writeline ($Filehandle, "@Date @Time - $Text" + Chr(13) + Chr(10))
if $RC<0
$RC=Close ($Filehandle)
$RC=Open ($Filehandle, $LogFile, 5)
Select
Case $RC=-1
$RC=MessageBox ("Invalid file name ($LogFile) specified for log file.","Logon Script Error",48)
Case $RC=0
WriteLog ($Text)
Case $RC=>0
$RC=MessageBox ("Error($RC) while attempting to open log file ($LogFile).","Logon Script Error",48)
Endselect
Endif
EndFunction


_________________________
Cazzjh

Top
#24994 - 2002-07-17 12:18 AM Re: Problems with script - Gosub command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
try then with subnames like this:
GOSUB "gla"

it's right there in syntax somewhere...
the gosubbing just isn't the easiest one to browse...
_________________________
!

download KiXnet

Top
#24995 - 2002-07-17 12:36 AM Re: Problems with script - Gosub command
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Don't forget your returns at the and of each sub. Otherwise if the top most sub is called, all subs are executed (before the next sub there isn't a return)

Also try following
code:
$rc=INGROUP ("MOVED_USERS")
? "RC MOVED_USERS" + chr(9) + chr(9) + "= $rc"
;
$rc=INGROUP ("GRAMPIAN-GRP")
? "RC GRAMPIAN-GRP" + chr(9) + chr(9) + "= $rc"
;
$rc=INGROUP ("GRANDD-GRP")
? "RC GRANDD-GRP" + chr(9) + chr(9) + "= $rc"
;
SELECT
CASE INGROUP ("MOVED_USERS")
? "Jump 2 gla"
GOSUB gla
? "Back from gla"
;
CASE INGROUP ("GRAMPIAN-GRP")
? "Jump 2 gra"
GOSUB gra
? "Back from gra"
;
CASE INGROUP ("PANDD-GRP")
? "Jump 2 pan"
GOSUB pan
? "Back from pan"
;
CASE 1
? "Jump 2 nothing"
; not in any of the above groups
ENDSELECT
;
exit (0)
;
:gra
? "in gra"
return
;
:pan
? "in pan"
return
;
:gla
? "in gla"
return



[ 17 July 2002, 07:47: Message edited by: MightyR1 ]
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#24996 - 2002-07-17 12:39 AM Re: Problems with script - Gosub command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
cazz, I also sent you e-mail some time ago.
have you tested with that?
_________________________
!

download KiXnet

Top
#24997 - 2002-07-17 04:12 PM Re: Problems with script - Gosub command
Cazzjh Offline
Fresh Scripter

Registered: 2002-06-04
Posts: 32
Loc: Glasgow, Scotland
Lonkero

Didn't receive any code - can you send again?? [Big Grin]
_________________________
Cazzjh

Top
#24998 - 2002-07-22 06:14 PM Re: Problems with script - Gosub command
Cazzjh Offline
Fresh Scripter

Registered: 2002-06-04
Posts: 32
Loc: Glasgow, Scotland
My thanks to everyone who helped me with this - script is now in place and working well.

Cheers!!! [Big Grin]

[ 22 July 2002, 18:14: Message edited by: Cazzjh ]
_________________________
Cazzjh

Top
#24999 - 2002-07-22 06:26 PM Re: Problems with script - Gosub command
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I think that you still have opportunities to reduce your code.

What was the major problem that was resolved to get the code working?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#25000 - 2002-07-24 03:24 PM Re: Problems with script - Gosub command
Cazzjh Offline
Fresh Scripter

Registered: 2002-06-04
Posts: 32
Loc: Glasgow, Scotland
The select statement at the beginning - I had to introduce another section saying if in the prime & pannd group - do this.

Took me a while to figure out I must admit!!!!

Also put a return after each group telling the script to end.

The dummy code that MightyR1 gave me was a big help as was the code Lonkero sent to me!! [Big Grin]

[ 24 July 2002, 15:25: Message edited by: Cazzjh ]
_________________________
Cazzjh

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 669 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.034 seconds in which 0.013 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