Jump to content

Recommended Posts

Posted

Ok, I've been using autoit for over a year now. This is a short program i tossed together in no time. Maybe someone else can use it.

This program allows you to select a window, and change its title. It only changes it temporarily. If the program changes the window title (say in firefox, if you have multiple tabs open, or when you change pages, the title changes) - this program works but only temporarily (until next title change)

I made this program for use with my SSH client. When i am doing projects for my CIS classes, i have 5 windows open! - with different code in each, and different directories.

This program allows me to change the titles easily on all the windows to help organize all windows so when i'm writing my code, i'm not spending 5 minutes finding the correct window, or forgetting what each window is for

Its easy to script, maybe someone will want to spend the time to fix it up to make it even better

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.2.1.13 (beta)
    Author:      Cassetti
    
    Script Function:
    Changes window titles, handy for school
    
#ce ----------------------------------------------------------------------------

$keeprunning = 1

While $keeprunning = 1
    
    changetitle();run the program once
    
    $keeprunning = 0
    
    
    #Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question, Miscellaneous=Top-most attribute
    If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer
    $iMsgBoxAnswer = MsgBox(262180, "Windows Title Changer", "Do another window?")
    Select
        Case $iMsgBoxAnswer = 6;Yes
            $keeprunning = 1
        Case $iMsgBoxAnswer = 7;No
            $keeprunning = 0
    EndSelect
    #EndRegion --- CodeWizard generated code End ---
    
WEnd
Exit


Func changetitle()
    
    #Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Warning
    MsgBox(262192, "Window Title Changer", "Please activate the window you want to change, then press ok")
    #EndRegion --- CodeWizard generated code End ---
    
    Sleep(100)
    If Not IsDeclared("ttitle") Then Dim $iMsgBoxAnswer
    $ttitle = WinGetTitle("");gets active window
    If @error Then
        unknownError()
        Return;exit this function early
    EndIf
    
    #Region --- CodeWizard generated code Start ---
;InputBox features: Title=Yes, Prompt=Yes, Default Text=Yes, Width=300, Height=120
    If Not IsDeclared("sInputBoxAnswer") Then Dim $sInputBoxAnswer
    $sInputBoxAnswer = InputBox("Window Title Changer", "Enter the new title for this window", $ttitle, " ", 500, "120", "-1", "-1")
    Select
        Case @error = 0;OK - The string returned is valid
            
        Case @error = 1;The Cancel button was pushed
            Exit
        Case @error = 3;The InputBox failed to open
            Exit
    EndSelect
    #EndRegion --- CodeWizard generated code End ---
    
    WinSetTitle($ttitle, "", $sInputBoxAnswer);changes the function to the new one
    If @error Then
        unknownError()
    EndIf
EndFunc  ;==>changetitle


Func unknownError()
    #Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Warning, Miscellaneous=Top-most attribute
    MsgBox(262192, "Window Title Changer - ERROR!", " Something happened, and the title change could not be completed")
    #EndRegion --- CodeWizard generated code End ---
EndFunc  ;==>unknownError
  • 1 year later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...