omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. whyzee
    3. Posts

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by whyzee

    • Can I rename the current file using a workflow?

      Hi. I'm completely loving Editorial 1.1. And I'm having fun experimenting with workflows. But I'm not such a savvy python coder... Here is a particular workflow I'm struggling with:

      What I'd like to do is rename the current file (stored in dropbox) with an additional prefix. For instance, if the current dropbox file is named "my-document.txt", I'd like to change it to "archive-my-document.txt". Is this possible? To rename the current document?...

      I'm thinking I'd use os.rename(src,dst) but I'm not sure what to plug in for the current filename. Do I want the entire path name or just relative to the root dropbox folder? Would I use editor.get_path() or os.path.basename(editor.get_path()) or the "Get Current File Name" action? None of this seems to work so far.

      Can anyone help me figure out the code (or actions) necessary to get the correct filename in order to rename it?

      Thanks!

      posted in Editorial
      whyzee
      whyzee
    • RE: Can I rename the current file using a workflow?

      Oh. Cool. That didn't occur to me. Thanks. Plus, I see there are actually actions for "get file contents" and "set file contents". I don't have my iPad with me right now but I think this could work:

      (Action) Get current file name -> Set variable

      (Action) Get file contents -> Set variable

      (Action) Set file contents (with new file name)

      (Action) Open new file

      (Python) Delete old file

      Thanks for the feedback.

      posted in Editorial
      whyzee
      whyzee