omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    Return ticket from Editorial to TextTool back to Editorial

    Editorial
    2
    5
    3053
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • tguillemin
      tguillemin last edited by

      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](link url)

      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

      1 Reply Last reply Reply Quote 0
      • Cethric
        Cethric last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • tguillemin
          tguillemin last edited by

          @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...

          1 Reply Last reply Reply Quote 0
          • Cethric
            Cethric last edited by

            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)
            
            1 Reply Last reply Reply Quote 0
            • tguillemin
              tguillemin last edited by

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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB Forums | Contributors