Janne Posted April 11, 2008 Posted April 11, 2008 (edited) Hello!I am trying to write a little application that you feed some information wich it processes and generates a PDF-file.I am using Imagemagick the generate the PDF-file.The input Imagemagick wants is the following:convert Image.jpg -draw "text 100,400 'Customer:'" Faktura.jpgWich in autoit becomes:RunWait('C:\Program\ImageMagick-6.4.0-Q16\convert c:\p1\Image.jpg -draw "text 100,400 "Customer: ' & $Cust1 & ' " " c:\p1\Image.jpg')So to sum up the problem:I dont know how to combine the ' " characters so that Autoit delivers the input Imagemagick wants.Any help is appreciated.//Janne Edited April 11, 2008 by Janne
junkew Posted April 11, 2008 Posted April 11, 2008 You should double or triple the quotes RunWait('C:\Program\ImageMagick-6.4.0-Q16\"convert Image.jpg -draw ""text 100,400 'Customer:'"" Faktura.jpg") FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
PsaltyDS Posted April 11, 2008 Posted April 11, 2008 The interesting point about the quote marks in an AutoIt literal string is that it works with EITHER a single or double quote. If you need to enclose literal single quotes, you put double quotes around the string. If you need to enclose double quotes, you put single quotes around the string. The only problem with this is if you need both literal single and double quotes in the same string. Then you DOUBLE-UP just the enclosing quote mark (no 'tripling' required). If the sting is enclosed in single quotes, then inside the string only the single quotes need to be doubled up. If the string is enclosed in double quotes, then double up any double quotes inside the string. Demo: ; Desired string is: convert Image.jpg -draw "text 100,400 'Customer:'" Faktura.jpg $sString = "convert Image.jpg -draw ""text 100,400 'Customer:'"" Faktura.jpg" ConsoleWrite("Double quotes: " & $sString & @LF) $sString = 'convert Image.jpg -draw "text 100,400 ''Customer:''" Faktura.jpg' ConsoleWrite("Single quotes: " & $sString & @LF) 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
vanowm Posted May 13, 2008 Posted May 13, 2008 Thanks guys for explanation. I'm very new to AU3 and already got "stuck" trying understand how the escape character works...In some cases you have to use backslash ( \ ) in some other cases you have to escape a character with the same character...sorry, but WT..! why such inconsistence?
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