SpecialK99 Posted November 20, 2011 Share Posted November 20, 2011 Hi I'm new to AutoIt and am trying to convert some Perl scripts to AutoIT. I have a Perl script to backup some files using WinZIP command line program (WZZIP) and pipe the text output to a logfile. I then examine the logfile for any errors. I've managed to convert the script to AutoIT and I can get it to call WZZIP and create the required ZIP file. But instead of the output being piped to a logfile (e.g. " > logfile.txt") the carat character ">" is being interpreted by WinZIP as a additional file to backup and results in a WinZip error saying there is no file called ">" to backup, the same thing occurs with the "logfile.txt" reference. Consquently all the text output from WinZip of what files are being backed up is going to the console window rather than a text file. It looks like the AutoIT Run command is calling WinZip but "> Log. txt" is being interpreted as parameters by Winzip rather than a piped command. Yet this type of call works in Perl. Here's part of my code $dt1 is todays date $tm1 is the time now The above date/time works fine, it's just the piping output I'm having a problem with # Zipfile name $zip1 = "Agent_" & $dt1 & "_" & $tm1 & ".zip" # Path to output directory $pth1 = "C:\My Files\Install 1\" # Directory to backup $pth2 = "C:\Documents and Settings\Special K\My Documents\COMMSbase\Agent\Data\*.*" # WinZip program $prg1 = "C:\My Files\Utilities\WinZip\WZZip" # WinZip options $opt1 = "-a -p -rP" # Concatenate output path and Zipfile name $zip2 = $pth1 & $dt1 & "_" & $dy2 & $zip1 # Logfile $log1 = $pth1 & $dt1 & "_" & $dy2 & "\Agent_" & $dt1 & "_" & $tm1 & "_Log.txt" ConsoleWrite( $tm1 & " Backup Agent files..." & @CRLF ) ConsoleWrite( "Filename: " & $zip1 & @CRLF ) Run( $prg1 & " " & $opt1 & " """ & $zip2 & """ """ & $pth2 & """ > """ & $log1 & """" ) Should I be using a different command than "Run" to call WinZIP as I have the pipe embedded in the call ? Link to comment Share on other sites More sharing options...
water Posted November 20, 2011 Share Posted November 20, 2011 Maybe helps. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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