Jump to content

Recommended Posts

Posted

Good morning.

I am having a problem with the BE_ClipboardSetText function and hoping somebody might be able to shed some light on it please.

Long story short, the both functions work fine on my Mac when I use “public.utf8-plain-text” as the [format] parameter – which I get from BE_ClipboardFormats function – I can copy and paste, but it does not work on Windows for my client.  When I run BE_ClipboardFormats on Windows it returns nothing – I have tried three different Windows workstations.  They are using plugin version 5.0.0.2 on FmPro 21.1.1.  I know I'm to use the output from the BE_ClipboardFormats function in the BE_ClipboardSetText function in the "format" parameter

On Windows, it just doesn’t add anything to the clipboard, and the Set Variable value I get when I run the function is 1 whether it’s on the Mac or Windows.  

I’ve tried a number of options for “format” after going through BaseElements Github and other sources, but not found any other formats that work for me on Windows, so I assume it’s the format parameter on Windows that’s not working here.

Please advise either where I‘m going wrong, or if there is a standard format I can hard code in to get them (Windows clients) going.

Cheers,

Greg

 

Posted (edited)

I am not sure I understand your description, esp. this part:

3 hours ago, Greg Hains said:

I know I'm to use the output from the BE_ClipboardFormats function in the BE_ClipboardSetText function in the "format" parameter

That is not an accurate statement.

 

Please clarify:

1. What exactly are you copying? (Or where do you intend to paste?)

2. What do you see in the Data Viewer as the result of only:

BE_ClipboardFormats

immediately after copying from the same location?

 

Edited by comment
Posted

BaseElements have contacted me and advised that using "CF_UNICODETEXT" as one of the format that works out of the box for Windows as found on the Github page: https://github.com/GoyaPtyLtd/BaseElements-Plugin/blob/master/docs/Functions/BE_ClipboardSetText.md

Thanks,

Greg

 

Hi @Comment

Thanks for replying.

My understanding from the Github page above is that the formats available for use in the BE_ClipboardSetText are available from the BE_ClipboardFormats command.

When I run that command in Data Viewer, I get no result (nor error), but if I assign it to a variable in a script in a script I get a few different options on my Mac, Windows I got none.

The purpose of the cut and paste was so that users could copy purely text data from certain fields to use in another application.  

 

Posted
10 minutes ago, Greg Hains said:

When I run that command in Data Viewer, I get no result (nor error), but if I assign it to a variable in a script in a script I get a few different options on my Mac, Windows I got none.

Something doesn't add up here. If you copied text from a field, the BE_ClipboardFormats function should give you a result like this in the Data Viewer on a Mac:

image.png.6b57d08b680a939a3762b6d7f0c3745f.png

 

Posted

Hi @comment

Correct - I got something close to this on my Mac, but the solution is being developed for a Windows environment.

What I wanted to find out was what formats I could use in this Windows environment by copying text to clipboard (for a field), viewing the output of this function (or just using a stock-standard-off-the-shelf format, and then applying that output (format) to the other commands so I could hard code it into the solution for the other layouts.I got a blank result so I was a little perplexed as to why.

Nick Orr came back to me directly shortly after I posted to this forum.

Greg

 

Posted (edited)
28 minutes ago, Greg Hains said:

I was a little perplexed

So am I, but since I am not on Windows I cannot verify this. AFAIK, the "CF_UNICODETEXT" format suggested by Nick Orr should work for plain text so you should have a solution even if the problem remains unclear.

However, according to Microsoft the string needs to be terminated by the null character:
https://learn.microsoft.com/en-us/windows/win32/dataxchg/standard-clipboard-formats

The help page for the BE_ClipboardSetText() function confirms this, but I don't think the solution they suggest will work. AFAIK, the expression Char(0)  generates an empty string. See here for working alternatives:
https://stackoverflow.com/a/74473767/3016153

 

Edited by comment
Posted

Yes, CF_UNICODETEXT suggested by Nick does work in Windows, but I only knew this after having put my question to him and the forum then subsequently trying it.

It was the lack of response from the function that had me second guessing myself.  I have not tried terminating the string with a null, but it works fine without it.

Anyway, all is well, and thankyou @comment and Nick for resolving this.

Cheers,

Greg

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.