Created
February 12, 2015 05:13
-
-
Save petrowsky/2089f07e7a49a53e8fee to your computer and use it in GitHub Desktop.
PythonWrapText Custom Function - FileMaker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* PythonWrapText ( text ; columns ; prefix ) | |
* | |
* A bBox plugin function for wrapping text. | |
* http://www.beezwax.net/download/bbox | |
* | |
*/ | |
Let ( [ | |
~script = List ( | |
"import textwrap" ; | |
"list = textwrap.wrap(content, width=" & columns & ")" ; | |
"for element in list:" ; | |
" print '" & prefix & "' + element" | |
); | |
~compiled = bBox_PythonCompile( 0 ; ~script ); | |
~data = bBox_PythonSetVar( "content" ; text ; "s" ); | |
~result = bBox_PythonExecute( ~script ); | |
~hasError = ~result = "?" | |
]; | |
Case ( | |
Evaluate ( "bBox_Version( \"\" )" ) = "?"; | |
"bBox plug-in missing"; | |
~hasError; | |
bBox_PythonFinalize & "Error"; | |
~result | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment