CopyNotify - Notifies you when you have copied anything

Post your working scripts, libraries and tools for AHK v1.1 and older
Comwan

CopyNotify - Notifies you when you have copied anything

21 Jan 2018, 10:18

CopyNotify.ahk
A small tool to notify you if you have copied anything in the last two seconds by displaying a small red rectangle at the bottom right of your screen for two seconds. Useful if you keep spamming ctrl+c to make sure the thing i copied ;)

Uses a script found on this forum for displaying the toaster.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Persistent
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
OnClipboardChange:
TP_Show("Copied text", "Red", "12", "Red", 2000)
return

TP_Show(TP_Message="Hello, World", TP_FontColor="Blue", TP_FontSize="12", TP_BGColor="White", TP_Lifespan=0)
{
   Global TP_GUI_ID 
   DetectHiddenWindows, On
   SysGet, Workspace, MonitorWorkArea
   Gui, 89:-Caption +ToolWindow +LastFound +AlwaysOnTop +Border
   Gui, 89:Color, %TP_BGColor%
   Gui, 89:Font, s%TP_FontSize% c%TP_FontColor%
   Gui, 89:Add, Text, gTP_Fade, %TP_Message%
   Gui, 89:Show, Hide
   TP_GUI_ID := WinExist()
   WinGetPos, GUIX, GUIY, GUIWidth, GUIHeight, ahk_id %TP_GUI_ID%
   NewX := WorkSpaceRight-5
   NewY := WorkspaceBottom-5
   Gui, 89:Show, Hide x%NewX% y%NewY% W5 H5

   DllCall("AnimateWindow","UInt",TP_GUI_ID,"Int",500,"UInt","0x00040008") ; TOAST!
   If (TP_Lifespan)
     SetTimer, TP_Fade, % "-" TP_Lifespan
   Return
}

TP_Fade:
   DllCall("AnimateWindow","UInt",TP_GUI_ID,"Int",1000,"UInt","0x90000") ; Fade out when clicked
   Gui, 89:Destroy
Return
mtvsx
Posts: 2
Joined: 08 Mar 2017, 22:00

Re: CopyNotify - Smaller code set that uses ToolTip

30 Jan 2018, 11:53

[code=text
Smaller code set that uses ToolTip - I don't like waiting for toasters. Also includes the clipboard text in the ToolTip.
[/code]

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
#Persistent
/*
Type Contains one of the following values:
0 if the clipboard is now empty;
1 if it contains something that can be expressed as text (this includes files copied from an Explorer window);
2 if it contains something entirely non-text such as a picture
*/

OnClipboardChange("ClipChanged")

ClipChanged(Type)
{
	If Type = 0  ; Not sure how you copy 'nothing' to the clipboard, but if you do, you don't need to show it.
		Return
	
	If Type = 1 
		ClipShow := Trim(Clipboard)

	If Type = 2 
		ClipShow := "An Image was copied"

	ToolTip, %ClipShow%	;Tooltip will show at the position of the cursor
	Sleep 1000			; Show it for 1 second
	Tooltip
	return
}


Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 165 guests