Clipboard not work properly with ^v Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
dsewq1LYJ
Posts: 114
Joined: 26 Aug 2014, 23:21

Clipboard not work properly with ^v

01 Jan 2018, 03:04

TEST SCRIPT:

Code: Select all

global foo := ""
Loop,1
  foo.="o"
return
+F12::
QPC(1)
  Send %foo%
TEST1 := QPC(0)
QPC(1)
  tmp := Clipboard
  , Clipboard := foo
  SendPlay ^v
TEST2 := QPC(0)
Tooltip % TEST1 "`n" TEST2
return
QPC(R := 0) {
  static P := 0, F := 0, Q := DllCall("QueryPerformanceFrequency", "Int64*", F)
  return !DllCall("QueryPerformanceCounter", "Int64*", Q) + (R ? (P := Q) / F : (Q - P) / F)
}
Clipboard works great if the content for clipboard is short, but if you try to increase Loop,1 to Loop,10 OR Loop,100
and press +F12 rapidly, look at the content you just paste out, it randomly paste with same string but uppercase.
'oooooOOOO'

I try to solve this issue by myself.
I did try

(1). NOT WORK with ClipWait
Using ClipWait to force the script paste until the clipboard is not empty.

Code: Select all

  tmp := Clipboard
  , Clipboard := "" ; NOTE: This line is for ClipWait
  , Clipboard := foo
  ClipWait,4
  SendPlay ^v
(2). NOT WORK with string checking.
Using while loop to make a case-sensitive condition.

Code: Select all

  tmp := Clipboard
  , Clipboard := foo
  while (Clipboard != foo)
  {}
  SendPlay ^v
(3). WORK but STUPID with Sleep.
Put a Increased Sleep depend on the foo's length with the Clipboard binding statement.

Code: Select all

  tmp := Clipboard
  , Clipboard := foo
  Sleep 8 * StrLen(StrLen(foo))
  SendPlay ^v
Yes the case 3 can solve this problem, but it's awful solution.
Can someone please help me out :headwall:
User avatar
noname
Posts: 509
Joined: 19 Nov 2013, 09:15

Re: Clipboard not work properly with ^v  Topic is solved

01 Jan 2018, 08:30

Image

Do not find any problem , some other ( ahk ?) program must be interfering with your clipboard.

Code: Select all

Loop,1000
  foo .="o"
run , notepad.exe
WinWaitActive, ahk_exe notepad.exe



loop 20
{
clipboard:=""
QPC(1)
Clipboard :=foo QPC(0) "`n"
clipwait
Send ^v
}

exitapp

QPC(R := 0) {
  static P := 0, F := 0, Q := DllCall("QueryPerformanceFrequency", "Int64*", F)
  return !DllCall("QueryPerformanceCounter", "Int64*", Q) + (R ? (P := Q) / F : (Q - P) / F)
}
soundcloud.com/user-32706894
dsewq1LYJ
Posts: 114
Joined: 26 Aug 2014, 23:21

Re: Clipboard not work properly with ^v

01 Jan 2018, 09:46

noname wrote:Image

Do not find any problem , some other ( ahk ?) program must be interfering with your clipboard.

Code: Select all

Loop,1000
  foo .="o"
run , notepad.exe
WinWaitActive, ahk_exe notepad.exe



loop 20
{
clipboard:=""
QPC(1)
Clipboard :=foo QPC(0) "`n"
clipwait
Send ^v
}

exitapp

QPC(R := 0) {
  static P := 0, F := 0, Q := DllCall("QueryPerformanceFrequency", "Int64*", F)
  return !DllCall("QueryPerformanceCounter", "Int64*", Q) + (R ? (P := Q) / F : (Q - P) / F)
}
LUL
:facepalm:

I did realized the 'uppercase' problem is from

Code: Select all

Send %foo%
not

Code: Select all

Send ^v
there's no issue with Clipboard. but this issue is happen when my SetStoreCapslockMode is On and using SendInput without any 'Sleep'.

Code: Select all

Send %foo%
Sleep 1
Should fix this issue. case closed :trollface: :facepalm:

Return to “Ask For Help”

Who is online

Users browsing this forum: Ben, Forgetabyteit, Google [Bot], kdservices, ManualColdSwitch, need4speed, tee_rock, vsub and 140 guests