Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Python Question
-
First, remove both prefix/suffix actions, you don't need those to turn the email addresses into a list. Then you can simply use:
emails = workflow.get_input().splitlines()
It would also be possible to keep the prefix/suffix actions and use
emails = eval('[' + workflow.get_input() + ']')
(which interprets the text as Python list syntax) , but that's a more fragile approach, and I wouldn't recommend it. -
Ole,
That totally worked! Thanks so much!
Dan
-
One more question. Is it possible to use the workflow.set_variable() action to set more than one variable in a single script? If so, how would I call those variables in my workflow?
Thanks again!
-
Yes, that's possible, but due to the way the variable picker works, variables have to be "declared" in order to be usable in the rest of the workflow. Basically, you need to have a Set Variable action for every variable you want to use outside of a script (it can just set an empty value that you change later via Python).
If you really want, you can actually delete the Set Variable action after inserting it where you want.
-
Nice. I'll give that a run.
-
Here's what I came up with:
http://www.editorial-workflows.com/workflow/5320493146046464/V8Ii1guwpB8
It's saying that emails-one is not defined. I'm assuming my syntax is off in the set-variable statement?
Thanks!
-
You have to put the variable name in quotation marks:
#... workflow.set_variable('emails_one', str(emails[0:3]))
-
Btw, if you want the contents of the variable to be one email address per line (like the input), use
'\n'.join(emails[0:3])
instead ofstr(...)
. -
One email per line isn't necessary. I'm heading to bed now. I'll give it another run in the morning. Thanks so much Ole!
-
Finished it up. Workflow is here. Thanks so much for your help on this Ole!