Jump to content
Sign in to follow this  
boji

Clipput clear/read buffer

Recommended Posts

boji

Any one see a problem arising from using this?

Perhaps a better way?

CODE
Func clearclip()

Clipput("") ;clear clipboard

If not ClipGet() = "" Then

Do

Sleep(10)

Clipput("")

Until Clipget() = ""

EndIf

EndFunc

Edited by boji

Share this post


Link to post
Share on other sites
PsaltyDS

Any one see a problem arising from using this?

Perhaps a better way?

Func clearclip()
Clipput("");clear clipboard
If not ClipGet() = "" Then 
Do
Sleep(10)
Clipput("")
Until Clipget() = "" 
EndIf
EndFunc
Perhaps like this?
#include <ClipBoard.au3>

_ClipBoard_Open(0)
_ClipBoard_Empty()
_ClipBoard_Close()

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
MyName

Try

Func _ClipEmpty()
    Local $Success = 0
    DllCall('user32.dll', 'int', 'OpenClipboard', 'hwnd', 0)
    IF @error = 0 THEN
        DllCall('user32.dll', 'int', 'EmptyClipboard')
        IF @error = 0 THEN $Success = 1
        DllCall('user32.dll', 'int', 'CloseClipboard')
        IF $Success THEN Return 1
    ENDIF
    DllCall('user32.dll', 'int', 'CloseClipboard')
    Return 0
EndFunc

-= [font="Verdana"]A Men Who believes in himself and not circumstances is the real Winner =-[/font]

Share this post


Link to post
Share on other sites
boji

Thanks guys.

May I ask a question about these two excellent responses then:

So Psalty's way is to use autoit's clipboard as opposed to windows, right? bypass the whole thing by not calling the api?

And MyName's response works with the underlying .dll behind windows clipboard?

Man I have so much to learn...

Edited by boji

Share this post


Link to post
Share on other sites
PsaltyDS

Thanks guys.

May I ask a question about these two excellent responses then:

So Psalty's way is to use autoit's clipboard as opposed to windows, right? bypass the whole thing by not calling the api?

And MyName's response works with the underlying .dll behind windows clipboard?

Man I have so much to learn...

Put my code in SciTE, put the cursor on one of the functions, and hit CTRL-j.

If you open the ClipBoard.au3 file and look at those UDFs, you'll find they use exactly the DLL calls that MyName used. The point of the UDF is to be able to do that easily in AutoIT syntax. AutoIt still has to use the same Windows APIs every other program does, it can just be hidden behind a simplified wrapper.

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
boji

Excellent! Thank you so much for pointing me in the right direction!

Did you just give me the red pill Morpheus?

Edited by boji

Share this post


Link to post
Share on other sites
MyName

Thank Psalty :)


-= [font="Verdana"]A Men Who believes in himself and not circumstances is the real Winner =-[/font]

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.