Sign in to follow this  
Followers 0
dieterhatn

Clipboard Manager

15 posts in this topic

Hey there! I'd like to add a simple Clipboard manager to my autoit script, but the problems start with the trigger. Is there a way to make autoit execute smth after I've hit Ctrl+C or Ctrl+X? I don't want to run a loop for this. Thanks in advance

Share this post


Link to post
Share on other sites



Yes, there is a way to do this, but many ways of doing so. Using _IsPressed and/or GUI Accelerator keys could do this for you. Have a look in the HelpFile for these and try scripting something. :)


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

Yes, there is a way to do this, but many ways of doing so. Using _IsPressed and/or GUI Accelerator keys could do this for you. Have a look in the HelpFile for these and try scripting something. :)

Well, in order to work with _IsPressed I need to run a loop.

I haven't looked ad GUI accelerators tho, problem is my script does not have a GUI.

What happens if I set an Acceleraotr hotkey to Ctrl + C? Will it block the windows default behavior?

Share this post


Link to post
Share on other sites

Well, in order to work with _IsPressed I need to run a loop.

I haven't looked ad GUI accelerators tho, problem is my script does not have a GUI.

What happens if I set an Acceleraotr hotkey to Ctrl + C? Will it block the windows default behavior?

 

To use Accelerators you must have a GUI, so I'm thinking using _IsPressed is going to be the option you use.

#include <Misc.au3>
#include <MsgBoxConstants.au3>

Local $hDLL = DllOpen("user32.dll")

While 1
    If _IsPressed("11", $hDLL) And _IsPressed("43", $hDLL) Then
        MsgBox(0, "", "I run after CTRL + c !")
    ElseIf _IsPressed("1B", $hDLL) Then
        MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.")
        ExitLoop
    EndIf
    Sleep(250)
WEnd

DllClose($hDLL)

 

Something like that?


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

&nbsp;

Something like that?

That's exactly what I did not want to use, I do not want any loops in my script. That's why I'm asking for something else.

Share this post


Link to post
Share on other sites

dieterhatn,

You will need at least one loop in your script to keep it running - so why the aversion to using a loop to poll for the key being pressed? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

dieterhatn,

You will need at least one loop in your script to keep it running - so why the aversion to using a loop to poll for the key being pressed? :huh:

M23

That's true, but I want it to be as lightweight as possible because its running permanently.

Is there a way to make autoit hotkeys not prevent the default behaviour? that could be another way to get it work with hotkeyset

//Edit:

Or is there a way to imitate that default behaviour?

Edited by dieterhatn

Share this post


Link to post
Share on other sites

&nbsp;

That's exactly what I did not want to use, I do not want any loops in my script. That's why I'm asking for something else.

 

As melba stated. You must use at least 1 loop. And what do you mean as lightweight as possible? Anything running permanently must use loop(s).


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

Technically, every AutoIt script has a hidden window that is created when it is run. Whether or not you use a GUI for your own script. Which doesn't help in this instance because the OP doesn't need a GUI, they just need a way to keep the script running and to poll for the keys being pressed.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

@BrewManNH : I thought _ClipBoard_SetViewer was a good solution to track any clipboard changes (because CTRL + C/X generates a clipbloard event)

For the hidden window, I know it, but I didn't manage to use GUIRegisterMsg without creating a GUI

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

@BrewManNH : I thought _ClipBoard_SetViewer was a good solution to track any clipboard changes (because CTRL + C/X generates a clipbloard event)

For the hidden window, I know it, but I didn't manage to use GUIRegisterMsg without creating a GUI

So I need a (hidden) GUI for _ClipBoard_SetViewer to work?

And will it track any changes or just changes I did within the GUI?

As melba stated. You must use at least 1 loop. And what do you mean as lightweight as possible? Anything running permanently must use loop(s).

I am using a loop, containing one sleep command.

I just don't want it to make any calls at all when it's in idle. My script is completely based on hotkeys.

Edited by dieterhatn

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Rather than checking for a keypress, I could just get the clipboard in a loop and check for double entries.

Which leads me to another question: Is there a way in autoit to get the clipboard?

I don't mean ClipGet(), i have to get the content no matter what it is. From what I've read can ClipGet only get strings.

Edited by dieterhatn

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  
Followers 0