Can someone explain this variable and how this works?
I'm looking over this code
https://github.com/sebinside/PremiereClipboard/blob/master/PremiereClipboard/Program.cs
In line 13
And line 98
I'm having trouble understanding this variable and how it is derived to be able to copy the clipboard, Could anyone explain this to me?
GitHub
PremiereClipboard/PremiereClipboard/Program.cs at master · sebinsid...
Working with Adobe Premiere Clip(board)s. Without bullshit. - sebinside/PremiereClipboard
25 Replies
the stuff in
trackFormat
is probably a clipboard format that that application registered (i guess in the registry), then GetData checks if there is that kind of data in the clipboard
what do you mean "how this works", what is not clearApologies if my wrong is unclear, I'm new to programming, so the language is difficult but I want to say my understanding of concepts is good. I've written some good stuff just understanding is hard.
The application in this case is premiere pro
What I'd like to know is, when I go into the premiere pro application and copy something, (like a video clip)
1. How do I see or figure out this "clipboard format" variable?
The
I'd like to know how this was found/derived.
In case I want to copy other things from other programs.
2. How can I know what to set this trackItem variable to so it uses the correct clipboard data?
Also, this is my first time dealing with clipboard stuff, is my understanding correct in the following:
3. There is 1 global "clipboard", when data is copied/cut the data gets some sort of "tag" that is this "clipboard format" (the contents of the trackItem variable) that is like a prefix to the data. This clipboard format is what is used to see if this particular type of data exists in the clipboard so we can locate it/extract it and use it in some way?
Thank you for your time!
Clipboard Formats - Win32 apps
A window can place more than one object on the clipboard, each representing the same information in a different clipboard format. Users need not be aware of the clipboard formats used for an object on the clipboard.
When the user selects "Copy" to copy something to the clipboard, the application can actually add 1 or more things to the clipboard, in different formats. For example, when you copy some text in Word, it might add a plain-text version of what you copied that any application can paste, and also a version with formatting information which means you can paste the text with formatting information into a Word document. The plain-text version is tagged with the "plain text" format, and the Word-specific version with formatting information is tagged as "Word text with formatting".
When the user selects "Paste", the application searches through the different things in the clipboard, looking for one which has a format that it recognises.
"PProAE/Exchange/TrackItem" is just an arbitrary string chosen by Adobe Premier. When the user copies something within Adobe Premier, it adds a version of what was copied to the clipboard in some Adobe Premier-specific format, tagged with "PProAE/Exchange/TrackItem". It might add a more generic version as well, I don't know. When someone selects "Paste" in Adobe Premier, it looks through the things in the clipboard to see if any of them are tagged with "PProAE/Exchange/TrackItem"
That C# application has reverse-engineered the format that Adobe Premier uses to add things to the clipboard, and the "PProAE/Exchange/TrackItem" tag it uses with them.
Okay so I understand the "PProAE" string is determined by Premiere, thank you for that, I still don't understand how I can view the data I just copied and see it's "tag"
I found this https://freeclipboardviewer.com/
Thankfully when I copy something in premiere, at least a clip item it will do this:
Free Clipboard Viewer
Free Clipboard Viewer is a free, full-featured, and portable clipboard viewer for Windows. Free Clipboard Viewer is a program used to view the information stored in memory when you use the copy and cut functions of the Windows operating system. A clipboard viewer displays the current content of the clipboard.
The left side, from what I can see, would be the tags?
I'm hovering over the "PProAE/Exchange/TrackItem" tag since that's the one I'm most interested in
Looks to be the case, yes
Real quick though, for the dev of that c# application, you said he had to reverse engineer to get that arbitrary string?
As it's not really something readily available or displayed anywhere to the normal user.
Well, there are APIs you can use to see what data is in the clipboard (that application you found uses them)
But I doubt Adobe publish the format of the objects they add to the clipboard. So he had to copy stuff, then inspect what was put into the clipboard
One thing I don't get though, when I try to copy other things in premiere, like effects or keyframes, the clipboard viewer only shows these tags
one sec need to get photo right
There we go
but this same clipboard shows up no matter what different effect or keyframe i copy
how come?
You'd have to ask the engineers at Adobe
They can quite literally do what they want
How can I inspect the clipboard more so I can see what I'm copying?
Maybe all the information they need is in the DataObject or Ole Private Data formats, I don't know. Maybe they handle copying keyframes in a different way entirely
For this case of effects and keyframes
So the thing is I'm copying 2 entirely different effects
but the data object, ole, and cookie are static
I exported the clipboard and compared them in hxd
identical
so my assumption is when keyframes or effects are copied, theyr'e stored somewhere else?
I don't work for Adobe: I have no idea what they're doing
I understand, just wanted to know if you had any opinion on what could be happening or how you'd tackle diving into this sort of thing
I mean, you don't need to use the clipboard to implement copy/paste within your application. Its purpose is to copy things between applications
I'm thankful for the assistance so far, it's really helped as I can at least view the one tag I was interested in
Maybe keyframes are complex enough that there's no point trying to paste them into a different application, or they can't sensibly be serialised to a binary object, or.... Not a clue
I see, it could be the case, it'd make sense
So best bet would be to look through API for something related to copying/pasting non trackitem things?
Which APIs?
If they're implementing keyframe copying within Adobe Premier by just recording what was copied within Adobe Premier somewhere, there won't be any Windows APIs to look at that...
I meant the Premiere API
I believe it has one