AnsweredAssumed Answered

Windows Clipboard CF

Question asked by onefish on Jul 15, 2018
Latest reply on Jul 19, 2018 by onefish

Good afternoon all. I was playing around a bit this afternoon to try and come up with a way to copy calculated text and field data not on the current layout to the Windows clipboard (without a plugin or additional calculation fields, etc). I have come up with a pretty simple little CF that works but not quite 100%.

 

It needs to be used with the Send Event "open document/application" script step. It uses the windows command line to write the text to the clipboard. But it adds a space before all the empty line carriage returns and also adds a trailing carriage return that isn't in the original text. Of course formatting is lost, but that is to be expected.

 

These aren't really big issues as they are invisible, but still annoying. Anyone got any ideas how to tidy it up? Probably comes down more to the Windows command line than Filemaker though :-)

 

The CF requires the single parameter "String".

Syntax: WinClipboard ( String )

 

/* For use with "Send Event" script step to copy field contents or calculated text to the windows clipboard. Fields do not need to be on the current layout. Uses Windows command prompt and is therefore limited by its local variable character limits of 2047 (32 bit) or 8191 (64 bit). */

 

Let (
S = String ;

"cmd.exe /C (echo " &

Substitute ( S ; "¶" ; " && echo." ) &

")|clip" )

 

 

P.S. Better mention that I am well aware of the pitfalls with using the clipboard. I would only ever use this as an easy way to paste data calculated by Filemaker into an external application and then only in non-critical situations. There are times when it's appropriate, and times when it's not.

 

--EDIT--

Simplified a little, only needs a single Substitute(). Still same problem with additional spaces though.

Outcomes