Sign in to follow this  
Followers 0
Travb

ControlSend "title part"

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



what kind of program do you want to automate?


ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
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")

 

Share this post


Link to post
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)

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0