Originally Posted By: Seks
How do I check this @error state???

There are several ways to check the error. You can write it to a log file, or print it to the console, etc...Try the below, which now has a messagebox right after the Use commands. This will also help ensure that the script is running.
 Code:
; Breakdown of IP address------------------------------------------------------------------------

$1st_octet = LTRIM(SUBSTR(@ipaddress0,1,3))
$2nd_octet = LTRIM(SUBSTR(@ipaddress0,5,3))
$3rd_octet = LTRIM(SUBSTR(@ipaddress0,9,3))
$4th_octet = LTRIM(SUBSTR(@ipaddress0,13,3))

;-----------------------------------------------------------------------

USE G: /DELETE /PERSISTENT
USE P: /DELETE /PERSISTENT
USE Q: /DELETE /PERSISTENT
USE R: /DELETE /PERSISTENT
USE X: /DELETE /PERSISTENT
USE Y: /DELETE /PERSISTENT
USE Z: /DELETE /PERSISTENT

USE Z: "\\srs.com\dfs\documents"
$nul = MessageBox("Z: Mapping attempted to srs.com"+@CRLF+"Error: "+@Error+@CRLF+"Desc: "+@SError,"Use Status",0)

SELECT
CASE $3rd_octet = 0
USE P: "\\srs-edm06\public$"
$nul = MessageBox("P: Mapping attempted to srs-edm06"+@CRLF+"Error: "+@Error+@CRLF+"Desc: "+@SError,"Use Status",0)
CASE $3rd_octet = 1
USE P: "\\srs-nisku01\public$"
$nul = MessageBox("P: Mapping attempted to srs-nisku01"+@CRLF+"Error: "+@Error+@CRLF+"Desc: "+@SError,"Use Status",0)
CASE $3rd_octet = 2
USE P: "\\srs-edmfab01\public$"
$nul = MessageBox("P: Mapping attempted to srs-edmfab01"+@CRLF+"Error: "+@Error+@CRLF+"Desc: "+@SError,"Use Status",0)
CASE $3rd_octet = 3
USE P: "\\srs-edmmod01\public$"
$nul = MessageBox("P: Mapping attempted to srs-edmmod01"+@CRLF+"Error: "+@Error+@CRLF+"Desc: "+@SError,"Use Status",0)
ENDSELECT

IF INGROUP("SRS10104 - FTP")
USE X: "\\SRS10104\FTPROOT"
$nul = MessageBox("X: Mapping attempted to SRS10104"+@CRLF+"Error: "+@Error+@CRLF+"Desc: "+@SError,"Use Status",0)
ENDIF

I guess I should note, that this is obviously not recommended for production as it will pop a message box for every mapping attempt.


Edited by ShaneEP (2012-04-09 06:54 PM)