Jump to content

Title Changer


Sardith
 Share

Recommended Posts

:P The problem with my script is, I can't figure a way to keep changing the name of the program. It will work once, then the name changes under process manger. SO... I tryed WinGetHandle, thing is im not sure if im doing something wrong... like im not able to use it in this context. But if anyone can help me out that would be great.

What I want to do, is select a program, using task manger which works, then it random changes then. But the problem is... the title is changing to random numbers, so if anyonce could fix my script that would be Great! I thought WinGetHandle would work but it keeps saying that the variable isnt being declared, which it is, but I know little about WinGetHandle.

#include <GUIConstants.au3>
HotKeySet("{ESC}", "Terminate")
Opt("OnExitFunc", "_ScriptClose")

GUICreate("Title Changer", 220, 135, 0, 0, -1, $WS_EX_TOPMOST)
$repop = GUICtrlCreateButton("Repopulate List", 10, 10, 200, 20)
$winLabel = GUICtrlCreateLabel("Program:", 10, 40)
$win = GUICtrlCreateCombo("Select a Program Title", 10, 55, 200, 100)
repopList()
GUISetState()

Func repopList()
    GUICtrlSetData($win, "|")
    $winList = WinList()
    For $i = 1 To $winList[0][0]
        If $winList[$i][0] <> "" And $winList[$i][0] <> "Program Manager"  And BitAND(WinGetState($winList[$i][0]), 2) Then
            GUICtrlSetData($win, $winList[$i][0])
        EndIf
    Next
    GUICtrlSetData($win, "Select a Program Title", "Select a Program Title")
EndFunc;==>repopList


Func get()  
$selected = GUICtrlRead($win)
$hwnd = WinGetHandle($selected, "")



EndFunc

Func title()
WinSetTitle($hwnd, "", Random(100, 10000, 1))
sleep(10000)

EndFunc



While 1
sleep(20)
get()
title()
sleep(1000000)

WEnd


Func Terminate()
WinSetTitle($hWnd, "", "Windows Media Player")   
    Exit 
EndFunc

Func _ScriptClose()
    WinSetTitle($hWnd, "", "Windows Media Player")   
    Exit 
EndFunc

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

:P The problem with my script is, I can't figure a way to keep changing the name of the program. It will work once, then the name changes under process manger. SO... I tryed WinGetHandle, thing is im not sure if im doing something wrong... like im not able to use it in this context. But if anyone can help me out that would be great.

What I want to do, is select a program, using task manger which works, then it random changes then. But the problem is... the title is changing to random numbers, so if anyonce could fix my script that would be Great! I thought WinGetHandle would work but it keeps saying that the variable isnt being declared, which it is, but I know little about WinGetHandle.

#include <GUIConstants.au3>
HotKeySet("{ESC}", "Terminate")
Opt("OnExitFunc", "_ScriptClose")

GUICreate("Title Changer", 220, 135, 0, 0, -1, $WS_EX_TOPMOST)
$repop = GUICtrlCreateButton("Repopulate List", 10, 10, 200, 20)
$winLabel = GUICtrlCreateLabel("Program:", 10, 40)
$win = GUICtrlCreateCombo("Select a Program Title", 10, 55, 200, 100)
repopList()
GUISetState()

Func repopList()
    GUICtrlSetData($win, "|")
    $winList = WinList()
    For $i = 1 To $winList[0][0]
        If $winList[$i][0] <> "" And $winList[$i][0] <> "Program Manager"  And BitAND(WinGetState($winList[$i][0]), 2) Then
            GUICtrlSetData($win, $winList[$i][0])
        EndIf
    Next
    GUICtrlSetData($win, "Select a Program Title", "Select a Program Title")
EndFunc;==>repopList
Func get()  
$selected = GUICtrlRead($win)
$hwnd = WinGetHandle($selected, "")
EndFunc

Func title()
WinSetTitle($hwnd, "", Random(100, 10000, 1))
sleep(10000)

EndFunc
While 1
sleep(20)
get()
title()
sleep(1000000)

WEnd
Func Terminate()
WinSetTitle($hWnd, "", "Windows Media Player")   
    Exit 
EndFunc

Func _ScriptClose()
    WinSetTitle($hWnd, "", "Windows Media Player")   
    Exit 
EndFunc
what kind of program are you making that you need to change the process name, especially more than once...
Link to comment
Share on other sites

It's for Counter-Strike Source.... VAC2. This is the second time you've asked.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

It's only changing to numbers, because that's what your telling it to do:

WinSetTitle($hwnd, "", Random(100, 10000, 1))

WinSetTitle ( "title", "text", "newtitle" )

You need to store the value of the new title in a variable and replace the Random numbers with the variable.

The way you have it now, it will only make the title anything from 100 to 10000.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Still can't get it to funcation like I want ;/. Any help or support would be great.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

Could you state 'clearer' what you want, and show what you've done?

What would you like to 'specifically' see happen (after you show what you've done).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Sorry, was out of state for a few days. Id like to use GUI menu's. One menu will have the programs running, using the script I have for gathering process. Then I want that program that someone selected, to have its WinHandle identified, then have the WinHandle be used in the title changer.

Ie. WinSetTitle(WINHANDLE "", Random(100, 10000, 1))

Then it will randomly change the title.

Then on exit of the title changer program, I want it to use the WinHandle again, WinSetTitle(WINHANDLE "", $hwnd) then that will set the title of the program back to it's orginal title.

$hwnd = orginal name, but some how I have to store it's orginal title.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

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