vraind 0 Posted June 15, 2011 (edited) I am new to Autoit. I am writing a small script as follows $name = InputBox("File", "Enter a file name") DirCreate($name) RunWait(@WorkingDir &'\7za.exe' & 'a' &'$name' &'$name') The 3rd line is showing error. I want to use the directory created, to be zipped. please help. Edited June 15, 2011 by vraind Share this post Link to post Share on other sites
JohnOne 1,603 Posted June 15, 2011 What error is it showing? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
Tvern 11 Posted June 15, 2011 @WorkingDir &'\7za.exe' & 'a' &'$name' &'$name Evaluates to something like: C:\ScriptDir\7za.exea$name$name I think you are looking for something like: @WorkingDir & '\7za.exe a ' & $name & ' ' & $name This adds spaces and replaces the variables with the strings they contain. You probably want to add an extention to the destination archive like this: @WorkingDir & '\7za.exe a ' & $name & ' ' & $name & ".7z" Consolewrite() is usefull for testing when you are concatenating strings like this. If you run the following script you can easily see why your example wouldn't work: Global $name = "Foldername" ConsoleWrite(@WorkingDir &'\7za.exe' & 'a' &'$name' &'$name' & @CRLF) ;original string ConsoleWrite(@WorkingDir & '\7za.exe a ' & $name & ' ' & $name & ".7z" & @CRLF) ;revised string Share this post Link to post Share on other sites
vraind 0 Posted June 15, 2011 @WorkingDir &'\7za.exe' & 'a' &'$name' &'$name Evaluates to something like: C:\ScriptDir\7za.exea$name$name I think you are looking for something like: @WorkingDir & '\7za.exe a ' & $name & ' ' & $name This adds spaces and replaces the variables with the strings they contain. You probably want to add an extention to the destination archive like this: @WorkingDir & '\7za.exe a ' & $name & ' ' & $name & ".7z" Consolewrite() is usefull for testing when you are concatenating strings like this. If you run the following script you can easily see why your example wouldn't work: Global $name = "Foldername" ConsoleWrite(@WorkingDir &'\7za.exe' & 'a' &'$name' &'$name' & @CRLF) ;original string ConsoleWrite(@WorkingDir & '\7za.exe a ' & $name & ' ' & $name & ".7z" & @CRLF) ;revised string Tried the first one.Working fine. Thanks. Share this post Link to post Share on other sites