Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clipboard data
#1
I'm trying to perform actions depending on the contents of the clipboard into a graphic application (MicroStation).

Is it possible to identify the contents of the clipboard?
#2
Macro Enum clipboard formats
Code:
Copy      Help
;When you copy something in an application, it usually stores data in clipboard in several formats.
;This macro shows what formats are currently in the clipboard.

out

int f; str s
OpenClipboard 0
rep CountClipboardFormats
,f=EnumClipboardFormats(f)
,s.fix(GetClipboardFormatName(f s s.all(100)))
,out "%i %s" f s
CloseClipboard

out "<>The numbers without names are <link ''http://www.google.com/search?q=site:microsoft.com Clipboard Formats''>standard clipboard formats</link>."
#3
Is possible to get the contents of the clipboard in hex format and the size of data?
#4
What clipboard format? For each clipboard format, data format and storage is different.
#5
'MicroStation format' if is possible...
else Paint.
#6
Try this.
Macro Macro1572
Code:
Copy      Help
str s.getclip("MicroStation format")
out s.len
outb s iif(s.len<1000 s.len 1000) 1
#7
It works.
Thanks.
#8
When I copy one element in Microstation:

macro result:

14
49777 MicroStation Element
3

----------------------------

If I try

str s.getclip("MicroStation Element") ----> s.len=0

str s.getclip(14) -----> s.len=0

str s.getclip(3) ------> s.len=16 and s changes every time with the same object.

Other idea?
#9
getclip supports only clipboard formats where data is stored in global memory. Also bitmap.

We don't know where is stored data of "MicroStation Element" format, and how to get it.
Formats 3 and 14 are or contain metafile handles. Metafiles store pictures. To read more, click the link in QM output when you run macro "enum clipboard formats".

It is possible to get metafile data from handle. I never tried it. I would try GetEnhMetaFileBits or similar function, look in MSDN. Or maybe easier would be to save it to file with CopyEnhMetaFile, then getfile. To get handle, use format 14, but instead of getclip use OpenClipboard, GetClipboardData, CloseClipboard.
#10
I tried several methods but don't work (the object can be rotated or different size ...).

Now, the only thing that interests me is the name of the selected object. Do you know any method?
#11
No, I don't know where name is stored. Try to save with CopyEnhMetaFile, then look for name in the file.

From MSDN, "Enhanced Metafile Records".

Quote:An optional text description can follow the header record. The text description describes the picture and the author's name.
#12
Macro Macro5
Code:
Copy      Help
OpenClipboard 0
int h=GetClipboardData(14)
str f="$Desktop$\test\test11f"
f.expandpath
CopyEnhMetaFile h f
CloseClipboard

result:

.zip   test11e.zip (Size: 2.46 KB / Downloads: 273)

Do you know how decrypt the file?
#13
Macro Macro1571
Code:
Copy      Help
str s.getfile( "$desktop$\test11e.wmf")
outb s s.len 1

Contains text "MicroStation View" "View".
#14
but the search text should be: I811
#15
It is not in metafile. Probably it is in the microstation format, but we don't know about it.


Forum Jump:


Users browsing this thread: 1 Guest(s)