Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Requires AutoHotkey v2.0
- #InputLevel 1
- #SingleInstance Force
- PID := DllCall("GetCurrentProcessId")
- ProcessSetPriority "High", PID
- Hotkey "^1", Exit
- Hotkey "^p", ClipCopy
- TC := TextCopier()
- ClipCopy(ThisHotkey){
- if(TC.copying == 0){
- TC.advancer()
- }
- }
- Exit(ThisHotkey){
- ExitApp
- }
- class TextCopier {
- selectedText := ""
- timeCheckBegin := 0
- timeCheckEnd := 0
- Control_State := GetKeyState("Control", "P")
- P_State := GetKeyState("P", "P")
- copying := 0
- advancer(){
- this.copying := 1
- this.timeCheckBegin := A_TickCount
- this.checkKeys()
- ;Tooltip Format("{1}`n{2}", this.Control_State, this.P_state)
- while(this.Control_State and this.P_State){
- this.checkKeys()
- this.timeCheckEnd := A_TickCount
- if(this.timeCheckEnd - this.timeCheckBegin >= 2000){
- ;Tooltip "Copying"
- this.copy()
- break
- }
- }
- if(this.copying == 1){
- ;Tooltip "Pasting"
- this.paste()
- }
- }
- checkKeys(){
- this.Control_State := GetKeyState("Control", "P")
- this.P_State := GetKeyState("P", "P")
- }
- copy(){
- s := "^c"
- Send Format("{1}", s)
- Sleep 250
- ;Tooltip A_Clipboard
- this.selectedText := A_Clipboard
- this.copying := 0
- SoundBeep 750, 500
- }
- paste(){
- Send Format("{1}", this.selectedText)
- this.copying := 0
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment