Sardith Posted December 15, 2005 Share Posted December 15, 2005 #include <GuiConstants.au3> HotKeySet("{ESC}", "Terminate") $hWnd = WinGetHandle("Windows Media Player");Name of the programs' title while 1 WinSetTitle($hWnd, "", Random(100, 10000, 1)) sleep(10000) WEnd Func Terminate() WinSetTitle($hWnd, "", "Windows Media Player") Exit EndFunc Thats my title changer, it changes Windows Media Player randomly at 10 seconds intervals, and when you exit the script, it changes it back to Windows Media Player. Is there a way to use a GUI Menu base to select the programs title that you want randomly changed, and then befor you exit with a menu be able to type what you want the title to be? I havn't used GUI's befor so baby steps are needed [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 More sharing options...
Valuater Posted December 15, 2005 Share Posted December 15, 2005 maybe you could just add onto this expandcollapse popup#include <GUIConstants.au3> If (Not IsDeclared('CB_GETCOUNT')) Then Global Const $CB_GETCOUNT = 0x146 If (Not IsDeclared('CB_SETCURSEL')) Then Global Const $CB_SETCURSEL = 0x14E $perc = "100%" $winName = "" GUICreate("iWindow", 220, 135, 0, 0, -1, $WS_EX_TOPMOST) $repop = GUICtrlCreateButton("Repopulate List", 10, 10, 200, 20) $winLabel = GUICtrlCreateLabel("Window:", 10, 40) $win = GUICtrlCreateCombo("Select a Window Title", 10, 55, 200, 100) $transLabel = GUICtrlCreateLabel("Visibility:", 10, 90) $trans = GUICtrlCreateCombo("Select Visibility", 10, 105, 200, 100) GUICtrlSetData(-1, "0%|5%|10%|15%|20%|25%|30%|35%|40%|45%|50%|55%|60%|65%|70%|75%|80%|85%|90%|95%|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 Window Title", "Select a Window Title") EndFunc ;==>repopList Func setTrans() $perc = StringTrimRight($perc, 1) $transNum = $perc * 2.55 WinSetTrans($winName, "", $transNum) EndFunc ;==>setTrans Do $msg = GUIGetMsg() Select Case $msg = $repop GUICtrlSetData($trans, "Select Visibility") repopList() Case $msg = $trans $winName = GUICtrlRead($win) $perc = GUICtrlRead($trans) If $winName <> "Select a Window Title" Then setTrans() EndIf Case $msg = $GUI_EVENT_CLOSE GUISetState(@SW_HIDE) ResetVisibility() EndSelect Until $msg = $GUI_EVENT_CLOSE Func ResetVisibility() For $i = 0 To _GUICtrlComboBoxGetCount($win) - 1 $perc = "100%" _GUICtrlComboBoxSetCurSel($win, $i) $winName = GUICtrlRead($win) setTrans() Next EndFunc ;==>ResetVisibility ;=============================================================================== ; ; Description: _GUICtrlComboBoxGetCount ; Parameter(s): $h_combobox - controlID ; Requirement: None ; Return Value(s): The return value is the number of items in the list box. ; If an error occurs, it is CB_ERR ; User CallTip: _GUICtrlComboBoxGetCount($h_combobox) Retrieve the number of items in the list box of a combo box (required: <ComboBox.au3>) ; Author(s): Gary Frost (custompcs@charter.net) ; Note(s): The index is zero-based, so the returned count is one greater ; than the index value of the last item. ; ;=============================================================================== Func _GUICtrlComboBoxGetCount($h_combobox) Return GUICtrlSendMsg($h_combobox, $CB_GETCOUNT, 0, 0) EndFunc ;==>_GUICtrlComboBoxGetCount ;=============================================================================== ; ; Description: _GUICtrlComboBoxSetCurSel ; Parameter(s): $h_combobox - controlID ; $i_index - Specifies the zero-based index of the string to select ; Requirement: None ; Return Value(s): If the message is successful, the return value is the index of the item selected. ; If $i_index is greater than the number of items in the list or if $i_index is 1, ; the return value is CB_ERR and the selection is cleared ; User CallTip: _GUICtrlComboBoxSetCurSel($h_combobox,$i_index) Select a string in the list of a combo box (required: <ComboBox.au3>) ; Author(s): Gary Frost (custompcs@charter.net) ; Note(s): If this $i_index is 1, any current selection in the list is removed and the edit control is cleared ; ;=============================================================================== Func _GUICtrlComboBoxSetCurSel($h_combobox, $i_index) Return GUICtrlSendMsg($h_combobox, $CB_SETCURSEL, $i_index, 0) EndFunc ;==>_GUICtrlComboBoxSetCurSel Enjoy!!! 8) Link to comment Share on other sites More sharing options...
Sardith Posted December 15, 2005 Author Share Posted December 15, 2005 (edited) It's very interesting, i'll mess around with it. Question... I need to some how read what process you selected... how would I go about doing that? Edited December 15, 2005 by Sardith [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 More sharing options...
Sardith Posted December 15, 2005 Author Share Posted December 15, 2005 Still looking for help. The script above really didn't help me, because I cant isolate the window that I selected. Could someone help me with making a GUI base menu for my random title changer. [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 More sharing options...
t0ddie Posted December 15, 2005 Share Posted December 15, 2005 (edited) #include <guiconstants.au3> $msg = "" $original = "" $changed = "" HotKeySet("^!s","change") $GUI = GUICreate("test", 510, 390) $changed = GUICtrlCreateInput("enter new name here",20,100,200,17) GUICtrlCreateLabel("activate window to change and press control-alt-s",20,10,400,15) GUISetState() While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() WEnd WinSetTitle(GUICtrlRead($changed),"",$original) func change() If wingettitle("") <> GUICtrlRead($changed) Then $original = wingettitle("") EndIf WinSetTitle(WinGetTitle(""), "",GUICtrlRead($changed)) EndFunc ive spent 5 minutes too much already coding this. from here you can change the script to suit your "random title" needs Edited December 15, 2005 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 15, 2005 Moderators Share Posted December 15, 2005 ive spent 5 minutes too much already coding this.from here you can change the script to suit your "random title" needsAfter reading the other persons post, I was thinking it was a good job for "Koda" personally, is why I didn't reply. Those guys are really doing a top notch job, and people that aren't "good" at GUI(s) should really look in that direction. After all, if you don't use all the AutoIt tools provided for you, why would someone use yours?So yes, I agree you spent "5 minutes too much" . 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 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