Advertisement
Zektrix1

CHS - Clipboard History Saver

Jul 20th, 2024
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Requires AutoHotkey v2.0
  2. #SingleInstance Force
  3.  
  4. ClipboardChanged := True
  5. TextFileName := ""
  6. HeaderName := ""
  7.  
  8.  
  9. Numpad7::
  10. {
  11.     Global
  12.     ClipboardChanged := !ClipboardChanged
  13.     ToolTip (ClipboardChanged ? "enabled" : "disabled")
  14.     Sleep 1200
  15.     ToolTip ""
  16. }
  17.  
  18. NumpadAdd::
  19. {
  20.     Global
  21.     Try
  22.     {
  23.         If !(TextFileName = "")
  24.         {
  25.             Run TextFileName ".txt"
  26.             WinWaitActive TextFileName ".txt - Notepad"
  27.             WinActivate TextFileName ".txt - Notepad"
  28.             Send "^{End}"
  29.         }
  30.         Else
  31.         {
  32.             Run "Clipboard Stash.txt"
  33.             WinWaitActive "Clipboard Stash.txt - Notepad"
  34.             WinActivate "Clipboard Stash.txt - Notepad"
  35.             Send "^{End}"
  36.         }
  37.     }
  38.     Catch
  39.     {
  40.         MsgBox "No file to load"
  41.     }
  42. }
  43.  
  44.  
  45. NumpadMult::
  46. {
  47.     Global
  48.     IB_HeaderName := InputBox("Enter a Header")
  49.     HeaderName := IB_HeaderName.Value
  50. }
  51.  
  52. NumpadSub::
  53. {
  54.     Global
  55.     IB_TextFileName := InputBox("Enter a File Name")
  56.     TextFileName := IB_TextFileName.Value
  57. }
  58.  
  59. Numpad8::
  60. {
  61.     Reload
  62. }
  63.  
  64. Numpad9::
  65. {
  66.     ExitApp
  67. }
  68.  
  69. OnClipboardChange ClipChanged
  70.  
  71. ClipChanged(*)
  72. {
  73.     Global
  74.     If (ClipboardChanged)
  75.     {
  76.         If !(TextFileName = "")
  77.         {
  78.             If !(HeaderName = "")
  79.             {
  80.                 FileAppend("--------------------------------------------------------------------------------`n" HeaderName "`n`n" A_Clipboard "`n", TextFileName ".txt")
  81.                 F_Success()
  82.             }
  83.         }
  84.         If (TextFileName = "")
  85.         {
  86.             If !(HeaderName = "")
  87.             {
  88.                 FileAppend("--------------------------------------------------------------------------------`n" HeaderName "`n`n" A_Clipboard "`n", "Clipboard Stash.txt")
  89.                 F_Success()
  90.             }
  91.         }
  92.         If !(TextFileName = "")
  93.         {
  94.             If (HeaderName = "")
  95.             {
  96.                 FileAppend("--------------------------------------------------------------------------------`n`n" A_Clipboard "`n", TextFileName ".txt")
  97.                 F_Success()
  98.             }
  99.         }
  100.         If (TextFileName = "")
  101.         {
  102.             If (HeaderName = "")
  103.             {
  104.                 FileAppend("--------------------------------------------------------------------------------`n`n" A_Clipboard "`n", "Clipboard Stash.txt")
  105.                 F_Success()
  106.             }
  107.         }
  108.     }
  109. }
  110.  
  111. F_Success()
  112. {
  113.     ToolTip "Success"
  114.     Sleep 1200
  115.     ToolTip ""
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement