Page 1 of 1 1
Topic Options
#119676 - 2004-05-17 03:53 PM WriteLine on Error Problem
Trox Offline
Fresh Scripter

Registered: 2002-09-17
Posts: 34
Loc: St. Petersburg, FL
I am having problems getting the following code to write the $sPC variable to a seprate text file. I know the command I want to run ~WriteLine (2,$sPC+Chr(13)+Chr(10))~ but I am not sure how to place it in the script to run ONLY when the $sPC is not found or fails.

Code:
  Color y+/n
? "Pushing Security Settings for Visual Audit Now ....."
?
If NOT Open(1,"\\spghmbrsrv02\soft$\1_Audit Folder\pclist.txt")
If NOT Open(2,"\\spghmbrsrv02\soft$\1_Audit Folder\pcfaillist.txt")
$sPC=ReadLine(1)
While $sPC
Color w+/n
?" Setting security on: "+$sPC
?" "
MD "\\"+$sPC+"\c$\Documents and Settings\All Users\Application Data\Visionsoft"
Color m+/n
Shell '%comspec% /c \\spghmbrsrv01\netlogon\XCACLS "\\'+$sPC+'\c$$\Documents and Settings\All Users\Application Data\Visionsoft" /Y /C /T /G Everyone:F'
$sPC=ReadLine(1)
Loop
$=Close(1)
EndIf



_________________________
Thanks ~ Trox John Wayne's not dead - he's frozen. And as soon as we find the cure for cancer we're gonna thaw out the duke and he's gonna be pretty pissed off! ~Dennis Leary~

Top
#119677 - 2004-05-17 04:27 PM Re: WriteLine on Error Problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
First off, I don't see you opening the file in write mode. You need to check the @Error that should hold the %errorlevel% of the SHELLed command. Alternately if %errorlevel% is not captured, you could redirect the STDERR to a file directly. See the FAQ for info on SHELL, RUN, STDOUT, and STDERR.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#119678 - 2004-05-17 04:58 PM Re: WriteLine on Error Problem
Trox Offline
Fresh Scripter

Registered: 2002-09-17
Posts: 34
Loc: St. Petersburg, FL
Ahh.... Didn't think about the @ERROR and the open in write mode was a type .

Works great. Thanks for the help!!!
_________________________
Thanks ~ Trox John Wayne's not dead - he's frozen. And as soon as we find the cure for cancer we're gonna thaw out the duke and he's gonna be pretty pissed off! ~Dennis Leary~

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.054 seconds in which 0.028 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