EzFlow997

Special Text Copy and Paster

Nov 30th, 2025
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Autohotkey 1.41 KB | Source Code | 0 0
  1. #Requires AutoHotkey v2.0
  2. #InputLevel 1
  3. #SingleInstance Force
  4. PID := DllCall("GetCurrentProcessId")
  5. ProcessSetPriority "High", PID
  6.  
  7. Hotkey "^1", Exit
  8. Hotkey "^p", ClipCopy
  9.  
  10. TC := TextCopier()
  11. ClipCopy(ThisHotkey){
  12.     if(TC.copying == 0){
  13.         TC.advancer()
  14.     }
  15. }
  16.  
  17. Exit(ThisHotkey){
  18.     ExitApp
  19. }                                                            
  20.  
  21. class TextCopier {
  22.     selectedText := ""                                                  
  23.     timeCheckBegin := 0
  24.     timeCheckEnd := 0
  25.     Control_State := GetKeyState("Control", "P")
  26.     P_State := GetKeyState("P", "P")
  27.     copying := 0
  28.        
  29.     advancer(){
  30.         this.copying := 1
  31.         this.timeCheckBegin := A_TickCount
  32.         this.checkKeys()
  33.         ;Tooltip Format("{1}`n{2}", this.Control_State, this.P_state)
  34.        
  35.         while(this.Control_State and this.P_State){
  36.             this.checkKeys()
  37.             this.timeCheckEnd := A_TickCount
  38.             if(this.timeCheckEnd - this.timeCheckBegin >= 2000){
  39.                 ;Tooltip "Copying"
  40.                 this.copy()
  41.                 break
  42.             }
  43.         }
  44.        
  45.         if(this.copying == 1){
  46.             ;Tooltip "Pasting"
  47.             this.paste()
  48.         }
  49.     }
  50.    
  51.     checkKeys(){
  52.         this.Control_State := GetKeyState("Control", "P")
  53.         this.P_State := GetKeyState("P", "P")
  54.     }
  55.    
  56.     copy(){
  57.         s := "^c"
  58.         Send Format("{1}", s)
  59.         Sleep 250
  60.         ;Tooltip A_Clipboard
  61.         this.selectedText := A_Clipboard
  62.         this.copying := 0
  63.         SoundBeep 750, 500
  64.     }
  65.    
  66.     paste(){
  67.         Send Format("{1}", this.selectedText)
  68.         this.copying := 0
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment