Jump to content
Sign in to follow this  
CarlFerrer

Unable to run DOS command for Beyond Compare tool

Recommended Posts

CarlFerrer

Good day,

I am trying to use AutoIt to automate file comparison and am using the code below. BCCompare.exe is for Beyond Compare application. This stops right at the M (in red), with a syntax error. What can be the issue?

 

#include <Process.au3>

Local $iRc = _RunDos("BCompare.exe @"My Script.txt" "My File.txt" "Your File.txt" "My Report.txt"")

 

Share this post


Link to post
Share on other sites
SadBunny

The second " in that line terminates the string, which makes AutoIt expect AutoIt code. Solution: "escape" the doublequotes by doubling them:

$line = "this is a ""quoted"" word"


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
CarlFerrer

Thanks, SadBunny!

Modified as suggested. No syntax error at this time, but still don't see my result.

Local $iRc = _RunDos("Bcompare.exe @""C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\cf_script.txt"" ""C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\subser1_1.txt"" ""C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\subser1_2.txt"" ""C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\cf_report.txt""")

When I tried this below in DOS, it works:

 

Bcompare.exe @"C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\cf_script.txt" "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\subser1_1.txt" "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\subser1_2.txt" "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\cf_report.txt"

 

Share this post


Link to post
Share on other sites
SadBunny

As the helpfile for _RunDos states, the return value is the exit code of the command. If you want to read the standard output (stdout) of a command, check the helpfile for StdoutRead(). Pay attention to the example, it is somewhat less straightforward than some other commands.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
qwert

Isn't this a good case for using single quotes to clarify strings being passed?

From the help file:

You can also use single-quotes like 'this' and 'here is a ' 'single-quote' ' - ok?'

You can mix quote types to make for easier working and to avoid having to double-up your quotes to get what you want.

Actually, the help file isn't quite correct.  It should show this as the example of use:

You can also use single-quotes like 'this' and 'here is a "single-quote" - ok?'

 

 

Edited by qwert
correct for error in help file's example

Share this post


Link to post
Share on other sites
BrewManNH

I would do it this way.

Local $iRc = Run('"FULLPATHTOTHEEXEFILE\Bcompare.exe "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\cf_script.txt" "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\subser1_1.txt" "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\subser1_2.txt" "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\cf_report.txt"')

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
BrewManNH

I would do it this way.

Local $iRc = Run('"FULLPATHTOTHEEXEFILE\Bcompare.exe "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\cf_script.txt" "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\subser1_1.txt" "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\subser1_2.txt" "C:\Users\Carlos\Desktop\MCAP_test_auto\autoit\cf_report.txt"')

 


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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  

×