#24988 - 2002-07-16 10:01 PM
Re: Problems with script - Gosub command
|
Cazzjh
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
|
|
|
|
#24990 - 2002-07-16 11:02 PM
Re: Problems with script - Gosub command
|
MightyR1
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
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
|
|
|
|
#24993 - 2002-07-17 12:12 AM
Re: Problems with script - Gosub command
|
Cazzjh
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
|
|
|
|
#24999 - 2002-07-22 06:26 PM
Re: Problems with script - Gosub command
|
Howard Bullock
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?
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 669 anonymous users online.
|
|
|