The iOS Workflow app

The Workflow app for iOS is a powerful tool for creating and placing very useful workflows at your finger tip. And because of Workflow’s modular design and standards support, it integrates perfectly with Omni Automation script links. In the following example, the contact information from a chosen entry in the iOS Contacts database, is passed to an Omni Automation script that uses that data to construct a business letter addressing the chosen person.

Business Letter to Chosen Contact

In the following workflow, the user is prompted to select a person  1  from their iOS Contacts database. Using Workflow’s “magic variables”  3  the data from the chosen contact is matched to the keys you provide  2  resulting in a JSON object resembling something like this:

{"FIRSTNAME":"Trudy","LASTNAME":"Anchover", "ADDRESS":"123 Elm Street\nSan Francisco, CA 12345","PREFIX":"Ms."}

The resulting JSON object is then percent encoded  4  and stored in a new variable  5  named: encodedData  6 

Business Letter Workflow

In the next workflow step, an encoded version of the Omni Automation script (shown below) is entered as the value for the URL action  7  Note that the first line of the script contains a text placeholder (XXXXX) that will be replaced with JSON data generated by the workflow.

To replace the text placeholder in the encoded Omni Automation script, the parameters of the Replace Text action  8  are set to find the text placeholder in the script link text passed from the previous action, and replace it with the encoded contents of the variable: encodedData  9 

The combined Omni Automation script link is then passed to the Open URLs action  10  that executes the script, causing a the business letter to be created using the passed person data from the contact record.

personData = XXXXX prefix = personData.PREFIX firstName = personData.FIRSTNAME lastName = personData.LASTNAME address = personData.ADDRESS pageWidth = 612 pageHeight = 792 marginLeft = 72 marginRight = 72 marginTop = 144 marginBottom = 72 cnvs = document.windows[0].selection.canvas cnvs.size = new Size(pageWidth,pageHeight) cnvs.canvasSizingMode = CanvasSizingMode.Fixed document.windows[0].zoom = .75 document.windows[0].centerVisiblePoint = cnvs.background.geometry.center textBodyRect = new Rect(marginLeft,marginTop,pageWidth-marginLeft-marginRight,pageHeight-marginTop-marginBottom) textShape = cnvs.addShape('Rectangle',textBodyRect) textShape.shadowColor = null textShape.strokeColor = null textShape.fillColor = null textShape.text = "<%Date%>\n\n" + firstName + " " + lastName + "\n" + address + "\n\nDear " + prefix + " " + lastName + ":\n\nLetterBody\n\nSincerely,\n\n\n\n\nSal Soghoian, Nyhthawk Productions\n12345 Automation St.\nSan Francisco, CA 12345\n\n\n\n\nEnclosures: 0" textShape.textSize = 12 textShape.fontName = "TimesNewRomanPSMT" textShape.textHorizontalPadding = 0 textShape.textVerticalPadding = 0 textShape.autosizing = TextAutosizing.Clip textShape.textHorizontalAlignment = HorizontalTextAlignment.Left textShape.textVerticalPlacement = VerticalTextPlacement.Top textShape.textHorizontalPadding = 0 textShape.textVerticalPadding = 0 document.windows[0].selection.view.edit(textShape)
personData = XXXXX prefix = personData.PREFIX firstName = personData.FIRSTNAME lastName = personData.LASTNAME address = personData.ADDRESS pageWidth = 612 pageHeight = 792 marginLeft = 72 marginRight = 72 marginTop = 144 marginBottom = 72 cnvs = document.windows[0].selection.canvas cnvs.canvasSizingMode = CanvasSizingMode.Fixed cnvs.size = new Size(pageWidth,pageHeight) document.windows[0].zoom = 1.0 document.windows[0].centerVisiblePoint = cnvs.background.geometry.center textBodyRect = new Rect(marginLeft,marginTop,pageWidth-marginLeft-marginRight,pageHeight-marginTop-marginBottom) textShape = cnvs.addShape('Rectangle',textBodyRect) textShape.shadowColor = null textShape.strokeColor = null textShape.fillColor = null textShape.text = "<%Date%>\n\n" + firstName + " " + lastName + "\n" + address + "\n\nDear " + prefix + " " + lastName + ":\n\nLetterBody\n\nSincerely,\n\n\n\n\nOtto Automator, Automated Productions\n12345 Automation St.\nSan Francisco, CA 12345\n\n\n\n\nEnclosures: 0" textShape.textSize = 12 textShape.fontName = "TimesNewRomanPSMT" textShape.textHorizontalPadding = 0 textShape.textVerticalPadding = 0 textShape.autosizing = TextAutosizing.Clip textShape.textHorizontalAlignment = HorizontalTextAlignment.Left textShape.textVerticalPlacement = VerticalTextPlacement.Top textShape.textHorizontalPadding = 0 textShape.textVerticalPadding = 0 document.windows[0].selection.view.edit(textShape)
omnigraffle://localhost/omnijs-run?script=personData%20%3D%20XXXXX%0Aprefix%20%3D%20personData%2EPREFIX%0AfirstName%20%3D%20personData%2EFIRSTNAME%0AlastName%20%3D%20personData%2ELASTNAME%0Aaddress%20%3D%20personData%2EADDRESS%0ApageWidth%20%3D%20612%0ApageHeight%20%3D%20792%0AmarginLeft%20%3D%2072%0AmarginRight%20%3D%2072%0AmarginTop%20%3D%20144%0AmarginBottom%20%3D%2072%0Acnvs%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%0Acnvs%2EcanvasSizingMode%20%3D%20CanvasSizingMode%2EFixed%0Acnvs%2Esize%20%3D%20new%20Size%28pageWidth%2CpageHeight%29%0Adocument%2Ewindows%5B0%5D%2Ezoom%20%3D%201%2E0%0Adocument%2Ewindows%5B0%5D%2EcenterVisiblePoint%20%3D%20cnvs%2Ebackground%2Egeometry%2Ecenter%0AtextBodyRect%20%3D%20new%20Rect%28marginLeft%2CmarginTop%2CpageWidth%2DmarginLeft%2DmarginRight%2CpageHeight%2DmarginTop%2DmarginBottom%29%0AtextShape%20%3D%20cnvs%2EaddShape%28%27Rectangle%27%2CtextBodyRect%29%0AtextShape%2EshadowColor%20%3D%20null%0AtextShape%2EstrokeColor%20%3D%20null%0AtextShape%2EfillColor%20%3D%20null%0AtextShape%2Etext%20%3D%20%22%3C%25Date%25%3E%5Cn%5Cn%22%20%2B%20firstName%20%2B%20%22%20%22%20%2B%20lastName%20%2B%20%22%5Cn%22%20%2B%20address%20%2B%20%22%5Cn%5CnDear%20%22%20%2B%20prefix%20%2B%20%22%20%22%20%2B%20%20lastName%20%2B%20%22%3A%5Cn%5CnLetterBody%5Cn%5CnSincerely%2C%5Cn%5Cn%5Cn%5Cn%5CnOtto%20Automator%2C%20Automated%20Productions%5Cn12345%20Automation%20St%2E%5CnSan%20Francisco%2C%20CA%2012345%5Cn%5Cn%5Cn%5Cn%5CnEnclosures%3A%200%22%0AtextShape%2EtextSize%20%3D%2012%0AtextShape%2EfontName%20%3D%20%22TimesNewRomanPSMT%22%0AtextShape%2EtextHorizontalPadding%20%3D%200%0AtextShape%2EtextVerticalPadding%20%3D%200%0AtextShape%2Eautosizing%20%3D%20TextAutosizing%2EClip%0AtextShape%2EtextHorizontalAlignment%20%3D%20HorizontalTextAlignment%2ELeft%0AtextShape%2EtextVerticalPlacement%20%3D%20VerticalTextPlacement%2ETop%0AtextShape%2EtextHorizontalPadding%20%3D%200%0AtextShape%2EtextVerticalPadding%20%3D%200%0Adocument%2Ewindows%5B0%5D%2Eselection%2Eview%2Eedit%28textShape%29

Here’s a movie demonstrating the “business letter workflow” involving OmniGraffle, Workflow, and the Drafts app on iOS:

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.

DISCLAIMER