Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2118 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi everyone!

I have a text field, with each sentence separated by ¶ .

I would like to create buttons for each line in this field, so that I can copy each line individually (and paste manually in different application for example)

I assume that it's easy to do in calculation with GetValue, and make a script using Get (ScriptParameter) = line number in that field, for each button. ( I ll need only 7-10 lines max).

1. I can't figure out what script function I need to use to make a selective copy...

2. If one of the option is Set Selection function - how would it work in my case?

Thank you!

Posted

Hello

That's a tricky one, and I guess could be achieved in many different ways.

You could have a script with the Set Selection script step that calculates the start and end point and makes the selection. Then add a 'Copy' script step after that. So it's just a two line script.

Start Point

Let ( 
[ 

sentenceNo = Get ( ScriptParameter ) ; 

] 

; 

If ( sentenceNo = 1 ; 1 ; Position ( SentenceTest::myTextField ; "¶" ; 1 ; sentenceNo - 1 ) + 1 ) 

)

End Point

Let ( 

[ 

sentenceNo = Get ( ScriptParameter ) ; 

countOccurencesOfCarriageReturn = PatternCount ( SentenceTest::myTextField ; "¶" ) 

] 

; 

If ( sentenceNo > countOccurencesOfCarriageReturn ; Length ( SentenceTest::myTextField) ; Position ( SentenceTest::myTextField ; "¶" ; 1 ; sentenceNo ) - 1) 

)

Then call that script with the script parameter matching the sentence you are trying to select. You could have a number of buttons, each of which selects a sentence (1, 2, 3) etc. You could also put hide conditions on those buttons so it only shows the correct number of buttons.

Still works if an extra carriage return has been put on the end of the last sentence.

Enclosed a sample file for you to see it in action!

SentenceTest.fmp12

Posted

I'd do it this way*:

SentenceTest2.fmp12

Note also that plugins such as Base Elements let you set the clipboard contents directly.

---

(*) Assuming I'd want to do this at all - which I doubt. It seems these "sentences" should be individual records in a related table. 

Posted

Thank you very much, both solutions should work for me.

to comment;

I considered to make individual records for each sentence, but I thought there should be a way to avoid it...

Well, you showed the way!

Thanks again!

This topic is 2118 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 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.