Sign in to follow this  
Followers 0

Change Gui Title

12 posts in this topic

Posted

Is there a way to change my GUIs title when something happens?

Share this post


Link to post
Share on other sites



Posted

WinSetTitle(.....)

Share this post


Link to post
Share on other sites

Posted

Yeah but I'm not sure what the win title is going to be. It's going to be changed very often throughout the script and I don't think WinSetTitle works with handles

Share this post


Link to post
Share on other sites

Posted

Did you try?

Opt("WinTitleMatchMode", 4)

$h = GuiCreate("Title One.")
GuiSetState()

sleep(1000)
WinSetTitle("handle=" & $h, "", "Title Two..")

sleep(1000)
WinSetTitle("handle=" & $h, "", "Title Three...")

sleep(1000)
WinSetTitle("handle=" & $h, "", "Title Four....")

sleep(1000)
WinSetTitle("handle=" & $h, "", "Title Five.....")

Share this post


Link to post
Share on other sites

Posted

Did you try?

Opt("WinTitleMatchMode", 4)

$h = GuiCreate("Title One.")
GuiSetState()

sleep(1000)
WinSetTitle("handle=" & $h, "", "Title Two..")

sleep(1000)
WinSetTitle("handle=" & $h, "", "Title Three...")

sleep(1000)
WinSetTitle("handle=" & $h, "", "Title Four....")

sleep(1000)
WinSetTitle("handle=" & $h, "", "Title Five.....")

Not required, this is easier:

$h = GuiCreate("Title One.")
GuiSetState()

sleep(1000)
WinSetTitle($h, "", "Title Two..")

Share this post


Link to post
Share on other sites

Posted

Ah, see I didn't know WinSetTitle worked with handles. Thanks both of you

Share this post


Link to post
Share on other sites

Posted

Ah, see I didn't know WinSetTitle worked with handles. Thanks both of you

Any function that works with "title", "text" works with handles. Totally undocumented but when I upgraded the variants to support handles this was a nice side effect. In fact the "handle=" is completely redundant now - it stays only because I need it for AutoItX.
Xandy likes this

Share this post


Link to post
Share on other sites

Posted

Ooh, that's very helpful. Thanks Jon

Share this post


Link to post
Share on other sites

Posted

This is great. It need to be documented!

Share this post


Link to post
Share on other sites

Posted

This Thread is 6 years old now. But this issue is STILL totally undocumented. I'm using autoit for so many years, and I'm a little frustrated that this feature has been there and is ... 6 years old.

please can you put it to the next version's help file?

thanks :blink:

Share this post


Link to post
Share on other sites

Posted

This Thread is 6 years old now. But this issue is STILL totally undocumented. I'm using autoit for so many years, and I'm a little frustrated that this feature has been there and is ... 6 years old.

please can you put it to the next version's help file?

thanks :blink:

Look at "Window Titles and Text (Advanced)" in the help file.

Share this post


Link to post
Share on other sites

Posted

loukaniko,

From the Help file - <Using AutoIt - Window Titles and Text (Advanced)>: :blink:

Window Handles / HWNDs

The variant datatype in AutoIt natively supports window handles (HWNDs). A window handle is a special value that windows assigns to a window each time it is created. When you have a handle you may use it in place of the title parameter in any of the function calls that use the title/text convention. The advantage of using window handles is that if you have multiple copies of an application open - which have the same title/text - you can uniquely identify them when using handles. When you use a window handle for the title parameter then the text parameter is completely ignored.

Various functions such as WinGetHandle, WinList and GUICreate return these handles. It is important to note that a window handle is not classed as a number or string - it is its own special type.

Note: Window handles will work no matter what WinTitleMatchMode is currently in use.

Example

$handle = WinGetHandle("Untitled - Notepad", "")

WinClose($handle)

Neck retract button = Pressed

could well be the next thing on your agenda. ;)

M23

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