Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BE_ClipboardSetText multiple types #178

Open
belac9615 opened this issue Aug 15, 2019 · 5 comments
Open

BE_ClipboardSetText multiple types #178

belac9615 opened this issue Aug 15, 2019 · 5 comments

Comments

@belac9615
Copy link

It would be great if we could set multiple Pasteboard or "clipboard" types all at once, similar to how Excel sets the Pasteboard. That way we as FM developers could increase our interoperability with other apps on the system by writing handlers to copy table/portal text to Excel or an email client. We could also facilitate copy/paste functions within our FM apps using our own custom clipboard types.

The proposed change would take a new input to prevent compatibility issues with existing use of the functions. Something as follows would work and be easily understandable by FM developers :

// Using C++ style for basic syntax highlighting
// There wouldn't normally be a ";" after the function call.

// Existing method for setting a single type
BE_ClipboardSetText ( "My Text" ; "public.utf8-plain-text" );

// Additional method for setting multiple types
BE_ClipboardSetText (
    ["My Text" ; "public.utf8-plain-text"];
    ["<some JSON Object>" ; "my.custom.type"]
)

I'm unfamiliar with the plugin's codebase, and I haven't developed FM plugins in the past so I don't know how hard this will be. I'll fork the repo and see if I can get it working on macOS and Windows.

Do the existing developers have any suggestions? Have you tried this before and run into any roadblocks?

@nickorr
Copy link
Member

nickorr commented Aug 16, 2019

This sounds like a really interesting idea. I'm not sure what the use case is though, whenever I've set a clipboard it's because some other applications wants a specific type, so multiple types has never come up.

I don't think we have a multiple type option parameter system for any of the function calls either, so a generic way to handle these, with the [] brackets would be interesting, and could possibly by re-used elsewhere. That said, I'm not sure the plugin API handles them. Let us know how you go.

That said, a way to implement this that would be similar to existing functions and easier to implement would be a

BE_ClipboardSetText ( text ; format { ; append } )

option. That way we can have the append default to false, and if true it would only overwrite the current format, not the whole clipboard. I don't know if the various Mac/win/ios clipboards allow this easily, but in terms of the plugin end, this would seem a simpler way to go about it.

Let us know how it goes, and feel free to submit a patch.

Cheers,
Nick

@belac9615
Copy link
Author

@nickorr Thanks for the comments!

Details on Use Case

I have a very advanced sales quote application where I've written a copy/paste implementation inside of a FileMaker portal. Users are able to select multiple lines by SHIFT+click or CTRL+click, and then copy/cut them and paste them elsewhere in the portal. I'm doing that by using a custom clipboard format that contains a JSON object defining all of the parameters needed and BE_ClipboardSetText. In my paste implementation I find out if the clipboard contains my custom format, and then perform a different action than when a user has text on their clipboard.

I want to add the ability to also select and copy the lines of a quote to Excel or an HTML version to paste into an email at copy time since I won't know where the user is going to paste. Each of those applications expect a different clipboard "format." I mostly understand what the format is and I can copy out to those applications as long as I put a card window that my users can use to pick which program they're going to copy to, but I'm trying to simulate the same functionality that exists in most other programs for a better UX.

Other comments

Ah, I like the append option! Let me see how you guys are doing that in other functions and I'll see if I can mirror it. Are you thinking that you'd call BE_ClipboardSetText() multiple times with an & operator after each?

@nickorr
Copy link
Member

nickorr commented Aug 19, 2019

Excellent, sounds good. Have a look at the other code, and let us know if you have any questions.

And yes, I'd expect then that you'd call the set text multiple times, one for each format, and only the first one would have append set to false.

Cheers,
Nick

@nickorr nickorr closed this as completed Mar 16, 2022
@DanShockley
Copy link

@nickorr - not sure if I should ask to reopen this, or start a new issue. Let me know if I should move this to a new Issue. It is marked as Closed, but I don't think the "append" option has been added, as of version 5.0.0. Are you still possibly considering adding that?

Explanation:
I was looking for something related to using BaseElements to replicate some of what I've built in FmClipTools, and at least on the Mac, you can definitely have multiple types of objects the clipboard. I don't know how well (or if) that works on Windows.
For example, when you copy one or more layout objects from FileMaker, it puts the following types of objects into the clipboard: XML, PDF, JPEG, 8BPS, GIF, JP2, TIFF, PNG, BMP, and TPIC. Then, when you paste, the target application pulls whichever object type it prefers. So, if you paste again within FileMaker, it grabs the XML and pastes actual FM objects into the layout you are editing. But, if you instead go to an image editor application, it might pick the TIFF objects, and you will get pictures of what the copied FM objects looked like while in Layout Mode.
That's just one example. There's a lot more you can do this this capability, like copy some FileMaker field objects, then run something that makes "Set Field" script steps for each field, adds those to the clipboard, then appends layout objects, the names of the fields as text, etc. Then, you can paste into different contexts, which will grab the appropriate objects.
I have something like that in FmClipTools, but if people could do something similar entirely within FileMaker, that could be useful.

Again, I'd be happy to start a new Issue instead, if that makes sense. Or, if you don't think this is something that makes sense for BaseElements, I can see that, too.
Thank you either way - love BE!
Dan

@nickorr
Copy link
Member

nickorr commented Jul 30, 2024

I'm happy to re-open this.

@belac9615 - did you get anywhere with the fork and looking at the code base for this?

I've done a heap of work on docs to compile the plugin it which will be of interest to you - let me know if you want a quick run down.

Cheers,
Nick

@nickorr nickorr reopened this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants