Jump to content

func when variable change.


Recommended Posts

Hello..

is there any way to call a func when a windowtilte change??

this is what i've tried:

if not $title=WinGetTitle ("winTitle -") then
$title = WinGetTitle ("Spotify -")
$location = StringMid ($title, 10)
ToolTip ($location)
endif
sleep(100)
wend

witch did not work...

Link to comment
Share on other sites

You mean like this?

Run("notepad.exe")
WinWait("")
$handle = WinGetHandle("")
$Title1=WinGetTitle($handle)
While 1
    Sleep(50)
    if WinGetTitle($handle) <> $Title1 Then
        TitleChanged()
    EndIf
    Sleep(50)
WEnd

Func TitleChanged()
    Tooltip("Title has been changed",0,0)
    Sleep(4000)
    Tooltip("")
    $Title1=WinGetTitle($handle)
EndFunc

To try it, simply save the opened notepad as something, and the script will show a tooltip.

Hope this helps.

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...