sensalim Posted October 31, 2007 Share Posted October 31, 2007 Is there a better way than periodically monitor clipboard (using clipget or something?) to see if the clipboard contains certain string in it. Thanks. Link to comment Share on other sites More sharing options...
Sardith Posted October 31, 2007 Share Posted October 31, 2007 (edited) I don't know if this is what you want... $String = "Test"; Change test to what your looking to find in the clipboard. $Result = StringInStr(ClipGet(), $String) If $Result > 0 Then MsgBox("", "Match", "Substring found.") Else MsgBox("", "No Match", "No substring found.") EndIf Just modify it to your needs.. Edited October 31, 2007 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...
sensalim Posted October 31, 2007 Author Share Posted October 31, 2007 Yea that's what I'm using. Thanks. My autoit script is taking about 5500 K in Task Manager -- does that sound a bit much? If so, is there a way to bring it down? It's a standard GUI script that monitors clipboard every .1 seconds... maybe I can lower it to .5 seconds but I doubt it'll change anything. Right? Thanks. Link to comment Share on other sites More sharing options...
Achilles Posted October 31, 2007 Share Posted October 31, 2007 For changing RAM usage you might want to try to take out as much script as possible. For example if you use the GuiConstans.au3 take all the constants you need and place them in you actual code and take out the #include line... I'm just making a logical assumption that less constants will use less RAM, correct me if I'm wrong! My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Sardith Posted October 31, 2007 Share Posted October 31, 2007 (edited) Can you post your actual script? Or just the clipboard part your using in your script? That would help us out. Edited October 31, 2007 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...
Generator Posted October 31, 2007 Share Posted October 31, 2007 Put some Sleep(1) in your script? Link to comment Share on other sites More sharing options...
Zedna Posted October 31, 2007 Share Posted October 31, 2007 expandcollapse popup#include <GUIConstants.au3> Global Const $WM_DRAWCLIPBOARD = 0x0308 Global Const $WM_CHANGECBCHAIN = 0x030D Global $origHWND $gui = GUICreate("Clip Hook",400,400,-1,-1,BitOR($WS_CAPTION,$WS_SYSMENU)) ; remember last clip viewer in queue and set our GUI as first in queue $origHWND = DLLCall("user32.dll","hwnd","SetClipboardViewer","hwnd",$gui) $origHWND = $origHWND[0] GUIRegisterMsg($WM_DRAWCLIPBOARD,"OnClipBoardChange") GUIRegisterMsg($WM_CHANGECBCHAIN,"OnClipBoardViewerChange") GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd ; send notification that we no longer will be in clipboard hook queue DLLCall("user32.dll","int","ChangeClipboardChain","hwnd",$gui,"hwnd",$origHWND) Exit Func OnClipBoardChange($hWnd, $Msg, $wParam, $lParam) ; do what you need when clipboard changes ToolTip(ClipGet()) Sleep(3000) ToolTip("") ; send notification about clipboard change to next clipviewer dllcall("user32.dll","int","SendMessage","hWnd",$origHWND,"int",$WM_DRAWCLIPBOARD,"int",$wParam,"int",$lParam) EndFunc Func OnClipBoardViewerChange($hWnd, $Msg, $wParam, $lParam) ; if our remembered previous clipviewer is removed then we must remember new next clipviewer ; else send notification about clipviewer change to next clipviewer If $wParam = $origHWND Then $origHWND = $lParam Else dllcall("user32.dll","int","SendMessage","hWnd",$origHWND,"int",$WM_CHANGECBCHAIN,"hwnd",$wParam,"hwnd",$lParam) EndIf EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PhoenixXL Posted April 20, 2012 Share Posted April 20, 2012 Hey !! I added a Format Listener Instead of a ClipBoardViewer Windows Its a bit less complicated coz there is no need of the maintenance of the Chains..... Here is the code expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Zedna (Modified By Me) Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstants.au3> #include <WindowsConstants.au3> Global $origHWND,$lastCopied='',$WM_CLIPUPDATE=0x031D,$DefMsG='__•¯¯' $gui = GUICreate("Clip Hook",400,400,-1,-1,BitOR($WS_CAPTION,$WS_SYSMENU)) Global $label=GUICtrlCreateLabel('Clipboard Contains',30,30,340,30) Global $label1=GUICtrlCreateEdit('Clipboard Contains',30,80,340,210) ; remember last clip viewer in queue and set our GUI as first in queue $origHWND = DLLCall("user32.dll","int","AddClipboardFormatListener","hwnd",$gui) $origHWND = $origHWND[0] GUIRegisterMsg($WM_CLIPUPDATE,"OnClipBoardChange") WinSetOnTop($gui,'',1) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Exit Func OnClipBoardChange($hWnd, $Msg, $wParam, $lParam) ; do what you need when clipboard changes _write(ClipGet()) EndFunc Func _write($data) If $data<>$lastCopied Then $lastCopied=$data Return GUICtrlSetData($label1,$data) Else Return $DefMsG EndIf EndFunc mLipok 1 My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
Morthawt Posted April 22, 2012 Share Posted April 22, 2012 I was reading recently about the adlibregister function, it sould seem to me you could make a function that runs every X miliseconds and if the clipboard contains "XXXX" then perform an action. Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. Link to comment Share on other sites More sharing options...
Morthawt Posted April 22, 2012 Share Posted April 22, 2012 AdlibRegister('RegChecker', 500) While 1 Sleep(1000) WEnd Func RegChecker() If ClipGet() = "testinger" Then AdlibUnRegister("RegChecker") MsgBox(0, 'This is', 'Your life!') Exit EndIf EndFunc ;==>RegChecker Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. Link to comment Share on other sites More sharing options...
kylomas Posted April 22, 2012 Share Posted April 22, 2012 Morthawt, This thread may interest you kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
PhoenixXL Posted April 22, 2012 Share Posted April 22, 2012 (edited) Its even a good idea MortHawt But even though there is no change in the clipboard , the function starts when the TIMER wents out......... On registering the message we can get as and when the change ocuured Hope that this helps u out Regards Phoenix XL Edited April 22, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. 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