Fixed - WIN8.1 Unable read ClipboardAll

Report problems with documented functionality
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Fixed - WIN8.1 Unable read ClipboardAll

08 May 2014, 11:37

[Moderator's note: Refer to the newer topic, [win8.1]Clipboard contents is file, Unable read ClipboardAll]


When the contents of the clipboard is a file, can not read ClipboardAll. And will use a lot of time.
And if the contents of the clipboard is a folder, or other content, not have this problem.

WIN8.1 32
L 32 U v1.1.15.00

Code: Select all

MsgBox,Please copy a file
T := A_TickCount
a := ClipboardAll 
MsgBox % StrLen(a)  " ≈ " A_TickCount - T
Clipboard:=1111
T := A_TickCount
a := ClipboardAll 
MsgBox % StrLen(a)  " ≈ " A_TickCount - T
Last edited by arcticir on 09 May 2014, 08:27, edited 1 time in total.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: can not read ClipboardAll

08 May 2014, 11:52

You can't use StrLen on ClipboardAll variable.

Code: Select all

MsgBox,Please copy a file
T := A_TickCount
a := ClipboardAll 
MsgBox % VarSetCapacity(a)  " ˜ " A_TickCount - T
VarSetCapacity(a,0)
Clipboard:="1111"
T := A_TickCount
a := ClipboardAll 
MsgBox % VarSetCapacity(a)  " ˜ " A_TickCount - T
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: can not read ClipboardAll

08 May 2014, 12:26

Sorry, My example is not properly express. please test the following script.
When the file, I not read, the other normal. And the use of time of up to 1 second.

Code: Select all

MsgBox,Please copy a file
T := A_TickCount
MsgBox % FromClip()  " ˜ " A_TickCount - T


Clipboard:="1111"
T := A_TickCount
MsgBox % FromClip()  " ˜ " A_TickCount - T

FromClip(){
	a:=ClipboardAll
	b := &a
	loop
	{
		if (m := NumGet(b+0))
		{
			L:=NumGet(b+4)
			F.=m "`n"
			b := b + 8 + L
		}
		else
			break
	}
	Return F
}
Last edited by arcticir on 08 May 2014, 12:44, edited 2 times in total.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: can not read ClipboardAll

08 May 2014, 12:33

Code: Select all

MsgBox,Please copy a file
T := A_TickCount
MsgBox % FromClip()  " ˜ " A_TickCount - T


Clipboard:="1111"
T := A_TickCount
MsgBox % FromClip()  " ˜ " A_TickCount - T

FromClip(){
    a:=ClipboardAll
    b := &a
    end:=b+VarSetCapacity(a)
    While (b<=end && m := NumGet(b+0)){
        L:=NumGet(b+4)
        F.=m "`n"
        b := b + 8 + L
    }
    Return F
}
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: can not read ClipboardAll

08 May 2014, 12:48

Thanks. But your example can not be read.
This may be WIN8.1 update brings problems.

Image
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: can not read ClipboardAll

08 May 2014, 21:36

Sorry, I did not.
You are using a WIN8.1 U 64?
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: can not read ClipboardAll

09 May 2014, 01:06

No, try to debug:

Code: Select all

T := A_TickCount
MsgBox % FromClip()  " ˜ " A_TickCount - T

FromClip(){
    a:=ClipboardAll
    b := &a
    end:=b+VarSetCapacity(a)-8
    While (b<=end && m := NumGet(b+0,"UInt")){
        L:=NumGet(b+4,"UInt")
        F.=m "`n"
        ToolTip % F
        Sleep 500
        b := b + 8 + L
    }
    Return F
}
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: can not read ClipboardAll

09 May 2014, 01:19

Or wrong.
problem this line "a:=ClipboardAll", so the problem not code. AHK OR WIN8.1
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: can not read ClipboardAll

09 May 2014, 02:07

What is the actual problem?
Can you not access Clipboard?
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: can not read ClipboardAll

09 May 2014, 02:32

Normal access clipboard, but if the file contents of the clipboard, not properly read ClipboardAll.
a:=ClipboardAll
1, long time
2, Unable manipulated variable A
just me
Posts: 9458
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: can not read ClipboardAll

09 May 2014, 07:38

Not sure what you want to achieve, but maybe this will help:

Code: Select all

#NoEnv
MsgBox, 0, Clipboard Test, Please copy a file
MsgBox, 0, File Standard,  % EnumClipboardFormats()   ; standard formats
MsgBox, 0, File All,  % EnumClipboardFormats(False)   ; all formats

Clipboard := "1111"
MsgBox, 0, Text Standard,  % EnumClipboardFormats()   ; standard formats
MsgBox, 0, Text All,  % EnumClipboardFormats(False)   ; all formats

ExitApp

EnumClipboardFormats(StandardOnly := True) {
   ; Clipboard Reference -> msdn.microsoft.com/en-us/library/ff468801(v=vs.85).aspx
   Static CF := {1: "TEXT", 2: "BITMAP", 3: "METAFILEPICT", 4: "SYLK", 5: "DIF", 6: "TIFF", 7: "OEMTEXT", 8: "DIB"
               , 9: "PALETTE", 10: "PENDATA", 11: "RIFF", 12: "WAVE", 13: "UNICODETEXT", 14: "ENHMETAFILE", 15: "HDROP"
               , 16: "LOCALE", 17: "DIBV5", 0x80: "OWNERDISPLAY", 0x81: "DSPTEXT", 0x82: "DSPBITMAP"
               , 0x83: "DSPMETAFILEPICT", 0x8E: "DSPBITMAP"}
   Formats := ""
   If DllCall("User32.dll\OpenClipboard", "Ptr", 0, "UInt") {
      ClipFormat := 0
      While (ClipFormat := DllCall("User32.dll\EnumClipboardFormats", "UInt", ClipFormat, "UInt")) {
         If (StandardOnly)
            Formats .= CF.HasKey(ClipFormat) ? CF[ClipFormat] . "`n" : ""
         Else If CF.HasKey(ClipFormat)
            Formats .= CF[ClipFormat] . "`n"
         Else If (ClipFormat >= 0x0200) && (ClipFormat <= 0x02FF)
            Formats .= ClipFormat . " (PRIVATE)`n"
         Else If (ClipFormat >= 0x0300) && (ClipFormat <= 0x03FF)
            Formats .= ClipFormat . " (GDIOBJ)`n"
         Else If (ClipFormat >= 0xC000) {
            VarSetCapacity(FormatName, 512, 0)
            DllCall("User32.dll\GetClipboardFormatName", "UInt", ClipFormat, "Str", FormatName, "Int", 256)
            Formats .= (FormatName ? FormatName : ClipFormat . " (UNKNOWN)") . "`n"
         }
         Else
            Formats .= ClipFormat . " unknown`n"
      }
      DllCall("User32.dll\CloseClipboard")
   }
   Return RTrim(Formats, "`n")
}
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: can not read ClipboardAll

09 May 2014, 08:20

Thanks.
precisely: Use WIN8.1 Unable read properly ClipboardAll

Premise: The current contents of the clipboard is a file, such as your copy of "AutoHotkey.exe"
Contrast XP and WIN8.1

XP time 0
results obtained are:

Code: Select all

15
49158
49159
49161
49171
49343
49348
49353
WIN8.1 time 1000
Not any data.

The reason for this difference is: a:=ClipboardAll


Code: Select all

T := A_TickCount
MsgBox % FromClip()  " ˜ " A_TickCount - T

FromClip(){
    a:=ClipboardAll
    b := &a
    end:=b+VarSetCapacity(a)-8
    While (b<=end && m := NumGet(b+0,"UInt")){
        L:=NumGet(b+4,"UInt")
        F.=m "`n"
        b := b + 8 + L
    }
    Return F
}
Last edited by arcticir on 09 May 2014, 09:10, edited 1 time in total.
just me
Posts: 9458
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: WIN8.1 Unable read ClipboardAll

09 May 2014, 08:39

I confirm this behaviour for Win 8.1 Pro x64.
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: WIN8.1 Unable read ClipboardAll

09 May 2014, 09:51

Results using Win 8
49161
49337
49627
49630
49338
49347
49364
15
49158
49159
49171
Recommends AHK Studio
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: WIN8.1 Unable read ClipboardAll

13 May 2014, 01:39

It will be repaired it?
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: can not read ClipboardAll

03 Aug 2014, 05:40

HotKeyIt wrote:You can't use StrLen on ClipboardAll variable.
Not on ClipboardAll itself, but you can use StrLen on another variable to which you've assigned ClipboardAll. You just need to multiply it by (A_IsUnicode ? 2 : 1) to get the number of bytes.
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: WIN8.1 Unable read ClipboardAll

03 Aug 2014, 22:04

Did someone move this thread from Ask for Help to Bug Reports, without considering that there's already a thread in Bug Reports? Or did the OP double post?
http://ahkscript.org/boards/viewtopic.php?f=14&t=4147
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: WIN8.1 Unable read ClipboardAll

04 Aug 2014, 07:37

Sorry, I just want this cause for concern. Because this issue has been raised for a long time, but not taken seriously.
Also, this post does not clearly express.So I posted a new post, with a clearer example.


My last hunt ask, Also did not get a reply:
arcticir wrote:It will be repaired it?

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 53 guests