Automator: How to use the "Select from list" action?

I am trying to create a Service using Automator that just calls textutil convert. In the end, I want to be able to right-click the docx file and convert to text, rtf, html, etc. After I right-clicked, I need a very simple pop-up window asking for the desired format.

I see the "Select from list" action. He has no options. Somewhere I had the idea to make a tab "Select from the list" to get the given text. Then I tried putting my list of values ​​in Get Specified Text. However, when I run it, I get only one line. I tried one item per line, with comma delimiters, space delimiters, and even with curly braces separated by commas. Nothing works.

How do I get a selection dialog to show all my options? Also, is there a way to limit the selection to one element?

Thanks!

automator screenshotresult

+6
source share
5 answers

Here is the solution to select only one row in the list.

Delete (" Get specified text " and " Select from list ").

Add the Run AppleScript script action. 1- Cut the text in action. 2- Copy / paste this text into the action.

on run choose from list {"TXT", "RTF", "RTFD", "HTML"} with prompt "Please make your selection" without multiple selections allowed and empty selection allowed return the result as string end run 
+9
source

1) Delete the Get the specified text action.

2) Add the Run AppleScript "action on the Select from list action.

3) In the " Run AppleScript " action, cut the text and copy / paste this text.

 on run {} set theList to {"TXT", "RTF", "RTFD", "HTML"} return theList end 
+2
source

The trick is to use the AppleScript variable!

The other suggested answers work, but the easiest and easiest way is to use the AppleScript variable to determine which list to select.

A text variable can only store one element of plain text, but an AppleScript variable can be structured as an array, which is exactly what you need to define a list.

enter image description here

  • In Variables, in the Utilities section, drag AppleScript into the workflow for the Select from List action.

  • Change the parameters of the variable and define its Script as an array of text strings containing the list of options you need.

+1
source

You need to break the text into a list of elements, which means Select from the list as input. You can use the Paragraph Filter action to break text, for example, return paragraphs that are not empty.

You do not specify which OS you are using, but Lion added the ability to use Rich Text in text actions - unfortunately, most actions do not work properly if they really get Rich Text. In Lion, you can take advantage of some (hidden) coercion of input elements using something like the Run Shell Script action (you don't need to enter anything there, just use the default, which passes the elements) to convert Rich Text from the Get Text action.

The Select from list action has the All or No buttons, but there is no way to select a specific set of elements. It's easy enough to write Automator actions, so migrating your own textutil shell is another option.

0
source

There are also two Automator actions that will also solve this problem.

One Split Text , which allows you to select a specific separator to split text.

Another Get text words , which allows you to simply get individual words of text passed as input.

If you do not have these actions, you can get them from here:

https://itunes.apple.com/us/app/text-automator-actions-pack/id448838274?mt=12

0
source

Source: https://habr.com/ru/post/920259/


All Articles