Jump to content

Help with "escape character"


Recommended Posts


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.jpg

Wich 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.


Edited by Janne
Link to comment
Share on other sites

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.


; 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
Link to comment
Share on other sites

  • 1 month later...

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?

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...