Editorial Workflows

LinkReferenceFilePublic

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: LinkReferenceFile
This workflow links two files together via a sequence reference number. While editing your main file select a word and then call the Workflow LinkReferenceFilePublic. The Workflow will create a reference file for you, open it, and prompt you to input some text. (You can opt to enter the text into the reference file later.) Then it will return to the original file you were editing and add the link. Touching the links in either file will open the linked file. The next number for linking is stored in lastLinkReferenceFileNumber.txt file in your Dropbox account. (If the file doesn't exist the Workflow will create it for you). The linking reference number starts with 'z' with an appended number (i.e. z1, z2, z3, etc.) You can set a starting number in the lastLinkReferenceFileNumber.txt by simply editing the file and changing the number. (I prefer to start with 1000. Therefore my reference numbers are z1000, z1001, etc.) The reference files all start with 'z' so as to sort them at the end of the file list in your current directory. [This Workflow was based on Create Zettel Workflow.]

Shared by: daveterry

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Python script: get directory ?
Source Code
#coding: utf-8
import editor
import os
import sys
import workflow
import time


db_path_identifier = 'Library/Application Support/Dropbox'

path = str(editor.get_path())
if db_path_identifier in path:
	location = '?root=dropbox'
	path = path.split(db_path_identifier, 1)[1]
else:
	location = ''
	path = path.split('/Documents/', 1)[1]

dir = os.path.split(path)[0]

action_out = dir
workflow.set_output(action_out)
Set Variable ?
Variable Name
targetDirectory
Value
Input
Get Bookmark URL ?
Include Selected Range
OFF
Set Variable ?
Variable Name
doconeurl
Value
Input
Get Bookmark URL ?
Include Selected Range
ON
Set Variable ?
Variable Name
ReturnToDoc
Value
Input
Selected Text ?
Entire Line(s)
OFF
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
Set Variable ?
Variable Name
LinkedWord
Value
Input
Get File Contents ?
File Name
lastLinkReferenceFileNumber.txt
In Dropbox
ON
If File Does Not Exist
  • Empty Output
  • Stop Workflow
Math ?
Expression
Input+1
On Error
  • Stop Workflow
  • Output "ERROR"
Result
  • Pass to Next Action
  • Store in Variable:
Set File Contents ?
File Name
lastLinkReferenceFileNumber.txt
In Dropbox
ON
New Text
Input
If File Does Not Exist
  • Create
  • Stop Workflow
Generate Text ?
Text
Input
Show HUD ?
HUD Text
Reference number: Input
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Set Variable ?
Variable Name
LinkID
Value
zInput
Set Variable ?
Variable Name
filename
Value
LinkID.md
Set Variable ?
Variable Name
PathFilename
Value
targetDirectory/filename
Set Variable ?
Variable Name
path
Value
PathFilename
Set File Contents ?
File Name
%var:path
In Dropbox
ON
New Text
Place Text Here
If File Does Not Exist
  • Create
  • Stop Workflow
Open Document ?
File Name
%var:path
In Dropbox
ON
Get Bookmark URL ?
Include Selected Range
OFF
Set Variable ?
Variable Name
targetDoc
Value
Input
Extend Selection ?
Direction
  • Backward
  • Forward
  • Both
Unit
  • Start/End of Document
  • Start/End of Line
  • Number of Characters...
1
Request Text Input ?
Title
Addtional text to insert
Initial Text
  • Single Line
  • Multiple Lines
Keyboard Options:
Replace Selected Text ?
Replacement Text
[LinkID](doconeurl&command=FindLinkedLoc&input=LinkID) Input
Open URL ?
Open in
  • In-App Browser
  • Default App / Safari
URL
ReturnToDoc
Tab
  • Last-used Tab
  • New Tab
  • Tab with ID:
Unique identifier
Wait until Loaded
OFF
Reveal Browser Automatically
ON
Show HUD ?
HUD Text
Returning to: ReturnToDoc
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Replace Selected Text ?
Replacement Text
LinkedWord [LinkID](targetDoc)