Jump to content

Window Title Countdown to Close


Recommended Posts

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
Link to comment
Share on other sites

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]")
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

: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)
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

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