Jump to content

Recommended Posts

Posted

Hello,

I am attempting to pass in a String with each word surrounded by quotes and would like for it to be typed in an input field. I have tried escaping it in the Java code, but that doesn't seem to accomplish anything. Unsure if I need to make changes in the arguments or the actual AutoIt script, or both. Appreciate any help.

String I attempt to pass to executable: "\"test1\" \"test2\" \"test3\""
What ends up being typed into field: test1

What I want entered:
"test1" "test2" "test3"

Posted

If you use single quote to define the string and double quotes as part of your string or simply using double quotes twice as escaping.

$var = '"test"'
$var = """test"""

 

Posted (edited)
  On 6/10/2023 at 4:55 PM, Andreik said:

If you use single quote to define the string and double quotes as part of your string or simply using double quotes twice as escaping.

$var = '"test"'
$var = """test"""

 

Expand  

Thanks Andreik.

What worked for me was as below in the script:

'"' & $CmdLine[2] & '"'
(Single quote, double quote, single quote)

Argument in Java for command as below: Was important not to have spaces between the escaped quotes. If spaces are included in this solution, then only "test1" is entered into field.

"\"test1\"\"test2\"\"test3\""

Edited by BadBackOz
Posted (edited)

Yes, if your string is given as a parameter you can simply concatenate using double quote between single quotes. And you can also use this style, even if I find it kinda ugly for me eyes and for reading in general.

"""" & $CmdLine[2] & """"

 

Edited by Andreik
typo
Posted (edited)

I wish autoit had

$data = `"{$CmdLine[2]}"`

or similar, it would be much more pleasant experience for eyes

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)

  Reveal hidden contents


460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

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