View Full Version : function clipboardGetText( ) question
celestian
January 8th, 2018, 20:24
Does this remove some characters from the text? I'm doing some testing where I snag the clipboard contents of text that absolutely has tabs in it.
https://i.imgur.com/H5yqj9p.png
But when I get the data what I see in FG is this.
https://i.imgur.com/9CWJzBV.png
If I replace the capture of the clipboard with a text box and let them paste it in that and then read that data, will it also strip out tabs? Going to check this later tonight but curious if anyone knows before I re-code to do that.
damned
January 8th, 2018, 21:27
It looks like it might... you cant seem to use a TAB in formattedtext controls...
celestian
January 8th, 2018, 21:51
It looks like it might... you cant seem to use a TAB in formattedtext controls...
I expect a bit of odd behavior in formattedtext but I didn't expect it to strip out tabs from a clipboard before it even gets to formattedtext. I'll test where I paste text into a input window and see if that also strips it.
celestian
January 9th, 2018, 00:57
So my test with a window for input netted the same result. FantasyGrounds strips out the <tab>.
I'm hoping this is something that's not been noticed/asked about before and can be easily remedied. If not then that certainly limits the auto-table creation to comma which unfortunately causes issues with the same character between the intended columns.
Ken L
January 9th, 2018, 00:59
Not sure what you'll need clipboard contents for, but if it's for transferring module information, I use an OS specific handle to manipulate the clipboard 'mid-flight' before I paste it in. Helps when copying in things from PDFs.
For linux in particular this is xclip
celestian
January 9th, 2018, 01:03
Not sure what you'll need clipboard contents for, but if it's for transferring module information, I use an OS specific handle to manipulate the clipboard 'mid-flight' before I paste it in. Helps when copying in things from PDFs.
For linux in particular this is xclip
It's not specifically clipboard contents but how FG fiddles with text you paste in I guess is what I mean. I wanted to tweak the CSV extension to support <tab> also instead of just comma divider. First thing I noticed was the contents of the text that FG pulled in from the clipboard stripped out <tab>. It also seems to do it when you paste the text in a stringU so it's probably a base function of taking input text.
It would certainly be useful for any input methods be it story, (formatted) or tables if we could keep it from being stripped out.
damned
January 9th, 2018, 01:04
tab is being stripped deliberately IIRC.
Might have to use something else like $, ~ or *.
celestian
January 9th, 2018, 01:13
tab is being stripped deliberately IIRC.
Might have to use something else like $, ~ or *.
Right now the only way I can get the tables from a PDF to work properly (other than hand creating) with a copy/paste is to export the "table" from the PDF as an excel document. To get it to CSV I have to then save that out again as a comma delimited file. However, if one could just select the cells within excel and control-c, excel uses <tab> for dividers. Less steps and also removes the problem of comma being in the text of the tables and causing issues.
Do you know why it's being stripped?
damned
January 9th, 2018, 01:38
Right now the only way I can get the tables from a PDF to work properly (other than hand creating) with a copy/paste is to export the "table" from the PDF as an excel document. To get it to CSV I have to then save that out again as a comma delimited file. However, if one could just select the cells within excel and control-c, excel uses <tab> for dividers. Less steps and also removes the problem of comma being in the text of the tables and causing issues.
Do you know why it's being stripped?
Honestly Im sure Ive read it somewhere but I cant recall what it was and I cant find it via search either...
The only things I can find tabs being used for are Navigation and ctrl+tab for creating additional columns in tables...
Moon Wizard
January 9th, 2018, 02:09
It’s deliberately stripped because the formatted text control does not support tab characters. It has no notion of indenting other than lists, so any unsupported characters are stripped to prevent problems in the display and editing for formatted text blocks.
There is a wish list item to support rich text paste, but there are no plans to implement in the current FG client. We have some ideas for FGU, but they are not on the first version hit list.
Regards,
JPG
celestian
January 9th, 2018, 02:22
It’s deliberately stripped because the formatted text control does not support tab characters. It has no notion of indenting other than lists, so any unsupported characters are stripped to prevent problems in the display and editing for formatted text blocks.
There is a wish list item to support rich text paste, but there are no plans to implement in the current FG client. We have some ideas for FGU, but they are not on the first version hit list.
Regards,
JPG
Understood. Not so much interested in "rich text" for pasting the tabs into formattedtext but to be able to get the text parse it up and put it into a "table" format that can be placed into formatted text or tables.
Understand the reason for leaving things as is. Thank you for the background.
Ken L
January 11th, 2018, 11:36
I kinda hope for some kind of RTF as I had an earlier clipboard editing script that allowed me to copy from a PDF to auto parse, and format it mid-flight before I pasted it into FG. It made certain text bold or italic, and others with headers or tables but FG escaped the xml tags. I can easily mod this script to produce RTF and get some use out of it.
celestian
January 11th, 2018, 16:54
I kinda hope for some kind of RTF as I had an earlier clipboard editing script that allowed me to copy from a PDF to auto parse, and format it mid-flight before I pasted it into FG. It made certain text bold or italic, and others with headers or tables but FG escaped the xml tags. I can easily mod this script to produce RTF and get some use out of it.
My wishful thinking is along those lines. Allowing us to copy/paste and drop in and retains formatting. Much like several MS products do now. Drag/drop images (and alignment!) would rock for more reasons than one (im looking at ref-manuals).
I'll have to wait for FGU for anything like that and hope they can do it someday ;)
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.