Audrey Posted May 4, 2011 Share Posted May 4, 2011 (edited) Hihi, Here an example that I can't get it right! This a command line exe file with more than one double-double quotes and some commands that are used for settings in that exe. Using the DOS prompt is't working OK: Start T2P.exe "C:\Program Files\Table\banana.bmp" "C:\Program Files\Table\apple.jpg" -PRB -S35 -CWE -TTE Now this has to be used in a AutoIt script. I use the following line and it worked OK as well. Run(@ComSpec & " /c " & 'Start T2P.exe "C:\Program Files\Table\banana.bmp" "C:\Program Files\Table\apple.jpg" -PRB -S35 -CWE -TTE', "", @SW_SHOW) Now comes the crazy part: Some parts has to be variable, like the "C:\Program Files\Table\Pic.jpg" part and "-S35" part. Because the line is wrapped in single quotes, it turn into gray, which means, this is one big string. So I think its then not possible anymore to add these extra variables. I there any one out there who can help me with this? Edited May 4, 2011 by Audrey Link to comment Share on other sites More sharing options...
DarkestHour Posted May 4, 2011 Share Posted May 4, 2011 (edited) Ok, so to Use variables inside of quotes you would do something like this: "c:\Path" & $VARIABLE & "File.txt" Say $VARIABLE was \Folder1\. This would mean to Autoit and any commands you pass it would read it as c:\Path\Folder1\File.txt So in Summary, if you interrupt the quotes and then Add on data with Ampersand, you can accomplish this task. Edit: Also you would need to Interrupt both sets of Quotes, being ' ' and " ", to do this properly. Edited May 4, 2011 by DarkestHour Link to comment Share on other sites More sharing options...
Mobius Posted May 4, 2011 Share Posted May 4, 2011 (edited) As mentioned take careful note of the quote types and instances and spaces in the command string. Here is an example concerning your request. $FileA = '"C:\Program Files\Table\banana.bmp"' $FileB = '"C:\Program Files\Table\apple.jpg"' $SwitchParams = "-PRB -S35 -CWE -TTE" Run('T2P.exe '& $FileA &' '& $FileB &' '& $SwitchParams, "", @SW_SHOW) Remember that since TIFF2PDF is a console program if its own console window does not remain after it has finished its operations then you will need to capture its output otherwise you will get a brief flash of a console window and thats it. Edited May 4, 2011 by Mobius Link to comment Share on other sites More sharing options...
Audrey Posted May 5, 2011 Author Share Posted May 5, 2011 Hi Friends, Thanks for both for the inputs !!!!! This was very helpful. I also wanted the "c:\Program Files" part into @ProgramFilesDir and after 30 attempts its working now. Thanks again! Audrey Link to comment Share on other sites More sharing options...
MvGulik Posted May 5, 2011 Share Posted May 5, 2011 Mmm, why do manual quoting if it can be done for you ... when needed. func QuoteMeIfNeeded($sData) if not StringHasSpace($sData) then return return '"' & $sData & '"' endfuncdim constant $DELIM = ' ' dim $sApplication = 'MyApp.exe' dim $sFilespec = 'C:\Program Files\Table\apple.jpg' if not fileExist($sApplication) then Debug_Exit('He!, your calling a executable that''s not there.') dim $sRunString = QuoteMeIfNeeded($sApplication) & $DELIM & QuoteMeIfNeeded($sFilespec) debugOut('Used Run() string = ' & $sRunString) Run($sRunString, "", @SW_SHOW)More typing, but way less ... attempting. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... 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