Search code examples
javawindowsautoit

AutoIT script is unable to handle "+" sign


I have a variable(fileSource) in Java, which contains + sign. I try to paste it into a file chooser dialog window with following code.

String autoITExecutable = "C:\\_privat\\filechooser.exe \"" + fileSource + "\"";

AutoIT script, filechooser.exe:

WinWaitActive("Open")
Send($CmdLine[1])
Send("{ENTER}")

Value of variable is pasted without + signs to dialog window. Example value of fileSource: C:\_private\input\Files\my_upload1+1+2(original).pdf AutoIT use it like: C:\_private\input\Files\my_upload112(original).pdf


Solution

  • WinWaitActive("Open")
    Send($CmdLine[1], 1)
    Send("{ENTER}")
    

    Send will interpret + as shift key. Use 2nd parameter of Send flag 1 to send raw text.