Im not a code guy

I don't know how to step thru

This is the full script
 Code:
; GLOBAL VARIABLE DEFINITION

$homedrive = "G:\"
$printserver = "\\print\"
$printserver2 = "\\print2\"
$printsetlocation = "\\storage\clients\"


; LOGON.LOG creation
; Creates a log file  (logon.log) in a user's home directory with the date and time of logon, userid, 
; client name logged on to. Logs mapped drives, printers connected and errors

; Create a backup copy of the last log, delete the last backup

IF EXIST($homedrive + "logon.log")
	IF EXIST($homedrive + "logon.bak")
		DEL $homedrive + "logon.bak"		
	ENDIF
	MOVE $homedrive + "logon.log" $homedrive + "logon.bak"
ENDIF		

$logopen =  OPEN(5,$homedrive + "\logon.log",5)
If ($logopen <> 0)
	GOTO Logerror
ENDIF 

;? "Logopen is " + $logopen

WRITELINE(5, @DATE + " " + @TIME + @CRLF)
WRITELINE(5, "UserID: " + @USERID + " " + "Client Name: " + %clientname% + @CRLF)




; MAP NETWORK DRIVES

IF  INGROUP("Information Systems")
	Mapdrive ("H:", "\\storage\is")
ENDIF


IF INGROUP ("pcon")
	Mapdrive ("P:", "\\pcon\cmapp")
ENDIF


IF INGROUP("Network Admins")
	Mapdrive ("I:", "\\storage\network")
ENDIF

IF (INGROUP("OrSchdRpt") OR INGROUP("Information Systems"))
	Mapdrive ("S:", "\\orsos\orsos")
ENDIF

IF INGROUP("Systoc")
	Mapdrive ("T:", "\\ohrsystoc\systoc71")
ENDIF

IF INGROUP("Kronos")
	Mapdrive ("J:", "\\kronos\kronos")
ENDIF

IF INGROUP("MRDATA")
	Mapdrive ("M:", "\\mhsprint\mr-data")
ENDIF

IF INGROUP("nrmi")
	Mapdrive ("R:", "\\mhsprint\nrmi")
ENDIF

IF INGROUP("App - Nebo")
	Mapdrive ("x:", "\\nebo\nebo")
ENDIF

IF INGROUP("MapFDrive")
	Mapdrive ("f:", "\\client\f$")
ENDIF    

IF INGROUP("MSSO")
	Mapdrive ("T:", "\\MSSO\MSSO")
ENDIF                            

IF INGROUP("PeerReview")
	Mapdrive ("R:", "\\storage\Peerreview")
ENDIF                            
; MAP PRINTERS




; Open Printset.INI from $printsetlocation\%clientname%, store error code into variable 
; FileExist

$FileExist = OPEN(1, $printsetlocation + %clientname% + "\printset.ini")

; If The FileExist variable is 2, that means the file does not exist. Display an error
; message

;? "FileExist Variable is " + $FileExist

IF $FileExist = 2
	GOTO NoPrinterFile

ENDIF

; Read and discard the first 9 lines of the file

FOR $count = 1 TO 9
$nextline = READLINE(1)
NEXT

; Read the next line of the file which will be the default printer if it exists

$nextline = READLINE(1)

; The printset.ini has 9 lines of text description and then the following 5 lines look like

; Printer1 = 00is-lan
; Printer2 = 00is-ops

; The name of the printer starts one character after the space following the '=' -  the twelfth character from the left

$printer = SUBSTR($nextline,12)

IF Left(@WKSTA, 5) = "55PUL"
	GOTO Pulaski
Else
	GOTO Mercy
ENDIF

:Mercy

; a VARTYPE of 8 means that the value of $printer is a string, try to map the printer

IF (VARTYPE($printer) = 8) 
	$error = AddPrinterConnection($printserver + $printer)
	IF ($error = 0)
		WRITELINE(5, "Mapped Default Printer to " + $printserver + $printer + @CRLF)
		; The SetDefaultPrinter command relies on the printer NAME not the printer SHARE
		SetDefaultPrinter($printserver + $printer)
	ELSE
		WRITELINE(5, "An error occurred mapping the Default Printer to " + $printserver + $printer +@CRLF)
	ENDIF
ENDIF

; Read the next 4 lines of the file and concatenate them. Check to see if they are empty.

FOR $count = 1 TO 4
$nextline = READLINE(1)
$printer = SUBSTR($nextline,12)
IF VARTYPE($printer) = 8
	$error = AddPrinterConnection($printserver + $printer)
	IF $error = 0
		WRITELINE(5,"Created a Printer Connection to " + $printserver + $printer + @CRLF)
	ELSE
		WRITELINE(5,"An error occurred creating a printer connection to " + $printserver + $printer + @CRLF)
	ENDIF

;Pulaski

IF (VARTYPE($printer) = 8) 
	$error = AddPrinterConnection($printserver2 + $printer)
	If ($error = 0)
		WRITELINE(5, "Mapped Default Printer to " + $printserver2 + $printer + @CRLF)
		; The SetDefaultPrinter command relies on the printer NAME not the printer SHARE
		SetDefaultPrinter($printserver2 + $printer)
	ELSE
		WRITELINE(5, "An error occurred mapping the Default Printer to " + $printserver2 + $printer +@CRLF)
	ENDIF
ENDIF

; Read the next 4 lines of the file and concatenate them. Check to see if they are empty.

FOR $count = 1 TO 4
$nextline = READLINE(1)
$printer = SUBSTR($nextline,12)
IF VARTYPE($printer) = 8
	$error = AddPrinterConnection($printserver2 + $printer)
	IF $error = 0
		WRITELINE(5,"Created a Printer Connection to " + $printserver2 + $printer + @CRLF)
	ELSE
		WRITELINE(5,"An error occurred creating a printer connection to " + $printserver2 + $printer + @CRLF)
	ENDIF

ENDIF

NEXT

CLOSE(1)

;Setup PCON application


IF (INGROUP("Pcon")) OR (INGROUP("Helpdesk"))
	$pw = %clientname% + %username%
	$bivstak = substr($pw,1,10)
	shell "c:\logon\setx.exe bivstak " + $bivstak
	IF EXIST ("G:\WINDOWS\CMTEMPDB.MDB") = 0
		COPY "c:\LOGON\PATHWAYS\CMTEMPDB.MDB" "G:\WINDOWS\CMTEMPDB.MDB"
	ENDIF
ENDIF

:EndPconSetup

GOTO End

:NoPrinterFile
? "No Printer Mapping File found"
WRITELINE(5, "No Printer Mapping File found" + @CRLF)
Goto End

:Logerror

; If unable to open/create a log file that would probably indicate a permissions issue with a user's home drive
; Display a message and force user interaction.

? "Unable to open log file."
? "There may be a problem with your home drive. Please contact Information Systems"
? "Hit a key to continue"
?
WHILE (Kbhit() = 0)
SLEEP 1
LOOP

GOTO End

FUNCTION MapDrive ( $drive, $drivepath)
	USE $drive /DELETE
	USE $drive $drivepath
	IF (@ERROR = 0)
		WRITELINE(5, "Mapped Drive " + $drive + " to " + $drivepath + @CRLF)
	ELSE
		WRITELINE(5, "An error occurred when mapping drive " + $drive + " to " + $drivepath + @CRLF)
	ENDIF
ENDFUNCTION



:End

;Close Log File
CLOSE(5)
EXIT

Thanks in advance


Edited by Allen (2011-08-23 05:03 PM)
Edit Reason: added code tags