File Editor

by Dude Dudeson

Version 1 (December 19, 2017)

Download (15 downloads)

General-purpose text file editor.

I built this flow based on a question/suggestion from Gabriel Tobing and his HTML Website Creator

This flow should remember the last file you edited by storing it as an atomic variable "working_file."

NOTE: This flow should be able to handle any UTF-8 encoded text file, but I built a hook to catch files named "htm" (just used a "contains" funtion for string "\.htm" in the file name. Smarter people than I can probably build other hooks.) and handle them differently.

On start, the flow checks to see if "working_file" exists. If it does, it will prompt you to resume editing that file or load/create a new one. If the user elects to resume, the flow will check that the file exists. If it does, the file will be loaded into an input dialog for editing. If it does NOT exist, you will be prompted to create it, or select a different file using a "Pick file" block.

If "working_file" isn't set (either the flow wasn't ever run before, or the flow was modified), it will prompt to select or create a file using a "File pick" block. It will then load the existing file into the input dialog for editing or present a blank one.

Once you're done editing and select "OK," the file will be saved. Then, a couple of things can happen:

1) If the file name contains the string".htm," the flow will load the file into a web dialog so you can preview it. Once you are done with the preview, clicking "OK" will save the file, and reload the new version into an input dialog for further editing. Clicking "Cancel" WILL NOT SAVE, but will reload the input dialog to enable further editing.

2) Other files will be loaded back into the input dialog for futher editing.

SHORT STORY: "OK" saves - "Cancel" does not.