Restoring my clipboard after set time
Posted: 27 Dec 2019, 18:39
hello i am working on a macro tool that can be setup to do multiple things. One of them is to read content of files to the clipboard so i can then paste it anywhere i like, or i can have a macro send ctrl+v to a window to paste it for me. To do this i need to store what was in the clipboard (could be anything) and recall it after a set time to restore my previous clipboard
i have tried 4 things and i am at a loss why none of these are working so i ask for some help pointing me in the right direction
for all gui: the settings used are created in another gui here not included, the gui stuff for these labels not included
any help would be appreciated
i have tried 4 things and i am at a loss why none of these are working so i ask for some help pointing me in the right direction
for all gui: the settings used are created in another gui here not included, the gui stuff for these labels not included
Code: Select all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; method 1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Label1:
ClipSaved := ClipboardAll
SetTimer, Restore, 5000
Start() ; related to my button class
Try Run, %Input96%
Try
{
clipboard =
FileRead, clipboard, %Input99%
clipwait, 1
}
IfWinExist, %Input94% %Input95%
{ WinActivate
MouseGetPos, CurX, CurY
ControlClick,%EditInput127% , , , %Input100%
SendInput , % Input97
MouseMove %CurX%, %CurY% ,0
return
} else {
return
}
return
Restore:
Clipboard := ClipSaved
ClipSaved := ""
SetTimer, Restore, Off
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;; method 2 ;;;;;;;;;;;;;;;;;;;;;;;;;
; in the script that launches these macro's from a button on top
#Persistent
OnClipboardChange("ClipChanged")
return
Label1:
ClipSaved := ClipboardAll
Start() ; related to my button class
Try Run, %Input96%
Try
{
clipboard =
FileRead, clipboard, %Input99%
clipwait, 1
}
IfWinExist, %Input94% %Input95%
{ WinActivate
MouseGetPos, CurX, CurY
ControlClick,%EditInput127% , , , %Input100%
SendInput , % Input97
MouseMove %CurX%, %CurY% ,0
return
} else {
return
}
return
ClipChanged() {
Sleep 5000
Clipboard := ClipSaved
ClipSaved := ""
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;; method 3 ;;;;;;;;;;;;;;;;;;;;;;;;;
Label1:
FileAppend, %ClipboardAll% , Setup/Settings/Temp.clip
SetTimer, Restore, 5000
Start()
Try Run, %Input96%
Try
{
clipboard =
FileRead, clipboard, %Input99%
clipwait, 1
}
IfWinExist, %Input94% %Input95%
{ WinActivate
MouseGetPos, CurX, CurY
ControlClick,%EditInput127% , , , %Input100%
SendInput , % Input97
MouseMove %CurX%, %CurY% ,0
return
} else {
return
}
return
Restore:
FileRead, Clipboard, *c Setup/Settings/Temp.clip
SetTimer, Restore, Off
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;; method 4 ;;;;;;;;;;;;;;;;;;;;;;;;;
; here i simply tried to do it after i send ^v using the macro or use ctrl+v on my keyboard
~^v::
Send, ^v
Sleep, 5000
FileRead, Clipboard, *c Setup/Settings/Temp.clip
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;