Well you don't specify some key variables in the script you posted. Here is your script cleaned up some but still not working without the other variables being supplied/defined.

;ADD YOUR STUFF HERE SUCH AS A PRINTER OR DRIVE MAPPING, ETC. 
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Dim $Msg,$RC
Dim $Files,$Date,$Filename,$Ext,$Time
;There is no sense in running a ClearError function as the first item in the script
;When the script first starts there won't be any error.
$RC = ClearError()
;Moved the function to the bottom of the script - not required but
;a little easier to read that way

;You check if the user logging in matches $StringUsername but that name has not been
;defined anywhere in the script (at least not that you've posted)
If Not @USERID=$StringUsername
$Msg = MessageBox ('You must be logged onto this computer with your own Username '+
'and Password.','Access is Denied')
Quit 5 ;Set ERROR LEVEL to 5 for Access Denied
EndIf

Use X: /Del /Persistent ;Added the persistent switch
Select
Case InGroup ('NMDPS\D1ScheduleRead')
Use X: '\\NAS2\SPDistrict1' /User:@Domain+'\'+$StringUsername /Password:$StringPassword
Case InGroup ('NMDPS\D2SchudleRead')
Use X: '\\NAS2\SPDistrict2' /User:@Domain+'\'+$StringUsername /Password:$StringPassword
;Not 100% certain about the /Password:$StringPassword but don't think it
;would like a + sign being used there
$ErrCode = @ERROR
If $ErrCode <> 0
$Msg = MessageBox ('You have entered an incorrect password or you are logged into the '+
'computer as someone besides yourself. Please try again.','Invalid Password')
Quit 5 ;Set ERROR LEVEL to 5 for Access Denied
EndIf
Case 1
$Msg = MessageBox ('You do not have access to any District Folder. Please call the ' +
'Helpdesk @ XXX-XXXX. Thank you.','Access is Denied')
Quit 5 ;Set ERROR LEVEL to 5 for Access Denied
EndSelect

;If Not Exist ('X:\'+$StringUsername)
; MD 'X:\'+$StringUsername
;EndIf
;Better code for this might be to do something like this
If GetFileAttr('X:\'+$StringUsername) & 16
;Folder exists already so do nothing
Else
MD 'X:\'+$StringUsername
EndIf

$Msg = MessageBox ('Please wait while your files are copied to the Network. This may take ' +
'some time. A message box will appear to inform you when this is done.','Please Wait')
;Without placing some timer on the MessageBox the script will stop here waiting
;for the user to click OK. If they don't click OK then the script will just wait forever.

;Not sure why you're clearing errors here, if you have an error you should check what
;the error is and take appropriate action not just blindly reset an error.
$RC = ClearError()
;You also don't need to supply the Function again as it is already supplied so I removed it
;you just need to call it.

;Call the Driplus UDF.
Call @SCRIPTDIR + "\DirPlus.udf"
;removed the parenthesis from the name as that does not need to be part of the file name
;
;Enumerate all FILES on drive x:
;Change the drive to the you got in your setup.

$Files = DirPlus(@SCRIPTDIR+'\DSS_FLDA','/a-d')
;

;Split the date on the / character and the join the parts with no separation characters.
$Date = Join(Split(@Date,'/'),"")
;
;Get the filename without the drive letter so start counting at the 4th character.
$Filename = SubStr ($File, 4)
;
;Get the extension of the file.
$Ext = SubStr ($Filename, Len($Filename) - 4)
;
;Do the stuff inside the For each--next loop for each file found.
For Each $File In $Files
If $File
;Split the time at the : character and then join the parts with no separation characters.
$Time = Join(Split(@TIME,':'),"")
;Copy the file and rename it during the copy process.
Copy $File 'X:\'+$StringUsername+'\' + $Date + '_' + $Time + $Ext
$ErrCode = @ERROR
;Sleep 1 second to get the $Time var different for each file.
;You can use the @Ticks and RAND if you need more uniqueness
Sleep 1
EndIf
Next
$Msg = MessageBox('Your Files have been copied to the network.','File transfer Result')
;Del @SCRIPTDIR+'\DSS_FLDA\*.WMA'
Use X: /Del /Persistent

;***** Clear Error function
;Though for this purpose I really don't see the need for it.
Function ClearError()
Exit 0
EndFunction

;REMOVE THE FOLLOWING TEST LINE
;=======================================================================
;Exit the Script
;=======================================================================
Quit @ERROR

 


Edited by NTDOC (2006-04-13 02:27 AM)