Hello. I am making a tool which allows a user to assign a specific bullet point from a block of text. I have written a script which does this perfectly using FMP and FM Go but it does not work properly with web direct. When using web direct the script will only pull the last bullet point regardless of where the user touches in the field. I would appreciate any help you can offer!
Thank you for your time.
The script:
#Triggers On Field Enter (Delay to gather touch position)
Pause/Resume Script [Duration (seconds): .1 ]
#Counts how many bullets are in the text
Set Variable [$Bullets; Value ; PatternCount ( Get (ActiveFieldContents): "-")]
If [$Bullets <> "0"]
#Where the user touched into the field
Set Variable [$Cursor; Get ( ActiveSelectionStart )]
Loop
#Loop count is tracked to compare to number of bullets
Set Variable [$LoopCount; Value: ($LoopCount + 1)]
#This is the step this compares the cursor position and the bullet points to see where the user touched. this progresses through for each bullet point in the text
If [ Let (
[ $Point = Position ( Get ( ActiveFieldContents ) ; "-" ; 1 ; $LoopCount ) ;
$Point2 = Position ( Get ( ActiveFieldContents ) ; "-" ; 1 ; ( $LoopCount + 1 ) )]
;
If (( $Cursor > $Point and $Cursor < $point2 ) or ( $Cursor > $Point and $Point2 = "0" ) ;
1 ; 0 ) )
#This text length value is set in case the user touches on the last bullet point and $Point2 ends up being 0
Set Variable [$Text; Value: (Length ( Get ( ActiveFieldContents)) + 1)]
#This step sets the actual text as a variable to be inserted in the comment box
Set Variable [$Language; If ( ( $Point > $Point2 ) ;
Middle ( Get ( ActiveFieldContents ); $Point ; ( $Text - $Point )) ;
Middle ( Get ( ActiveFieldContents ); $Point ; ( $Point2 - ( $Point + 1 )) ))
End If
Exit Loop If [$LoopCount = $Bullets]
End Loop
# $$Aspect is set when the user navigates to the layout where the block of text resides. $$Aspect is the name of the comment box where the $Language needs to end up
Go to Object [Object Name: $$Aspect]
Set Field [ Case ( Length ( Get ( ActiveFieldContents ) ) = "0" ; $Language ;
Length ( Get ( ActiveFieldContents ) ) <> "0" ; Get ( ActiveFieldContents ) & ¶ & $Language ;
Get (ActiveFieldContents) )
Else
# This is hear as there are some fields that do not have bullet points but the block of text in the field stay as a whole.
Set Variable [$Language; Value: Get ( ActiveFieldContents)]
Go to Object [Object Name: $$Aspect]
Set Field [ Case ( Length ( Get ( ActiveFieldContents ) ) = "0" ; $Language ;
Length ( Get ( ActiveFieldContents ) ) <> "0" ; Get ( ActiveFieldContents ) & ¶ & $Language ;
Get (ActiveFieldContents) )
End If
I would check that the number of ifs equals the number of end ifs.