Synopsis: An example of “round-tripping” data, this workflow copies the text from the selected OmniGraffle graphic to a new Drafts document, and processes the transfered text with a Drafts action that ends by replacing the text in the graphic with the processed text.
An exciting feature of the Drafts app on iOS, is its ability to create and run processing workflows with its documents.
By including the Drafts “action” URL parameter in the URL targeting the Drafts application, Omni Automation scripts can not only create new Drafts documents with content from OmniGraffle and OmniOutliner documents, but can also trigger the processing (in Drafts) of the passed content as well. And optionally, the results of the Drafts workflows can be returned to the originating OmniGraffle or OmniOutliner document!
OmniGraffle → Drafts
The following action is used to pass the text content of the selected OmniGraffle graphic to Drafts, and then trigger the execution of a Drafts action:
01-08 The action metadata. Edit the author and label tags to suit your purposes.
22-30 The action validation routine determines the document conditions under which the action becomes available in the Automation menu. In this case, if a single graphic containing text is selected.
10-20 The action code that gets executed when the action is triggered.
14 The text of the selected OmniGraffle graphic is percent encoded for inclusion in a URL created using the Draft URL API that targets the Drafts app.
15-16 The name of the Drafts action to be called is percent encoded for inclusion in a URL targeting the Drafts app.
17 The URL targeting the Drafts app with instructions to create a new document containing the passed text, and then run the indicated action.
18 The url string is converted into a URL object.
19 The URL is called.
Drafts → OmniGraffle
The Drafts action triggered by the URL in OmniGraffle action contains two steps:
A JavaScript script to capitalize the text in the current Drafts document
Execute the Drafts action described in the Draft to Selected Graphic section, that contains a JavaScript script step that incorporates an Omni Automation script URL to set the text content of the selected OmniGraffle graphic to the altered Drafts text passed into the Omni Automation script URL.
Video
The following video demonstrates how the technique shown in the example above, can be used to transfer text from an OmniGraffle graphic to a new Drafts document, process the transfered text with Drafts actions, and then replace the original text in the graphic with the processed text, and delete the created Drafts document:
UNDER CONSTRUCTION
This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.