Jump to content

ControlSend "title part"


Travb
 Share

Recommended Posts

Hi guys,

If I were to use ControlSend on a program that had brackets in its title how would I do it?

I've read a bit about it and apparently you use double quotation marks??

Eg.

ControlSend("programwithbracketsinitsname ""(bracketspart)"" ", "text", controlID, "string" [, flag = 0] )

Is this how I would do it?

Edited by Travb
Link to comment
Share on other sites

1 hour ago, Travb said:

ControlSend("programwithbracketsinitsname ""(bracketspart)"" "

just use single quotes:

ControlSend('programwithbracketsinitsname "(bracketspart)" ', "text", controlID, "string")

yours should also run, if you correct synstax for the last [optional] param:

ControlSend("programwithbracketsinitsname ""(bracketspart)"" ", "text", controlID, "string")

 

Link to comment
Share on other sites

Here is an example testing ControlSend to a window with brackets in a window's title, and,

Also tests ControlSend to a window with double quotes in a window's title.

 

Note:-

        ' is a single quote,

        " is a double quote, and,

        "" is two double quotes.

$sFileName = "programwithbracketsinitsname(bracketspart) .txt"
If FileExists($sFileName) Then FileDelete($sFileName)

$fFile = FileOpen($sFileName, 10) ;  $FO_OVERWRITE (2) = Write mode (erase previous contents) + $FO_CREATEPATH (8)
FileClose($fFile)

ShellExecute($sFileName)

WinActivate("programwithbracketsinitsname(bracketspart) ")
WinWait("programwithbracketsinitsname(bracketspart) ", "", 10)
ControlSend("programwithbracketsinitsname(bracketspart) ", "", "Edit1", "This string is sent using ControlSend with brackets in title" & @LF, 0)

Sleep(3000)

WinSetTitle("programwithbracketsinitsname(bracketspart) ", "", "programwithDouble Quotesinitsname ""Double Quotes"" ")
ControlSend("programwithDouble Quotesinitsname ""Double Quotes"" ", "", "Edit1", "This string is sent with double quotes in title.", 0)

 

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
 Share

  • Recently Browsing   0 members

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