I have:
dim c as new Clipboard
dim s as string = c.Text
dim sUTI as string = c.RawData("public.utf8-plain-text")
dim sNSP as string = c.RawData("NSStringPboardType") ' this doesn't work at all
c.close
I go to Finder, select 2 files and copy.
Clipboard Viewer https://langui.net/clipboard-viewer/ correctly reports the data under the ‘public.utf8-plain-text’ flavor:
00000000: 74 65 73 74 32 2e 74 78 74 0d test2.txt.
00000010: 74 65 73 74 31 2e 74 78 74 test1.txt
I go to Finder, select the same 2 files and option-copy to copy the pathnames. Clipboard Viewer again reports what’s expected (as does pasting into eg BBedit):
00000000: 2f 55 73 65 72 73 2f 70 73 74 /Users/pst
00000010: 79 73 2f 44 6f 63 75 6d 65 6e ys/Documen
00000020: 74 73 2f 74 65 73 74 32 2e 74 ts/test2.t
00000030: 78 74 0a 2f 55 73 65 72 73 2f xt./Users/
00000040: 70 73 74 79 73 2f 44 6f 63 75 pstys/Docu
00000050: 6d 65 6e 74 73 2f 74 65 73 74 ments/test
00000060: 31 2e 74 78 74 1.txt
But my xojo code snippet only retrieves the first path:
(sUTI is also wrong, and sNSP is blank, probably because the “NSStringPboardType” identifier cannot be interpreted, even tho Clipboard Viewer says this flavor is also there).
Looking closely, the 1st Finder copy uses CR (0D) as the delimiter, whereas the path copy uses LF (0A) (why i have no idea).
Conclusion: xojo’s clipboard gets stumped by plain text LFs.
v2024r4.1 on macos
15 posts - 6 participants