Problem with copying lisview conent, only half getting copied Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
truekefir
Posts: 17
Joined: 29 Jul 2017, 13:57

Problem with copying lisview conent, only half getting copied

18 Aug 2017, 20:07

I'm trying to copy listviews selected content but for some reason it's not copying the whole selection but only about half of it.

Am I doing it wrong?

Doesn't matter how many rows I choose it's always copying about a half.

Code: Select all

#SingleInstance force
#NoEnv

ColumnNames	:= "1|2|3|4|5|6|7|8|9|10"
	Gui +Resize
	Gui, Add, ListView, xm h800 w580 vMyListView Grid, %ColumnNames%
	Gui, Show
	
number:=1	
Loop, 50
	{
	LV_Add("", number,number,number,number,number,number,number,number,number,number)
	number+= 1
	}
return


GuiSize:  
if A_EventInfo = 1  
    return
GuiControl, Move, MyListView, % "W" . (A_GuiWidth - 20) . " H" . (A_GuiHeight - 40)
return

GuiClose: 
ExitApp
return

#IfWinActive, test clipboard
^c::
{
ControlGet, Clipboard, List, Selected, SysListView321, test clipboard
LV_Modify("", "-Select")
}
Return
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Problem with copying lisview conent, only half getting copied  Topic is solved

19 Aug 2017, 08:56

I do not know why this is. I'd argue it's a bug (whether on the AHK level or on the Windows level, I don't know), but change your output variable in ControlGet to Var and then use Clipboard:=Var afterwards to work around it.

I would like to guess that a certain amount of memory is being buffered for Clipboard, but the estimation for how much memory is required is off because of some hidden characters or something in the output from ListView using ControlGet, that we only reserve half as much room for Clipboard. But that is pure speculation. For whatever reason, variables internal to AHK work just fine, and then the process of putting those variables onto Clipboard seems to work.
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Problem with copying lisview conent, only half getting copied

19 Aug 2017, 09:30

The original script is working here if I use AHK ANSI. So it might be that some size / length is determined for ANSI (~ half of Unicode).
garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: Problem with copying lisview conent, only half getting copied

19 Aug 2017, 10:03

this works for me ( autohotkeyU32 XP netbook )

Code: Select all

;-------- https://autohotkey.com/boards/viewtopic.php?f=5&t=36005 ---
#SingleInstance force
#NoEnv
cx=test clipboard
Gui,1:default
ColumnNames	:= "01|02|03|04|05|06|07|08|09|10"
Gui, Add, ListView, xm h800 w580 +altsubmit vMyListView Grid, %ColumnNames%
Gui, Show,,%cx%
gosub,aa1
return

aa1:
i=0
Loop, 50
  {
  i++
  LV_Add("", i,i,i,i,i,i,i,i,i,i)
  }
return
GuiClose:
ExitApp


#IfWinActive, test clipboard
^c::
clipboard=
ControlGet, test, List, Selected, SysListView321,%cx%
msgbox,%test%
clipboard:=test
LV_Modify("", "-Select")
Return
;===============================================================

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Joey5, RandomBoy and 324 guests