Copy pasting in the background

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
marsa
Posts: 25
Joined: 11 Jul 2018, 10:36

Copy pasting in the background

16 Oct 2018, 07:50

Hi hivemind :D

Here is my code [code=autohotkey file=Untitled.ahk[#Persistent

SetTimer CheckWindow, 250

CheckWindow:

IfWinNotExist, placeholder
Return

else

WinActivate, placeholder

sleep,100

loop,2

{
send, {tab}

}

Send, ^a

sleep, 200

Gosub, copy

sleep, 300

WinWaitClose,placeholder
Return



copy:

clip5 =

ClipSaved := ClipboardAll

clipboard := ""

Send, ^c

ClipWait, 1

if (!ErrorLevel)

clip5 = %clipboard%

Sleep, 100

clipboard := ClipSaved

ClipSaved := ""

Pause

return

WinWaitClose,Wimi förifyllnad

return



F11:: ; save clip2

clip5 =

ClipSaved := ClipboardAll

clipboard := ""

Send, ^c

ClipWait, 1

if (!ErrorLevel)

clip5 = %clipboard%

Sleep, 100

clipboard := ClipSaved

ClipSaved := ""

return



f12::

ClipSaved := ClipboardAll

clipboard := ""

clipboard = %clip5%

ClipWait, 1

if (!ErrorLevel)

Send, ^v

Sleep, 100

clipboard := ClipSaved

ClipSaved := ""

return[/code]

As you all can see I want to copy paste something in to clip5 and later be able to paste it on using the code below F12. If I use the code below F11 and F12 it works, but as soon as I try using paste with the code under presistant it fail to copy.
eqv
Posts: 72
Joined: 18 Sep 2018, 22:17

Re: Copy pasting in the background

17 Oct 2018, 20:14

marsa wrote:
16 Oct 2018, 07:50
Pause

return
I'm not sure I understand what you want, but the "Pause" command will pause your "copy" routine; and it will not end. Delete that, and just leave what follows:
(I assume, you want to wait to close "Wimi förifyllnad" to copy again)
marsa wrote:
16 Oct 2018, 07:50
WinWaitClose,Wimi förifyllnad

return
Hope it helps,
marsa
Posts: 25
Joined: 11 Jul 2018, 10:36

Re: Copy pasting in the background

18 Oct 2018, 01:02

eqv wrote:
17 Oct 2018, 20:14
marsa wrote:
16 Oct 2018, 07:50
Pause

return
I'm not sure I understand what you want, but the "Pause" command will pause your "copy" routine; and it will not end. Delete that, and just leave what follows:
(I assume, you want to wait to close "Wimi förifyllnad" to copy again)
marsa wrote:
16 Oct 2018, 07:50
WinWaitClose,Wimi förifyllnad

return
Hope it helps,
No actully not. I want the script to save clipboard in clip5 and then dont do anything else until wimi förifyllnad opens again. Is the presit tag making the script delete whats in clip5?
eqv
Posts: 72
Joined: 18 Sep 2018, 22:17

Re: Copy pasting in the background

18 Oct 2018, 01:22

marsa wrote:
18 Oct 2018, 01:02
No actully not. I want the script to save clipboard in clip5 and then dont do anything else until wimi förifyllnad opens again. Is the presit tag making the script delete whats in clip5?
"#Persistent" only avoid the script to close itself when finish:
https://autohotkey.com/docs/commands/_Persistent.htm
So no, it shouldn't do anything; it's the same if you delete it, and keep your other hotkeys (by default, also avoids to close the script).

Just in case: if you use "F11", even without selecting anything, it will delete "clip5" content.
• Try deleting this part, from "copy" and "F11" subroutines (It's not necessary, and deletes "clip5" content):

Code: Select all

clip5 =
marsa
Posts: 25
Joined: 11 Jul 2018, 10:36

Re: Copy pasting in the background

18 Oct 2018, 02:14

Aha I see f11 and f12 are only there as proof of concept. Dont take them into consideration.

The wierd part is that when I use the code from f11 to copy with sub copy it dont work, bit of I keep F11 and put send f11 it works

eqv wrote:
18 Oct 2018, 01:22
marsa wrote:
18 Oct 2018, 01:02
No actully not. I want the script to save clipboard in clip5 and then dont do anything else until wimi förifyllnad opens again. Is the presit tag making the script delete whats in clip5?
"#Persistent" only avoid the script to close itself when finish:
https://autohotkey.com/docs/commands/_Persistent.htm
So no, it shouldn't do anything; it's the same if you delete it, and keep your other hotkeys (by default, also avoids to close the script).

Just in case: if you use "F11", even without selecting anything, it will delete "clip5" content.
• Try deleting this part, from "copy" and "F11" subroutines (It's not necessary, and deletes "clip5" content):

Code: Select all

clip5 =

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: gongnl, Google [Bot], Rohwedder and 262 guests