Sign in to follow this  
Followers 0
bourny

RunWait with variables

5 posts in this topic

I need to do a runwait with variables ... how would I do this ...

Example script below - problem in red

I dont think you can use runwait in this way however can anyone suggest a workaround

$a="@comspec & ' /c Dir /b /s c:\*."

$c=" >> c:\whwash\cfile.wash',@scriptdir,@SW_HIDE"

FileCopy ("\\Servername\whwash\Suffix\suffix.wash", "c:\whwash\suffix.wash" ,1 )

$suffix_open=FileOpen("c:\whwash\suffix.wash", 0)

If $suffix_open = -1 Then

$fail = FileOpen("c:\whwash\whfail.log", 1)

FileWriteLine($fail, "Script Failed - Could not open suffix.wash")

FileClose($fail)

Exit

EndIf

While 1

$suffix = FileReadLine($suffix_open)

If @error = -1 Then ExitLoop

RunWait ($a & $suffix & $C)

Wend

FileClose("$suffix_open")

Bourny....

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

change the c$ setting because the workindir and the flag cannot come with the end of the first parameter

$c=" >> c:\whwash\cfile.wash'"

.....

RunWait ($a & $suffix & $C, @scriptdir, @SW_HIDE)

:D Edited by jpm

Share this post


Link to post
Share on other sites

I have tried your suggestion but this does not work... Am Imisunderstanding your comment...

new script below

$a="@comspec & ' /c Dir /b /s c:\*."

$c=" >> c:\whwash\cfile.wash'"

FileCopy ( "\\servername\whwash\Suffix\suffix.wash", "c:\whwash\suffix.wash" ,1 )

$suffix_open=FileOpen("c:\whwash\suffix.wash", 0)

If $suffix_open = -1 Then

$fail = FileOpen("c:\whwash\whfail.log", 1)

FileWriteLine($fail, "Whitewash Script Failed - Could not open suffix.wash")

FileClose($fail)

Exit

EndIf

While 1

$suffix = FileReadLine($suffix_open)

If @error = -1 Then ExitLoop

;RunWait ($a & $suffix & $C)

RunWait ($a & $suffix & $C, @scriptdir, @SW_HIDE)

Wend

FileClose("$suffix_open")

bourny

Share this post


Link to post
Share on other sites

Try this:

$a = @comspec & ' /c Dir /b /s c:\*.'
$c = ' >> c:\whwash\cfile.wash'

FileCopy("\\servername\whwash\Suffix\suffix.wash", "c:\whwash\suffix.wash", 1)
$suffix_open = FileOpen("c:\whwash\suffix.wash", 0)

If $suffix_open = -1 Then
$fail = FileOpen("c:\whwash\whfail.log", 1)
FileWriteLine($fail, "Whitewash Script Failed - Could not open suffix.wash")
FileClose($fail)
Exit
EndIf


While 1
$suffix = FileReadLine($suffix_open)
If @error = -1 Then ExitLoop
;RunWait ($a & $suffix & $C)
RunWait ($a & $suffix & $C, @scriptdir, @SW_HIDE)
Wend

FileClose("$suffix_open")

Share this post


Link to post
Share on other sites

Thanks Slim..

Looks like if I read you correct I was using "" when this was unnecessary for the variable

Bourny... :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0