Jump to content

Disable Windows Clipboard? Is It Possible With Autoit?


Recommended Posts

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

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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)
EndFunc

to 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 by Zedna
Link to comment
Share on other sites

  • 4 years later...

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

the clipboard is part of the OS - i do not believe that it is possible for just a drive

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."

 

WindowsError.gif

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 11 months later...

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:

#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

EDIT:

here is another similar topic

Edited by Zedna
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...