BadBackOz Posted June 10, 2023 Posted June 10, 2023 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"
Andreik Posted June 10, 2023 Posted June 10, 2023 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"""
BadBackOz Posted June 11, 2023 Author Posted June 11, 2023 (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 June 11, 2023 by BadBackOz
Andreik Posted June 11, 2023 Posted June 11, 2023 (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 June 11, 2023 by Andreik typo
bogQ Posted June 13, 2023 Posted June 13, 2023 (edited) I wish autoit had $data = `"{$CmdLine[2]}"` or similar, it would be much more pleasant experience for eyes Edited June 13, 2023 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) Reveal hidden contents 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.
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