Forum Archive

Return ticket from Editorial to TextTool back to Editorial

tguillemin

I need the Sentence case, which Editorial’s « Change Case » action does not provide.

I have found the TT case workflow,

http://www.editorial-workflows.com/workflow/5851991188176896/qJ3ArZ9Ctmk

which works perfectly, except that it leaves the text inside TextTool, where I must fetch it manually.

I must admit that the effort is not big, but I wish I could automate the journey back in my original document (Gradus.txt in Dropbox, no subfolder).

To be frank, I do not grok the x-callbackurl specification…

How must I proceed ?

Thanks in advance

Cethric

Just an idea but creating a new work flow which gets the current selection of text and then in Python running `str.capitalize over the selectection.

tguillemin

@Cethric said:

str.capitalize

I must admit I do not know Python.

How am I supposed to insert str.capitalize in the "Run Python Script" action ?

Sorry for being a nuisance...

Cethric

Don't worry about it @tguillemin
This probably could be a lot more efficient however this is a simple example.

#coding: utf-8
import workflow
import editor
import os

action_in = workflow.get_input()

#TODO: Generate the output...
action_out = action_in

path = editor.get_path()
p, file_name = os.path.split(path)
doc_drop = os.path.split(p)[1]
data = editor.get_file_contents(file_name, doc_drop).split(". ")
print data
print [x.capitalize() for x in data]
editor.set_file_contents(file_name, ". ".join([x.capitalize() for x in data]), doc_drop)
editor.reload_files()

workflow.set_output(action_out)
tguillemin

Thank you very much. It works as expected.
Have a nice day and thanks again