ioliver Posted September 28, 2005 Share Posted September 28, 2005 Ok, I'm working on updating my code for the Magic Clip script Here's the updated code: CODE; Magic Clip.au3 ; ; September 26, 2005 ; This script will allow you to define, or Goolge a word or phrase in the clipboard. ; Notes: ; # = Windows Key; ^ = Ctrl Key #include <GUIConstants.au3> Dim $currentclip Dim $newclip Dim $newclips HotKeySet("#z", "MagicClip") ;HotKeySet("#zd", "define") ; May be implemented later ;HotKeySet("#zg", "Google") ; May be implemented later While 1 ; Infinite Loop - Keeps script running Sleep(100) ; Reduces the load this script places on processor time WEnd Func MagicClip() $currentclip = ClipGet() Send("^c") ; Copy $newclip = ClipGet() $newclips = $newclip & "|" & $newclips GUICreate(" Magic Clip", 270, 200) GUICtrlCreateLabel("Magic Clip the following word / phrase:", 10, 10) $cbo_clip = GUICtrlCreateCombo($newclip, 10, 30) GUICtrlSetData(-1, $newclips) $but_define = GUICtrlCreateButton("Define", 10, 65, 55) $but_Google = GUICtrlCreateButton("Google", 75, 65, 55) $but_cancel = GUICtrlCreateButton("Cancel", 140, 65, 55) $but_exit = GUICtrlCreateButton("Exit", 205, 65, 55) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Sleep(5) ; Reduces the load this script places on processor time Wend ClipPut($currentclip) EndFunc ;==> MagicClip Func define() ;$currentclip = ClipGet() ;Send("^c") ; Copy ;$newclip = ClipGet() Run("C:\Program Files\Internet Explorer\iexplore.exe http://dictionary.reference.com/search?q=" & $newclip) ClipPut($currentclip) EndFunc ;==> define Func Google() ;$currentclip = ClipGet() ;Send("^c") ; Copy ;$newclip = ClipGet() Run("C:\Program Files\Internet Explorer\iexplore.exe http://www.google.com/search?q=" & $newclip) ClipPut($currentclip) EndFunc ;==> Google Notice, I have 2 While 1 ... Wend loops, one for the script to wait for the Hotkey, and one for the GUI. When I run the scirpt, and click the X to close the window it doesn't work. Can someone point me in the right direction as to what's wrong. Thanks for the help, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
w0uter Posted September 28, 2005 Share Posted September 28, 2005 (edited) you made a silly error, you need to delete the GUI (between the while and the clipput) also you need to remove the sleep in the GUI loop. Edited September 28, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
ioliver Posted September 29, 2005 Author Share Posted September 29, 2005 (edited) you made a silly error, you need to delete the GUI (between the while and the clipput)also you need to remove the sleep in the GUI loop. Thanks, What part of the GUI between the While, and Clipput() do i need to delete? A. $msg = GUIGetMsg() B. If $msg = $GUI_EVENT_CLOSE Then ExitLoop C. All the GUI Statements I thought the GUI statements needed to be in a loop so that it would continue wating for responses. Thanks again, Ian Edited September 29, 2005 by ioliver "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
w0uter Posted September 29, 2005 Share Posted September 29, 2005 While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Sleep(5); Reduces the load this script places on processor time Wend ClipPut($currentclip) should be While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend GuiDelete() ClipPut($currentclip) My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
ioliver Posted October 4, 2005 Author Share Posted October 4, 2005 Ok, I've updated the code. Here it is. expandcollapse popup; Magic Clip v2.au3 ; Ian Oliver ; September 30, 2005 ; This script will allow you to define, or Goolge a word or phrase in the clipboard. ; Notes: ; # = Windows Key; ^ = Ctrl Key #include <GUIConstants.au3> Dim $currentclip Dim $newclip Dim $newclips HotKeySet("#z", "MagicClip") ;HotKeySet("#zd", "define"); May be implemented later ;HotKeySet("#zg", "Google"); May be implemented later While 1; Infinite Loop - Keeps script running Sleep(100); Reduces the load this script places on processor time WEnd Func MagicClip() $currentclip = ClipGet() Send("^c"); Copy $newclip = ClipGet() $newclips = $newclip & "|" & $newclips ; Generated with Form Designer preview, thanks lookfar GUICreate(" MagicClip", 404, 171, 433, 251, $WS_OVERLAPPEDWINDOW) GUICtrlCreateLabel("Magic Clip the following word / phrase:", 8, 8, 183, 13) $lbx_Clips = GUICtrlCreateList("", 8, 32, 185, 129, 0) GUICtrlSetData(-1, $newclips) $gbx_Clip = GUICtrlCreateGroup("gbx_Clip", 208, 24, 185, 105) $rdo_Define = GUICtrlCreateRadio("Define", 216, 48, 73, 17) GUICtrlSetState(-1, $GUI_CHECKED) $rdo_Google = GUICtrlCreateRadio("Google", 216, 72, 73, 17) $but_Go = GUICtrlCreateButton("Magic Clip", 264, 96, 75, 25) $but_Cancel = GUICtrlCreateButton("Cancel", 216, 136, 75, 25) $but_Exit = GUICtrlCreateButton("Exit", 312, 136, 75, 25) GUICtrlSetTip($but_Exit, "Exit Magic Clip") GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $but_Cancel ExitLoop Case $msg = $but_Exit Call ("Quit") Case $msg = $lbx_Clips $text = GUICtrlRead($lbx_Clips) MsgBox(0, "$lbx_Clips selected:", $text) GUICtrlSetData($gbx_Clip, $lbx_Clips) Case $msg = $but_Go $sDefine = GUICtrlRead($rdo_Define) $sGoogle = GUICtrlRead($rdo_Google) If $sDefine = $GUI_CHECKED Then Call ("define") EndIf If $sGoogle = $GUI_CHECKED Then Call ("Google") EndIf EndSelect WEnd GUIDelete() ClipPut($currentclip) EndFunc;==> MagicClip Func define() ;$currentclip = ClipGet() ;Send("^c"); Copy ;$newclip = ClipGet() GUIDelete() Run("C:\Program Files\Internet Explorer\iexplore.exe http://dictionary.reference.com/search?q=" & $newclip) ClipPut($currentclip) EndFunc;==> define Func Google() ;$currentclip = ClipGet() ;Send("^c"); Copy ;$newclip = ClipGet() GUIDelete() Run("C:\Program Files\Internet Explorer\iexplore.exe http://www.google.com/search?q=" & $newclip) ClipPut($currentclip) EndFunc;==> Google Func Quit() Exit EndFunc;==> Quit Can anyone tell me how, or point me in the right direction to find out how to make the caption of a Group Box change when an item is selected in a List Box? Thanks for your time, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
seandisanti Posted October 4, 2005 Share Posted October 4, 2005 Ok, I've updated the code. Here it is. expandcollapse popup; Magic Clip v2.au3 ; Ian Oliver ; September 30, 2005 ; This script will allow you to define, or Goolge a word or phrase in the clipboard. ; Notes: ; # = Windows Key; ^ = Ctrl Key #include <GUIConstants.au3> Dim $currentclip Dim $newclip Dim $newclips HotKeySet("#z", "MagicClip") ;HotKeySet("#zd", "define"); May be implemented later ;HotKeySet("#zg", "Google"); May be implemented later While 1; Infinite Loop - Keeps script running Sleep(100); Reduces the load this script places on processor time WEnd Func MagicClip() $currentclip = ClipGet() Send("^c"); Copy $newclip = ClipGet() $newclips = $newclip & "|" & $newclips ; Generated with Form Designer preview, thanks lookfar GUICreate(" MagicClip", 404, 171, 433, 251, $WS_OVERLAPPEDWINDOW) GUICtrlCreateLabel("Magic Clip the following word / phrase:", 8, 8, 183, 13) $lbx_Clips = GUICtrlCreateList("", 8, 32, 185, 129, 0) GUICtrlSetData(-1, $newclips) $gbx_Clip = GUICtrlCreateGroup("gbx_Clip", 208, 24, 185, 105) $rdo_Define = GUICtrlCreateRadio("Define", 216, 48, 73, 17) GUICtrlSetState(-1, $GUI_CHECKED) $rdo_Google = GUICtrlCreateRadio("Google", 216, 72, 73, 17) $but_Go = GUICtrlCreateButton("Magic Clip", 264, 96, 75, 25) $but_Cancel = GUICtrlCreateButton("Cancel", 216, 136, 75, 25) $but_Exit = GUICtrlCreateButton("Exit", 312, 136, 75, 25) GUICtrlSetTip($but_Exit, "Exit Magic Clip") GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $but_Cancel ExitLoop Case $msg = $but_Exit Call ("Quit") Case $msg = $lbx_Clips $text = GUICtrlRead($lbx_Clips) MsgBox(0, "$lbx_Clips selected:", $text) GUICtrlSetData($gbx_Clip, $lbx_Clips) Case $msg = $but_Go $sDefine = GUICtrlRead($rdo_Define) $sGoogle = GUICtrlRead($rdo_Google) If $sDefine = $GUI_CHECKED Then Call ("define") EndIf If $sGoogle = $GUI_CHECKED Then Call ("Google") EndIf EndSelect WEnd GUIDelete() ClipPut($currentclip) EndFunc;==> MagicClip Func define() ;$currentclip = ClipGet() ;Send("^c"); Copy ;$newclip = ClipGet() GUIDelete() Run("C:\Program Files\Internet Explorer\iexplore.exe http://dictionary.reference.com/search?q=" & $newclip) ClipPut($currentclip) EndFunc;==> define Func Google() ;$currentclip = ClipGet() ;Send("^c"); Copy ;$newclip = ClipGet() GUIDelete() Run("C:\Program Files\Internet Explorer\iexplore.exe http://www.google.com/search?q=" & $newclip) ClipPut($currentclip) EndFunc;==> Google Func Quit() Exit EndFunc;==> Quit Can anyone tell me how, or point me in the right direction to find out how to make the caption of a Group Box change when an item is selected in a List Box? Thanks for your time, Iandoes GUICtrlSetData(ControlID,$NewCaption) work? Link to comment Share on other sites More sharing options...
ioliver Posted October 4, 2005 Author Share Posted October 4, 2005 does GUICtrlSetData(ControlID,$NewCaption) work? Thanks cameronsdad, I think that will do it. I'm posting the completed code in Scripts & Scraps. Thanks again, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
seandisanti Posted October 7, 2005 Share Posted October 7, 2005 Thanks cameronsdad, I think that will do it. I'm posting the completed code in Scripts & Scraps. Thanks again, Iannp, glad i could help 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