lbrtdy Posted December 12, 2009 Share Posted December 12, 2009 (edited) Hello, I come to you guys once again for help. I'm still pretty poor at this but hoping to get better. I have a problem with renaming window titles. There is a button that when clicked, it'll rename the selected item in $list1 to the text field $NewWinTitle. But I keep coming up with some number lol. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Albert Zhen\My Documents\Autoit\GUI\AutoResser.kxf $Window = GUICreate("Auto Resser", 186, 189, 435, 386) $Key = GUICtrlCreateInput("0", 8, 24, 33, 21) $Wait = GUICtrlCreateInput("500", 48, 24, 49, 21) $NewWinTitle = GUICtrlCreateInput("Resser", 104, 24, 57, 21) $Label1 = GUICtrlCreateLabel("Key:", 8, 8, 25, 16) $Label2 = GUICtrlCreateLabel("Wait (ms):", 48, 8, 51, 16) $Label3 = GUICtrlCreateLabel("Window:", 112, 8, 46, 16) $Group1 = GUICtrlCreateGroup("", 0, 48, 185, 105, -1, $WS_EX_TRANSPARENT) $List1 = GUICtrlCreateList("", 8, 62, 169, 84) GUICtrlCreateGroup("", -99, -99, 1, 1) $ChangeWinNameButton = GUICtrlCreateButton("...", 160, 24, 19, 21, $WS_GROUP) $Start = GUICtrlCreateButton("Start", 8, 160, 75, 25, $WS_GROUP) $Stop = GUICtrlCreateButton("Stop", 104, 160, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $auto = 0 ;getting the windows $aWinlist = WinList("[Class:CLIENT]") $sWinlist = "" for $i = 1 to UBound($aWinlist)-1 $sWinlist &= $aWinlist[$i][0] Next ;places win titles in box GUICtrlSetData($List1,$sWinlist) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ;renaming the window title Case $ChangeWinNameButton $hwd = GUICtrlRead($List1) WinSetTitle($hwd,"",$NewWinTitle) ;starts key spamming Case $Start $auto = 1 ;stops key spamming Case $Stop $auto = 0 While $auto = 1 ControlSend($Window,"","",$Key) Sleep($Wait) WEnd EndSwitch WEnd one more thing I need help on, how do you make a right click menu when clicking inside of the list to have an option to refresh the window title listings? Thanks for your time and effort - albert. Edited December 12, 2009 by lbrtdy Link to comment Share on other sites More sharing options...
iamsandeep Posted December 12, 2009 Share Posted December 12, 2009 (edited) Hello, I come to you guys once again for help. I'm still pretty poor at this but hoping to get better. I have a problem with renaming window titles. There is a button that when clicked, it'll rename the selected item in $list1 to the text field $NewWinTitle. But I keep coming up with some number lol. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Albert Zhen\My Documents\Autoit\GUI\AutoResser.kxf $Window = GUICreate("Auto Resser", 186, 189, 435, 386) $Key = GUICtrlCreateInput("0", 8, 24, 33, 21) $Wait = GUICtrlCreateInput("500", 48, 24, 49, 21) $NewWinTitle = GUICtrlCreateInput("Resser", 104, 24, 57, 21) $Label1 = GUICtrlCreateLabel("Key:", 8, 8, 25, 16) $Label2 = GUICtrlCreateLabel("Wait (ms):", 48, 8, 51, 16) $Label3 = GUICtrlCreateLabel("Window:", 112, 8, 46, 16) $Group1 = GUICtrlCreateGroup("", 0, 48, 185, 105, -1, $WS_EX_TRANSPARENT) $List1 = GUICtrlCreateList("", 8, 62, 169, 84) GUICtrlCreateGroup("", -99, -99, 1, 1) $ChangeWinNameButton = GUICtrlCreateButton("...", 160, 24, 19, 21, $WS_GROUP) $Start = GUICtrlCreateButton("Start", 8, 160, 75, 25, $WS_GROUP) $Stop = GUICtrlCreateButton("Stop", 104, 160, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $auto = 0 ;getting the windows $aWinlist = WinList("[Class:CLIENT]") $sWinlist = "" for $i = 1 to UBound($aWinlist)-1 $sWinlist &= $aWinlist[$i][0] Next ;places win titles in box GUICtrlSetData($List1,$sWinlist) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ;renaming the window title Case $ChangeWinNameButton $hwd = GUICtrlRead($List1) WinSetTitle($hwd,"",$NewWinTitle) ;starts key spamming Case $Start $auto = 1 ;stops key spamming Case $Stop $auto = 0 While $auto = 1 ControlSend($Window,"","",$Key) Sleep($Wait) WEnd EndSwitch WEnd one more thing I need help on, how do you make a right click menu when clicking inside of the list to have an option to refresh the window title listings? Thanks for your time and effort - albert. ok... 1 thing at a time ... you have a line like this in the code $NewWinTitle = GUICtrlCreateInput("Resser", 104, 24, 57, 21) if u see the help file it says if success it returns the identifier (controlID) of the new control. not the text.but you need the text here not the control. by the way i dunno how the code's working there but i had to modify the code a little to get it working.. anyways i'm trying to get the text.I'll update if i succeed. good luck. Edited December 12, 2009 by iamsandeep Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 12, 2009 Moderators Share Posted December 12, 2009 lbrtdy,Change this line:WinSetTitle($hwd, "", $NewWinTitle)to read:WinSetTitle($hwd, "", GUICtrlRead($NewWinTitle))You are currently setting the window title to the ControlID of the input, not the content. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
lbrtdy Posted December 12, 2009 Author Share Posted December 12, 2009 Thank you iamsandeep and Melba23 it works! Yeah it was returning the controller ID lol. Learning something new everyday Umm one more thing, how do you make it so that when right clicking within the list, a menu will come up? I tried looking in the help file but I have no idea what it's called. Thanks again! Link to comment Share on other sites More sharing options...
iamsandeep Posted December 12, 2009 Share Posted December 12, 2009 Ok,about the right click i guess you can get the concept from this topic [Add items to right click menu for any file type] Link to comment Share on other sites More sharing options...
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