bourny Posted July 6, 2004 Share Posted July 6, 2004 SlimShady helped me with a runwait with variables earlier... This worked a treat however I have done a similar function in a different script this time using quotes and it fails..The error I get is not with the variables defined at the top but is with the runwait calling the variables.. Error states system could not find the file specified.This error is obviously due to an incorrect format in the top two strings ... however if I take the quetes out it mangs on about an error in the variables..see script below*************$a= "@comspec & ' /c find /i "". "$b= " "" >> C:\analyse\found.txt' "fileCopy("\\servername\whwash\suffix\suffix.wash", "c:\analyse\suffix.wash", 0)$suffix_open=FileOpen("c:\analyse\suffix.wash", 0) If $suffix_open = -1 Then $date = @MON & "/" & @mday & "/" & @year $time = "....Time: " & @HOUR & ":" & @MIN ;error - unable to open suffix file $fail = FileOpen("\\rssncl1dm1\whwash\analyse\analyse.txt", 1) FileWriteLine($fail, "Mark B: - Whitewash Script Failed - Could not open found.txt) FileClose($fail)ExitEndIfWhile 1 $suffix = FileReadLine($suffix_open) If @error = -1 Then ExitLoop RunWait($a & $suffix & $b, @scriptdir, @SW_HIDE) WendBourny Link to comment Share on other sites More sharing options...
RDSchaefer Posted June 30, 2007 Share Posted June 30, 2007 SlimShady helped me with a runwait with variables earlier... This worked a treat however I have done a similar function in a different script this time using quotes and it fails..The error I get is not with the variables defined at the top but is with the runwait calling the variables.. Error states system could not find the file specified.This error is obviously due to an incorrect format in the top two strings ... however if I take the quetes out it mangs on about an error in the variables..see script below*************$a= "@comspec & ' /c find /i "". "$b= " "" >> C:\analyse\found.txt' "fileCopy("\\servername\whwash\suffix\suffix.wash", "c:\analyse\suffix.wash", 0)$suffix_open=FileOpen("c:\analyse\suffix.wash", 0) If $suffix_open = -1 Then $date = @MON & "/" & @mday & "/" & @year $time = "....Time: " & @HOUR & ":" & @MIN ;error - unable to open suffix file $fail = FileOpen("\\rssncl1dm1\whwash\analyse\analyse.txt", 1) FileWriteLine($fail, "Mark B: - Whitewash Script Failed - Could not open found.txt) FileClose($fail)ExitEndIfWhile 1 $suffix = FileReadLine($suffix_open) If @error = -1 Then ExitLoop RunWait($a & $suffix & $b, @scriptdir, @SW_HIDE) WendBournyI don't understand why you make it so complicated. Try this:CODERunWait('@comspec /c find /i ". ' & $suffix & ' " >> C:\analyse\found.txt') Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 30, 2007 Share Posted June 30, 2007 (edited) I don't understand why you make it so complicated. Try this: RunWait('@comspec /c find /i ". ' & $suffix & ' " >> C:\analyse\found.txt') You're right, but it might make sense to do it the long way if you are doing it in a loop or function that will be assembling different command lines each time it's run. In that case, the way to trouble shoot is assemble the whole thing as a variable and check it with a debug message (MsgBox or ConsoleWrite): ; RunWait($a & $suffix & $b, @scriptdir, @SW_HIDE) $ExtCmd = $a & $suffix & $b MsgBox(64, "Debug:$ExtCmd", $ExtCmd) ; Temporary debug message RunWait($ExtCmd, @scriptdir, @SW_HIDE) Now you can check if the command line is really coming out as intended, pay particular attention to resulting pair of single and double quotes... gets 'em every time. Edited June 30, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now