×

QR Codes

(wikipedia) A QR code (abbreviated from Quick Response code) is a type of matrix barcode (or two-dimensional barcode) first designed in 1994 for the automotive industry in Japan.

QR codes have become ubiquitous and are used to quickly transfer information, such as URLs or locations, to mobile devices through their on-device cameras. The ability to recognize and respond to QR codes is a standard feature of Apple mobile devices running the iOS operating system.

Since a fundamental feature of Omni Automation is its integrated support for executing its scripts encoded as URLs, you can turn your scripts into links and then use those links to create QR codes. When the camera of an Apple device with OmniFocus installed is pointed at the Omni Automation QR code, the user will be prompted for approval to import the URL and to run the encoded script!

Example

The following OmniFocus script will create a repeating task to remind you to check for new plug-ins from the OmniFocus Plug-Ins Collection page.

omnifocus://localhost/omnijs-run?script=try%7Bvar%20task%20%3D%20new%20Task%28%22Plug%2DIns%20Check%22%29%0Atask%2Enote%20%3D%20%22https%3A%2F%2Fwww%2Eomni%2Dautomation%2Ecom%2Fomnifocus%2Factions%2Ehtml%22%0Avar%20formatter%20%3D%20Formatter%2EDate%2EwithStyle%28Formatter%2EDate%2EStyle%2EShort%29%0Avar%20dateObj%20%3D%20formatter%2EdateFromString%28%27tuesday%20%40%2010%3A30AM%27%29%0Atask%2EdueDate%20%3D%20dateObj%0Avar%20ruleString%20%3D%20%22FREQ%3DWEEKLY%22%0Atask%2ErepetitionRule%20%3D%20new%20Task%2ERepetitionRule%28ruleString%2C%20Task%2ERepetitionMethod%2EDueDate%29%0Avar%20taskID%20%3D%20task%2Eid%2EprimaryKey%0AURL%2EfromString%28%22omnifocus%3A%2F%2F%2Ftask%2F%22%20%2B%20taskID%29%2Eopen%28%29%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D
New Repeating Reminder Task
 

task = new Task("Plug-Ins Check") task.note = "https://www.omni-automation.com/omnifocus/actions.html" formatter = Formatter.Date.withStyle(Formatter.Date.Style.Short) dateObj = formatter.dateFromString('tuesday @ 10:30AM') task.dueDate = dateObj ruleString = "FREQ=WEEKLY" task.repetitionRule = new Task.RepetitionRule(ruleString, Task.RepetitionMethod.DueDate) taskID = task.id.primaryKey URL.fromString("omnifocus:///task/" + taskID).open()

Here is the script encoded into an Omni Automation script URL:

Script URL


omnifocus://localhost/omnijs-run?script=try%7Bvar%20task%20%3D%20new%20Task%28%22Plug%2DIns%20Check%22%29%0Atask%2Enote%20%3D%20%22https%3A%2F%2Fwww%2Eomni%2Dautomation%2Ecom%2Fomnifocus%2Factions%2Ehtml%22%0Avar%20formatter%20%3D%20Formatter%2EDate%2EwithStyle%28Formatter%2EDate%2EStyle%2EShort%29%0Avar%20dateObj%20%3D%20formatter%2EdateFromString%28%27tuesday%20%40%2010%3A30AM%27%29%0Atask%2EdueDate%20%3D%20dateObj%0Avar%20ruleString%20%3D%20%22FREQ%3DWEEKLY%22%0Atask%2ErepetitionRule%20%3D%20new%20Task%2ERepetitionRule%28ruleString%2C%20Task%2ERepetitionMethod%2EDueDate%29%0Avar%20taskID%20%3D%20task%2Eid%2EprimaryKey%0AURL%2EfromString%28%22omnifocus%3A%2F%2F%2Ftask%2F%22%20%2B%20taskID%29%2Eopen%28%29%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D

And here is the QR code image for the encoded OmniFocus script. If your Apple mobile device has OmniFocus installed, open the Apple Camera app and point your iPhone or iPod Touch camera at the QR code

(scan or click this qr code)

qr-code-with-icon

(magnify code)

Create Your Own OmniFocus QR Codes!

To assist you in creating QR codes, the encoding routine for turning your scripts into Omni Automation script URLs is built into in this webpage and connected to the form below. Paste your short OmniFocus script into the field and click the Encode Script button and the script will be replaced with the encoded URL. To try out the script URL, click the Run Script button and the encoded script will be executed.

IMPORTANT: Scripts to be encoded for QR code images should be short. Scripts under 12 lines of code seem to work best!

New Single-Event Example


task = new Task("EVENT TITLE") task.note = "https://EVENT-URL" fmatr = Formatter.Date.withStyle(Formatter.Date.Style.Short) dateObj = fmatr.dateFromString('June 16, 2024 @ 10:00am PST') task.dueDate = dateObj task.addNotification(-86400) task.addNotification(-3600) URL.fromString("omnifocus://task/" + task.id.primaryKey).open()

TIP: In the example script, replace the date string with the desired date info. Be sure to remove any space before am or pm!


Create QR Code

Once you have converted your OmniFocus script into a script link, copy the encoded script URL and visit the QR Code Monkey website to generate and download your OmniFocus QR Code image.

qr-code-monkey

DISCLAIMER: Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. OMNI-AUTOMATION.COM assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. OMNI-AUTOMATION.COM provides this only as a convenience to our users. OMNI-AUTOMATION.COM has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and OMNI-AUTOMATION.COM assumes no responsibility in this regard. Please understand that a third-party site is independent from OMNI-AUTOMATION.COM and that OMNI-AUTOMATION.COM has no control over the content on that website. Please contact the vendor for additional information.

Other Examples…

Here’s an example created using the techniques described above. The QR code generates a repeating action that reminds you to check for new content on Learn OmniFocus:

(scan or click this qr code)

omnifocus://localhost/omnijs-run?script=var%20task%20%3D%20new%20Task%28%22Check%20for%20new%20Learn%20OmniFocus%20content%22%29%0Atask%2Enote%20%3D%20%22https%3A%2F%2Flearnomnifocus%2Ecom%2Ftutorials%2F%22%0Avar%20formatter%20%3D%20Formatter%2EDate%2EwithStyle%28Formatter%2EDate%2EStyle%2EShort%29%0Avar%20dateObj%20%3D%20formatter%2EdateFromString%28%27today%20%40%203AM%27%29%0Atask%2EdeferDate%20%3D%20dateObj%0Avar%20ruleString%20%3D%20%22FREQ%3DWEEKLY%22%0Atask%2ErepetitionRule%20%3D%20new%20Task%2ERepetitionRule%28ruleString%2C%20Task%2ERepetitionMethod%2EDeferUntilDate%29%0Avar%20taskID%20%3D%20task%2Eid%2EprimaryKey%0AURL%2EfromString%28%22omnifocus%3A%2F%2F%2Ftask%2F%22%20%2B%20taskID%29%2Eopen%28%29
qr-code-learn-omnifocus-blog

Here’s a QR Code that will add a new tag for each of the states of the United States (50 tags):

omnifocus://localhost/omnijs-run?script=try%7Bvar%20stateNames%20%3D%20%5B%22Alabama%22%2C%20%22Alaska%22%2C%20%22Arizona%22%2C%20%22Arkansas%22%2C%20%22California%22%2C%20%22Colorado%22%2C%20%22Connecticut%22%2C%20%22Delaware%22%2C%20%22Florida%22%2C%20%22Georgia%22%2C%20%22Hawaii%22%2C%20%22Idaho%22%2C%20%22Illinois%22%2C%20%22Indiana%22%2C%20%22Iowa%22%2C%20%22Kansas%22%2C%20%22Kentucky%22%2C%20%22Louisiana%22%2C%20%22Maine%22%2C%20%22Maryland%22%2C%20%22Massachusetts%22%2C%20%22Michigan%22%2C%20%22Minnesota%22%2C%20%22Mississippi%22%2C%20%22Missouri%22%2C%20%22Montana%22%2C%20%22Nebraska%22%2C%20%22Nevada%22%2C%20%22New%20Hampshire%22%2C%20%22New%20Jersey%22%2C%20%22New%20Mexico%22%2C%20%22New%20York%22%2C%20%22North%20Carolina%22%2C%20%22North%20Dakota%22%2C%20%22Ohio%22%2C%20%22Oklahoma%22%2C%20%22Oregon%22%2C%20%22Pennsylvania%22%2C%20%22Rhode%20Island%22%2C%20%22South%20Carolina%22%2C%20%22South%20Dakota%22%2C%20%22Tennessee%22%2C%20%22Texas%22%2C%20%22Utah%22%2C%20%22Vermont%22%2C%20%22Virginia%22%2C%20%22Washington%22%2C%20%22West%20Virginia%22%2C%20%22Wisconsin%22%2C%20%22Wyoming%22%5D%0A%0AstateNames%2EforEach%28stateName%20%3D%3E%20%7B%0A%09var%20result%20%3D%20flattenedTags%2Efilter%28%28tag%29%20%3D%3E%20tag%2Ename%20%3D%3D%3D%20stateName%29%5B0%5D%0A%09if%28%21result%29%7Bnew%20Tag%28stateName%29%7D%0A%7D%29%0A%0Adocument%2Ewindows%5B0%5D%2Eperspective%20%3D%20Perspective%2EBuiltIn%2ETags%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D
Add State Tags
 

var stateNames = ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"] stateNames.forEach(stateName => { var result = flattenedTags.byName(stateName) if(!result){new Tag(stateName)} }) document.windows[0].perspective = Perspective.BuiltIn.Tags

(scan or click this qr code)

qr-code-learn-omnifocus-blog