Skip to content

Instantly share code, notes, and snippets.

@davebrny
Last active November 20, 2017 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davebrny/91662fdc77a4ada8659be12337ad6c76 to your computer and use it in GitHub Desktop.
Save davebrny/91662fdc77a4ada8659be12337ad6c76 to your computer and use it in GitHub Desktop.
(autohotkey) - remember the clipboard state between restart/shutdown
#noEnv
; #noTrayIcon
#persistent
#singleInstance, force
onExit, save_clipboard
;execute_this ; ex_this( git.io/vFQ1z )
if fileExist(a_scriptDir . "\restart clipboard.txt")
{
if (clipboard = "") ; if it hasnt been set to anything else
fileRead, clipboard, % a_scriptDir "\restart clipboard.txt"
fileDelete, % a_scriptDir "\restart clipboard.txt"
}
;execute_end
if !fileExist(a_startup "\" a_scriptName ".lnk")
fileCreateShortcut, % a_scriptFullPath, % a_startup "\" a_scriptName ".lnk"
return ; end of auto-execute ----------------------------------------------
save_clipboard:
;exit_this
if (clipboard) and (a_exitReason = "shutdown")
fileAppend, % clipboard, % a_scriptDir "\restart clipboard.txt"
;exit_end
exitApp
/*
[script info]
version = 0.1.1
description = remember the clipboard state between restart/shutdown
author = davebrny
source = https://gist.github.com/davebrny/91662fdc77a4ada8659be12337ad6c76
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment