Autoxics Posted April 14, 2006 Posted April 14, 2006 Hello, i was wondering if it was possible to disable windows Clipboard funtion Temporarly with a simple script? one script disabeling the clipboard funtion and another script that enables it back. i have done some search on this but have not found anything on this exact thing. thanks for any help on this
RazerM Posted April 14, 2006 Posted April 14, 2006 you could use HotKeySet("{HOME}", "start") HotKeySet("{END}", "end") While 1 Sleep(100) WEnd Func start() AdlibEnable("clip") EndFunc Func end() AdlibDisable() EndFunc Func clip() ClipPut("") EndFunc My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Autoxics Posted April 14, 2006 Author Posted April 14, 2006 That works perfect! however how would i adapt this funtion so that i can have one script executing the disable clipboard funtion instantly when this script is executed and if i execute another script it enables it instantly, rather then having the home and end key do the command for me like this i run a script that has a name disable Clipboard and another script witch has the name Enable Clipboard and when i run the disable clipboard script it disables it instatly and when i run the enable Clipboard it enables it instantly? hope i am not to demanding otherwise thank you for the current script!
Valuater Posted April 14, 2006 Posted April 14, 2006 maybe While 1 Sleep(100) if WinExists("put a title here") Then ClipPut("") WEnd 8)
RazerM Posted April 14, 2006 Posted April 14, 2006 simple - to start use AdlibEnable("clip") Func clip() ClipPut("") EndFunc in a program named disableclip.exe to end use ProcessClose("disableclip.exe") My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Autoxics Posted April 14, 2006 Author Posted April 14, 2006 Thank you very much, this works like a dream perfect Really appriciate the help! Have a nice easter all of you!
Zedna Posted April 15, 2006 Posted April 15, 2006 Clear (but little complicated) solution is to use API functions and messages for clipboard. See Win32 API help for: SetClipboardViewer ChangeClipboardChain WM_DRAWCLIPBOARD WM_CHANGECBCHAIN Here is my sample Delphi app demonstarting using these functions: Resources UDF ResourcesEx UDF AutoIt Forum Search
Zedna Posted April 15, 2006 Posted April 15, 2006 (edited) Look at this hooking clipboard. It's much more elegant than AdLib.EDIT: for your need in given sample code change this: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) EndFuncto this:Func OnClipBoardChange($hWnd, $Msg, $wParam, $lParam) ; do what you need when clipboard changes ClipGet() if Not @error Then ClipPut("") ; send notification about clipboard change to next clipviewer dllcall("user32.dll","int","SendMessage","hWnd",$origHWND,"int",$WM_DRAWCLIPBOARD,"int",$wParam,"int",$lParam) EndFunc Edited April 15, 2006 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
riteshtechie Posted January 20, 2011 Posted January 20, 2011 you could use HotKeySet("{HOME}", "start") HotKeySet("{END}", "end") While 1 Sleep(100) WEnd Func start() AdlibEnable("clip") EndFunc Func end() AdlibDisable() EndFunc Func clip() ClipPut("") EndFunc I was also looking for similar code, but is there any way I can run this in my C drive only, right now the it disables clipboard globally, I just want to disable it for C drive is it possible?
ShawnW Posted January 20, 2011 Posted January 20, 2011 I was also looking for similar code, but is there any way I can run this in my C drive only, right now the it disables clipboard globally, I just want to disable it for C drive is it possible?1st this post is from 2006 and the functions used no longer exist. AdlibRegister and AdlibUnregister are what would be required.2nd no, the clip is always global.
nitekram Posted January 20, 2011 Posted January 20, 2011 the clipboard is part of the OS - i do not believe that it is possible for just a drive 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
ShawnW Posted January 21, 2011 Posted January 21, 2011 Upon thinking on this further you might be able to write your own script to get a similar effect. Not sure if this will work for everything but if all your concerned about is file and folders located on the c:\ drive then you could do something like this. $current_clip = ClipGet() While True Sleep(100) If Not (ClipGet() == $current_clip) Then If StringLeft(ClipGet(),3) = "C:\" Then ClipPut($current_clip) Else $current_clip = ClipGet() EndIf EndIf WEnd Basically this constantly checks your clipboard to see if the data there is a path on the c:\ drive. If it is then it replaces it with whatever was in the clip previously. This still won't stop you from copying the data off from a networked computer with the proper permissions. I might ask though what purpose might something like this serve?
Zedna Posted January 14, 2012 Posted January 14, 2012 (edited) I was asked by PM about missing example about monitoring clipboard, so here it is:It's mentioned also in another topic on this forum: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 EndFuncEDIT:here is another similar topic Edited January 14, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
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