Text box parameter for script tools

553
3
05-20-2022 04:44 PM
Status: Open
Labels (1)
DavidSolari
Occasional Contributor III

Add a parameter type for script tools that behaves identically to the "String" parameter, but the control is a text box that supports tabs, line breaks etc. The formatting within the text box would be carried over to the parameter value. A filter on the parameter to let the user choose syntax highlighting options (Python, text, HTML etc.) and line number display would be nice but not required.

This idea came from a recent project where I wanted the user to enter arbitrary Python code into a parameter. I currently have to hack together a solution with a multivalue String parameter and convert the values into a single item. This leads to a poor UX and many formatting limitations. A Text Box input type would be a perfect fix for this as well as other script tool workflows that require large volumes of structured text from the user (large text field entries, injecting HTML formatting into fields, feeding custom query expressions into third-party web services etc.).

Tags (1)
3 Comments
RichardHowe

This is a great idea. Perfect example here is the box you get to fill in Summary and Tags when you share a web layer.

RichardHowe_0-1661515581443.png

 

I've written a a script to take metadata from a user and apply it to what they're exporting, but I would like the Summary and Description inputs to be a wider text box (like those shown above - so a user can see everything they've written and input hard case returns) rather than just the single line input box that a String input gives me. I can't currently see a way to do it unless I'm missing something

DavidSolari

I noticed this in the new parameter controls document:

To support a parameter that accepts a multiline block of text, use a controlCLSID value  of {E5456E51-0C41-4797-9EE4-5269820C6F0E}.

Does this mean text boxes that pass multiline string data are implemented in 3.1? I don't have 3.1 to test but at a glance it seems like this was silently implemented. If so this is an easy "Already Implemented" idea for whichever community manager stumbles across this, wink wink.

RichardHowe

@DavidSolari 

Great spot. I can confirm this works!!!!

Large String Entry Box.png