Jump to content
Sign in to follow this  
autoit0822

Window Title Countdown to Close

Recommended Posts

autoit0822

After using WinSetState to minimize a window, then wait 50 seconds before closing it, is there a way I can change the title of the window to count down from 50 seconds until the window closes?

Share this post


Link to post
Share on other sites
BrettF
autoit0822

Can you provide an example for me, please?

Share this post


Link to post
Share on other sites
CodyBarrett

um... its quite simple.. Brett gave you everything you needed to make your own code... but if its an example you need to get started on... alright

$title = wingettitle ('[active]','')
For $0 = 10 To 0 Step -1
    winsettitle (WinGetTitle ('[active]',''),'', $0)
    sleep (1000)
Next
winsettitle (WinGetTitle ('[active]',''),'', $title)

Edit typo

Edited by CodyBarrett

Share this post


Link to post
Share on other sites
autoit0822

Thanks; I gave that a go, but it seems that once the window is minimized, it's no longer the active one, meaning that another window starts counting down. Here's what I have:

WinSetState("[current title]", "", @SW_MINIMIZE)
$title = wingettitle ('[active]','')
For $0 = 50 To 0 Step -1
    winsettitle (WinGetTitle ('[active]',''),'', $0)
    sleep (1000)
Next
winsettitle (WinGetTitle ('[active]',''),'', $title)
WinClose("[what goes here]")

Share this post


Link to post
Share on other sites
CodyBarrett

it was an example.. instead of the Active use the window title of your prefered window title OR handle lol

Share this post


Link to post
Share on other sites
autoit0822

OK, I changed instances of [active] to the current title, but there is no countdown at all; the window title is static.

Share this post


Link to post
Share on other sites
autoit0822

I have the following code working in Windows XP:

Run("cmd.exe")
Sleep(500)
Send("Telnet 192.168.1.1")
Send("{ENTER}")
Sleep(1000)
WinSetState("Telnet 192.168.1.1", "", @SW_MINIMIZE)
For $i = 50 To 0 Step -1
    $Title = WinGetTitle('Telnet 192.168.1.1')
    WinSetTitle($Title,'', 'Telnet 192.168.1.1 ' & $i)
    Sleep(1000)
Next
WinClose("Telnet 192.168.1.1")

However, in Windows Vista, where I need it to work, the window title remains static.

Share this post


Link to post
Share on other sites
WolfWorld

:D Good Luck and start looking in the damn help file.

Run("cmd.exe")
Sleep(500)
Send("Telnet 192.168.1.1")
Send("{ENTER}")
Sleep(1000)
$hWin = WinGetHandle("Telnet 192.168.1.1")
WinSetState($hWin , "", @SW_MINIMIZE)
For $i = 50 To 0 Step -1
    WinSetTitle($hWin, '', 'Telnet 192.168.1.1 ' & $i)
    Sleep(1000)
Next
WinClose($hWin)

Share this post


Link to post
Share on other sites
autoit0822

:D Good Luck and start looking in the damn help file.

Thanks, I think; it might help if I knew where in the help file to look. Anyhow, this doesn't work in Vista; the window title remains static.

Share this post


Link to post
Share on other sites
dbzfanatic
autoit0822

Search for "title" in the helpfile and for vista try adding #RequireAdmin to the top of your code.

Looking at Window Titles and Text (Advanced), I can't find anything that would indicate why this script would not work as intended in Vista. The default WinTitleMatchMode, which matches partial titles from the start, would seem appropriate.

I had considered running the script with elevated privileges, but it makes no difference.

I had thought WolfWorld had posted a solution for me, editing the script as he did.

Edited by autoit0822

Share this post


Link to post
Share on other sites
dbzfanatic

I'm not sure why it wouldn't work if it's not a privileges issue. I'd rather not switch my laptop over to vista just to check it out, but I have a question. Are you running the script from SciTe in vista or have you compiled an .exe file that you're using? I've had experiences where an .exe I compiled in XP wouldn't run in vista but when recompiled in vista with identical code it worked.

Share this post


Link to post
Share on other sites
autoit0822

I'm not sure why it wouldn't work if it's not a privileges issue. I'd rather not switch my laptop over to vista just to check it out, but I have a question. Are you running the script from SciTe in vista or have you compiled an .exe file that you're using? I've had experiences where an .exe I compiled in XP wouldn't run in vista but when recompiled in vista with identical code it worked.

I have compiled a .exe file in Vista that only works in my XP VM.

Share this post


Link to post
Share on other sites
dbzfanatic

Thanks for reminding me about VMs. I'll boot up my vista VM and try the code to see if I can replicate your error. Give me 5 minutes to post.

Share this post


Link to post
Share on other sites
dbzfanatic

Is this a clean install of Vista? Sorry for the delay my VM choked and I had to redo it and install autoit. If it is you might have this problem: 'telnet' is not recognized as an internal or external command, operable program, or batch file.

Does the window connect, as in do you have telnet?

Share this post


Link to post
Share on other sites
autoit0822

Is this a clean install of Vista? Sorry for the delay my VM choked and I had to redo it and install autoit. If it is you might have this problem: 'telnet' is not recognized as an internal or external command, operable program, or batch file.

Does the window connect, as in do you have telnet?

Yes, telnet is enabled and working; the only issue is with the countdown not appearing in the window title.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.