Clipboard actions.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
pasqualedk
Posts: 3
Joined: 25 May 2020, 09:51

Clipboard actions.

25 May 2020, 11:45

Hello,
Thank you for accepting me as a member.
I’m completely new to AutoHotKey and I tried to start with some very elementary macros, and everything went well, until I attempted to build a macro with more the 2 lines😁. Se blow:
--------------------------------------------
Name:=" Napoleone Bonaparte"
clipboard :=""
^RButton:: ; send the name
Loop % StrLen(name)
clipboard := name
; clipboard :=""
Return
-------------------------------------------
Her is what I intended the macro to do:
When the Macro is set to run,
it must completely clear the clipboard
then detect that the user executes ^RButton
then wait for the user to grab the clipboard content into a document or something similar
then execute, clipboard: = "" (Clean the clipboard completely)
and discharge the macro (Exit).
I hope there is a patient soul who can help me complete this macro so I can understand how AutoHotKey works.

Many thanks in advance and I hope to hear from you as soon as possible.
Yours sincerely
Pasquale Castelluccio
iPhilip
Posts: 822
Joined: 02 Oct 2013, 12:21

Re: Clipboard actions.

25 May 2020, 17:23

Hi Pasquale,

Welcome to the AutoHotkey community. I read through your post and, based on your description of the macro, I came up with the following code. I am uncertain by your statement "wait for the user to grab content into a document ...". If you meant "wait for the user to copy content from a document into the clipboard", this untested code should work:

Code: Select all

#NoEnv
Name := " Napoleone Bonaparte"  ; I am not sure what this variable is supposed to do in the script
clipboard := ""  ; Clear the clipboard
return

^RButton::  ; When the hotkey is triggered ...
   OnClipboardChange("ClipChanged")  ; Start monitoring the clipboard contents
return

ClipChanged()
{
   OnClipboardChange(A_ThisFunc, 0)  ; Stop monitoring the clipboard contents
   Clipboard := ""  ; Clear the clipboard
}
If, on the other hand, you mean "wait for the user to paste content from a document into the clipboard", this untested code should work:

Code: Select all

#NoEnv
Name := " Napoleone Bonaparte"  ; I am not sure what this variable is supposed to do in the script
clipboard := ""  ; Clear the clipboard
return

^RButton::  ; When the hotkey is triggered ...
   Monitoring := true  ; Start monitoring
return

~^v::  ; Don't block the native ^v function
   SetTimer, Timer, -250  ; Wait for the paste function to complete
return

Timer:
   if Monitoring
   {
      Clipboard := ""  ; Clear the clipboard
      Monitoring := false  ; Stop monitoring
   }
return
Would you let me know if any of the above code is helpful?

Ciao,

iPhilip
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
pasqualedk
Posts: 3
Joined: 25 May 2020, 09:51

Re: Clipboard actions.

26 May 2020, 06:16

Hi iPhilip

First of all, I thank you for you bother to use your time on me.

I suspect that I have attempted to create a script who is completely out of my capacity, therefor I hope, you still will help me.

Her you have a more concise description:
In other words, I have various applications all of which prevent any password manager from interacting with them. To logon, in the concerning applications, I can only do it manually or copy pasting the assigned password, who are very complex, therefor I keep a list of the concerning passwords in an excel spreadsheet.
It would be nice to have the concerning passwords, encrypted if feasible, in one script with different function key for each password. If you can assist me in building this kind of macro or script, I'll be truly grateful.

Yours sincerely
Pasquale Castelluccio
Informatics engineer

PS! Yours suggestions didn’t work. 😏😔
pasqualedk
Posts: 3
Joined: 25 May 2020, 09:51

Re: Clipboard actions.

27 May 2020, 09:53

pasqualedk wrote:
26 May 2020, 06:16
Hi iPhilip

First of all, I thank you for you bother to use your time on me.

I suspect that I have attempted to create a script who is completely out of my capacity, therefor I hope, you still will help me.

Her you have a more concise description:
In other words, I have various applications all of which prevent any password manager from interacting with them. To logon, in the concerning applications, I can only do it manually or copy pasting the assigned password, who are very complex, therefor I keep a list of the concerning passwords in an excel spreadsheet.
It would be nice to have the concerning passwords, encrypted if feasible, in one script with different function key for each password. If you can assist me in building this kind of macro or script, I'll be truly grateful.

Yours sincerely
Pasquale Castelluccio
Informatics engineer

PS! Yours suggestions didn’t work. 😏😔

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 221 guests