Clipboard with BusyCal events just takes the last one

Hi KM-Community,
I just tried to made a macro for reformatting/rearranging text. Its purpose is to convert some events selected and copied from BusyCal to a readable timetable. But I have a problem here that I don't understand: This does not work if I take the System Clipboard I get after selecting and copying the events from BusyCal.
If I just paste this into e.g. Mail or TextEdit, I get a somewhat formatted, but complete text output including all selected and copied events - as expected. In the beginning of my macro, I have an action "Set Variable “instance__Eventlist” to Text “%SystemClipboard%”", but I only get the last event into the Variable (it's converted to plain text, but that's normal and no problem).
Why are the earlier events missing? Any idea what may be the problem here? Maybe it actually copies a lot more than the text... if this multi-dimensional-clipboard is the problem - any idea how I could force KM to get the same text into my variable that TextEdit takes if I paste there?
Any ideas appreciated!

PS: If I paste to TextEdit faste, select and copy again, the Macro runs completely fine... this may be a workaround, but of course I'd prefer a solution without having to open TextEdit.

I have never understood clipboards very well, but I know that clipboards have "flavours" and most likely that's an issue here. If you want to see what flavours your clipboard contains when you copy something from BusyCal, you can run this macro:

image

use framework "AppKit"
use scripting additions

set pb to current application's NSPasteboard's generalPasteboard()
set typesList to pb's types() as list
return typesList
1 Like

To get a sense of what is really going on, we would need to see the macro.


See the section here on uploading macros to the forum:

Uploading macros to the forum

BusyCal-Termintext reduzieren copy.kmmacros (2.3 KB)

...I don't know how this helps, but here is my 1.5-action macro. Everything afterwards is working, but only with the text in the variable, which is too short when copying from BusyCal.

@Airy: Thanks for the script, that's what I suspect, too. Here's the output:

com.busymac.editcontroller.object, com.apple.flat-rtfd, NeXT RTFD pasteboard type, public.rtf, NeXT Rich Text Format v1.0 pasteboard type, public.utf16-external-plain-text, CorePasteboardFlavorType 0x75743136, public.utf8-plain-text, NSStringPboardType

Don't know what to do with it next, though - is there a possibility to explicitly read the different flavours (or find out which one e.g. KM uses)?

The reason for getting that information was for other experts here who probably know how to interpret flavours. I'm not a real expert, just someone who uses the basics of KM a lot.

Thanks for posting that – show is always clearer than tell, and shortens testing time – below is a modified version which displays the additional selected items.

The simplest approach (to adjusting which clipboard flavour – pasteboard item type – is being chosen by Keyboard Maestro) is described here:


And there is more general discussion of clipboards at:

Keyboard Maestro Wiki – Clipboards


Updated macro:

BusyCal-Termintext reduzieren (Version 2).kmmacros (3.1 KB)

Thank You!!
This is the solution for my problem as well as some really interesting information about clipboard handling. This will help me for now and for the future as well, so thanks again for taking your time for this post!

PS: I‘ll post my problem macros in the future… even if it’s just one action, promise! :sweat_smile:

2 Likes

Looking at this case more closely, I notice that the BusyCal problem which is getting fixed by

is not, in fact, the selection of the public.utf8-plain-text flavor, rather than public.rtf, for example - Keyboard Maestro is already doing that.

The real problem is that BusyCal are using non-standard line-ending characters in their public.utf8-plain-text pasteboard items (perhaps because they are also writing for Windows machines), and these need to be normalized.

Our original solution already does, that, as part of standard house-keeping, but a more closely targeted fix, with the same result, would be:

BusyCal-Termintext reduzieren (Version 3).kmmacros (3.2 KB)

1 Like

This is interesting, thanks for further investigating!
Sounds like you managed to take a closer look at the different clipboard flavors - is there any more or less reliable way to watch and investigate the clipboard contents including its different flavors separately that you could share or did you just take the time to do trial&error with the black box for this special case?

EDIT: Just found your Clipboard Viewer - will check this out!

1 Like