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.


    Is it possible to 'close' a file (preferably through a workflow/script)?

    Editorial
    2
    3
    2656
    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.
    • edgauthier
      edgauthier last edited by

      I have a python action to move a file from the local library to the dropbox library. It uses editor.set_file_contents() to create the copy in Dropbox, and then os.remove() to delete the local file, followed by editor.reload_files() to update the library.

      Everything seems to work (ie the file is moved as expected), but a file with that name/contents is open in the editor. If anything changes with this file, it's written back to its original location as a new copy. Is there any way to clear the editor contents or close the file?

      The only workaround I can think of is to have a scratch file that I open after the above steps to discard the current contents, but I was wondering if there was something cleaner.

      Thanks,
      Ed

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

        You can use an Open URL action and the Editorial URL scheme to open the new version of the file:

        editorial://open/yourfilename?root=dropbox

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

          Thanks - I was going to do something like that initially, but after moving the file, I wanted to be 'done' with that file if it make any sense?

          Right now, I'm going to try and write up something that just opens the next file in the directory, and if there are no more files, then just an empty file.

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