James Posted February 22, 2007 Posted February 22, 2007 Hey,I am currently working on a UDF which deals with:Fading GUI inSteal a random window title and sets the AutoIt window titleI have the fading one done.. But the name steal is hard.I currently have:Func _StealWinTitle($iGUI) $iGUI = AutoItWinGetTitle() EndFuncThe idea is, the UDF will create a list of all the windows which are currently available. Then it will randomly set the title of an AutoIt GUI from the available windows. But I have no idea how to do that. So: Creates a list of the running windowsRandomly picks a window titleSets the AutoIt window to the chosen nameIf you still don't get it, ask me.Thanks,Secure Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Shevilie Posted February 22, 2007 Posted February 22, 2007 But why Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
Shevilie Posted February 22, 2007 Posted February 22, 2007 Creates a list of the running windows - Use search button in the forum Randomly picks a window title - Well a hint Random() Sets the AutoIt window to the chosen name - Look inj the file containing help also know as helpfile... And the Func _StealWinTitle($iGUI) $iGUI = AutoItWinGetTitle() EndFunc Cant be used to anything of the things you wanna acomplish Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
James Posted February 22, 2007 Author Posted February 22, 2007 I know. I meant to put "set" not "get" Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
James Posted February 22, 2007 Author Posted February 22, 2007 Hmm.. OK, I will work it out with what I have got. Thanks. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Sardith Posted February 24, 2007 Posted February 24, 2007 This is what I did to solve this problem. Let me know if it works for you. expandcollapse popup;Made by: Sardith ;Jeff ;Type: UDF? ;Renames a GUI to a random Running program title, that is visable, and isn't "". ;2-23-07 Dim $Program, $i, $Rvar Func _Randomtitle($Debug = 1); Debug = 0, no Debug mode. Debug = 1, Debug mode. Shows a Debug tooltip. $Program = WinList(); Gathers current running programs. sleep(10) Do $Rvar = Random(1, $Program[0][0]); Randoms a program. Program 1- to current amount of running programs. '$Program[0][0]' Until $Program[$Rvar][0] <> "" AND _IsVisible($Program[$Rvar][1]);Checks the program, to make sure it's not blank Window title, and if it's visable to the user. If $Debug = 0 Then Sleep(10) ElseIf $Debug = 1 Then ToolTip("", 0, 0);Clears old tooltip. DEBUG Sleep(10); DEBUS ToolTip("Title= " & $Program[$Rvar][0] & @LF & "Handle= " & $Program[$Rvar][1], 0, 0);Test: Displays a random program gathered from Winlist. DEBUG Sleep(1000); DEBUG EndIf EndFunc Func _IsVisible($handle);Checks to see if program is visable to the current user. If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Func _StealWinTitle(); Must keep the _Randomtitle placement. You also, must have a GUI created, $iGUI. $GUItitle = WinGetTitle($iGUI, "");Gets title of the parent GUI you created. AutoIt Help file variable = $iGUI _Randomtitle("1") WinSetTitle($GUItitle, "", $Program[$Rvar][0]); Renames the GUI title to a random program title. 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]
Paulie Posted February 24, 2007 Posted February 24, 2007 (edited) This is what I did to solve this problem. Let me know if it works for you.Mines a little shorter. Func _StealWindowTitle($Title_to_Change) $oldTitle=WinGetTitle($Title_to_Change) Local $Window[100], $Title[100], $HWND[100], $number = 0 Local $WindowList = WinList() For $i = 1 to $WindowList[0][0] If $WindowList[$i][0] <> "" And $WindowList[$i][0] <> "Program Manager" AND $WindowList[$i][0] <> $oldtitle AND IsVisible($WindowList[$i][1]) Then $number = $number + 1 $HWND[$Number] = $WindowList[$i][1] $Title[$Number] = $WindowList[$i][0] EndIf Next WinSetTitle(WinGetHandle($oldtitle),"",$Title[Random(1,$number)]) EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Edited February 24, 2007 by Paulie
Moderators SmOke_N Posted February 24, 2007 Moderators Posted February 24, 2007 Mines a little shorter. You bragging? 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.
MrCreatoR Posted February 24, 2007 Posted February 24, 2007 PaulieThe function _IsVisible() can be much shorter Func IsVisible($handle) Return BitAnd( WinGetState($handle), 2 ) EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team
James Posted February 24, 2007 Author Posted February 24, 2007 Paulie. Thanks. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Sardith Posted February 24, 2007 Posted February 24, 2007 Mines a little shorter. Func _StealWindowTitle($Title_to_Change) $oldTitle=WinGetTitle($Title_to_Change) Local $Window[100], $Title[100], $HWND[100], $number = 0 Local $WindowList = WinList() For $i = 1 to $WindowList[0][0] If $WindowList[$i][0] <> "" And $WindowList[$i][0] <> "Program Manager" AND $WindowList[$i][0] <> $oldtitle AND IsVisible($WindowList[$i][1]) Then $number = $number + 1 $HWND[$Number] = $WindowList[$i][1] $Title[$Number] = $WindowList[$i][0] EndIf Next WinSetTitle(WinGetHandle($oldtitle),"",$Title[Random(1,$number)]) EndFunc Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Thats interesting. I'll look at that script of yours. Always willing to learn something new =) [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]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now