Dr. Evil Posted August 26, 2010 Posted August 26, 2010 HELLO! Can you format selected text using a script? For example I have a field called [note], I would like user to be able to type in the field and have the options to format selected text to... - bold - italic - color change - larger/smaller font size I would have buttons by field for user to call on. Any help or suggestions? THANKS!!!!
Fitch Posted August 27, 2010 Posted August 27, 2010 Yes, check this out: Style buttons - Custom and extended formatting functionality on demand
comment Posted August 27, 2010 Posted August 27, 2010 See also: http://fmforums.com/forum/showtopic.php?tid/198604/post/305425/#305425
Dr. Evil Posted August 27, 2010 Author Posted August 27, 2010 Fitch; Thanks for the link, good source! Comment; Thank you for the code! I got it to work... almost. The script changes the ALL the text to red vrs only the SELECTED text. I think the issue is in the [insert Calculated Result (TextColor ( Middle ( Get ( ActiveFieldContents ) ; Get ( ActiveSelectionStart ) ; Get ( ActiveSelectionSize ) ) ; RGB ( 240 ; 0 ; 0 ) ) ] Have I missed something?
comment Posted August 27, 2010 Posted August 27, 2010 Make sure the option "Select entire contents" is unchecked.
Dr. Evil Posted August 27, 2010 Author Posted August 27, 2010 Yep, unchecked... still no go. I'm sure it is something simple I have missed like this tho. Humm.
Dr. Evil Posted August 27, 2010 Author Posted August 27, 2010 It works as a simple button, but I can not get it to work in the script. I have attached a file to show problem, the script is a mess! Any help to clean up would be greatly appreciated. Thank you so much for your help. text_formatter.fp7.zip
Lee Smith Posted August 27, 2010 Posted August 27, 2010 (edited) Deselect the Option to Select Field Contents in the script step Insert Calculated Result Edited August 27, 2010 by Guest
comment Posted August 27, 2010 Posted August 27, 2010 Make sure the option "Select entire contents" is unchecked. Yep, unchecked... Check again.
Dr. Evil Posted August 27, 2010 Author Posted August 27, 2010 Oops, I checked the field behavior, not the script option, sorry. By the way, anyone know how I can TextFormatRemove in the script?
comment Posted August 28, 2010 Posted August 28, 2010 The problem with using TextFormatRemove() in this manner is that when you insert plain text into a field, it inherits the formatting of the text being overwritten (which sort of makes sense). This was discussed previously here: http://fmforums.com/forum/showtopic.php?tid/173852/
Recommended Posts
This topic is 5202 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now