II. Tutorial x-Callback: The secrete of auto functions for daunting tasks
-
Steffi -
May 24, 2017 at 7:01 PM -
6,659 Views -
0 Comments -
17 Minutes
In my first tutorial about x-callback I had lifted some of the secrete of it.
In this tutorial it will get more specific and your learn how to create:
- Documents in DTTG
- E-Mails in AirMail
- Task in 2Do
with x-callback and how you can save everything in Workflow.is.
Well, I have planned actually three tutorials but due to your demand to know more about this I have decided to go deeper into this and plan now five tutorials for x-callback.
You will have the possibility to get x-callback to know and how it will help you to improve your workflow on MAC and iOS. I will publish the tutorials step-by-step so that you will have time to "digest" the content before something new comes up.
What do you need for a start?
Actually you got more or less everything you need need for this tutorial. The tools are:
- a text editor
You can use DevonThinkProOffice as it can create pure text - Workflow.is (is the "old" name I know but will use it for my tutorials)
You can download this app in the AppStore from here.. - Your Ipad and Iphone
- Just in case you use a German keyboard:
Please turn off the auto correction feature or switch to the English layout. Otherwise the symbols and letters get distorted like "TEXT" will be displayed than as „TEXT“ and the. latter will cause issues.
Patience and eye to details
You will now go in the direction of programming and coding and therefore it is important that you will not get upset or angry if something does not work like you want it. But with time it will work - promised!
Keeping an eye to detail is vital because one space more or less makes the difference between success and failure of your code.
My personal tip
Personally, I use always the same pattern if something does not work immediately. Here are my tips for creating and correcting code for x-Callback:
- Text editor (does not matter which brand)
I really prefer the font family of Lucida with a big size. Why? Because with Lucida it is possible to have all letters and symbols neatly underneath and hick-ups can be seen much easier than with other fonts. Depending on the use I prefer a font size between 14 and 22 px. - Logic and appreciation
Such a computer works only because it will follow step-by-step some logic. Therefore, it is important to remember this while you are coding.For instant search for a text "My x-callback tutorial I"
A human will just type this in the search mask and press the button. The document will be shown.A computer needs some more information because it cannot understand text and the meaning at all - it will only work with 0-0--1-1-0 and need a route to get to the same result. The machine will search in the meta data first and then it will get an unique ID for this document before it will displays to the user.In short, a computer does only that he gets commanded and if something is wrong it does not do anything. You need to be aware of this fact.
Correcting and saving Code
- Correct code
I use always the same method: If something is does not work, I will devise my code form the beginning step-by-step ; once command after the other and test if the result is what I wanted. If you use this approach you can be sure, that your code will work once you are done. - Save your code
Under IOS is Workflow.is just super suitable for this. Yo can use your code using the share menu and also as a widget. Under MAC I use Typinator which will execute the code immediately after I have used the shortcut or one of the F-keys.
Special Characters (URL Encoding)
Before you will start coding it is important that you know that some special characters need an URL encoding (HTML) under ASCII which is then used in your x-callback URL:
- Spaces ␣ = %20
- colons : = %3A
- „Slash“ / = %2F
Other characters for code are:
- Et-Sign „&“ to connect functions with each other
- Question mark „?“ Will tell the computer, that a function needs to be executed
- Equal sign „=“ transfer the given value within to the function.
Luckily, you do not need always these codes if you like to execute your code in a browser for instance there is no need to join the spaces for instance.
More information you will find at Wikipedia.
Syntax
Will it get complicated now? The answer is NO !
Syntax evolved from the Greek and means order or sequence. One example of syntax is the grammar for any language. As computer will understand their language it can be seen as the sequence between commands and attributes. More information to this you can find here.
As mentioned before, the developer of the apps have opened a small door to execute x-callback; for this the correct sequence is needed.
There is not really standard for x-callback and I think it would not be good to have one. The reason is easy, there are several different software around with different function and different usages. Therefore, it makes sense to have a x-callback-URL exactly for each of the software available.
So, it will be as specific code for a specific software which will work under different operating systems. The code snippet will work under IOS and MAC exactly in the same way. For instance for 2Do you would only need one code snippet to apply under IOS and MAC.
DevonThinkProOffice and DTTG
Since the update 2.1.3 there is now an advanced x-callback function available with directly interacting with Workflow.is.
Syntax
The syntax for your code is:
x-devonthink:// commands ? Further attributes
- clip
to create a clip to DTTG - createbookmark
creates a bookmark with content - creategroup
creates a group - createhtml
creates a HTML file - createimage
creates an image - createtext
creates a pure text file - createwebarchive
creates a web archive - import-clipboard
import the current clipboard
In this tutorial I will use a text document only but you can always adjust and amend the code to your likings.
Attributes
It is important that a sequence of commands and attributes are applied as the developer of the app intended. Here are some of the attributes used for DTTG:
- title
The name of the document - Comment
A comment (Spotlight) - text
The content of the document.
Further attributes like destination, location, uti, source, content, input, uuid and all other I will show you in the Third Part of this series.
Knit you function
The assumption for my code shown are:
- Text document
createtext - Title
Mein erstes Dokument - Comment
Das ist fantastisch - Text
Hallo, ich wurde automatisch eingerichtet“.
In theory we would need to use the special characters now for spaces etcetera or need to show the attributes in " " .
For DevonThinkProOffice and DTTG we do need it
The function will look like this:
x-devonthink://createtext?title=Mein erstes Dokument&comment=Das ist fantastisch&text=Hallo, ich wurde automatisch eingerichtet
If you take the code line and paste it into your browser, the x-callback will be executed and the document gets created in the default database.
More information you can also find at DevonThinkProOffice Forum.
AirMail
Do you use AirMail? Then this function is for you and will help you to create emails automatically in text or HTML.
I will use HTML for this example but you can just amend the function.
Syntax
airmail://Command?Attribute
airmail://compose?subject=subject&from=from&to=to&cc=cc&bcc=bcc&plainBody=plainBody&htmlBody=htmlBody
Commands
- subject
subject line of email - from
If you have more than one account - to, cc, bcc
sure - clear - plainBody
to create plain text - htmlBody
to create HMTL
Attributes
There are not any for AirMail
Knit your Function
For this eample I will use the following attributes and create a HTML email:
- Subject
This is an email automatically created using x-callback - E-Mail-Account
I assume you got only one - Receipients
info@steffiscloud.de - as HMTL
Hello Steffi, it works fantastic!
Also for AirMail there is no need for special characters:-)
The function looks like this:
airmail://compose?subject=This is an email automatically created using x-callback&to=info@steffiscloud.de&htmlBody= Hello Steffi, it works fantastic!
More information you will find directly at AirMail website..
2Do
The task manager, which I really like to use, has loads of commands and attributes but I will use "only" the add command for this tutorial.
All further commands and attributes will be brought to you in tutorial 3 of this article series.
Syntax
Warning - do not get scared This is the syntax for 2 do to create task, projects and check lists:
twodo://x-callback-url/add?task=prompt:Text&type=prompt-num:Task Type&forlist=prompt:List Name&forParentName=prompt:Parent Task Name&forParentTask=prompt:Parent Task's Unique Identifier¬e=prompt:Notes&priority=prompt-num:Priority&starred=prompt-num:Is Starred&tags=prompt:Tags&locations=prompt:Locations&due=prompt:Due Date&dueTime=prompt:Due Time&start=prompt:Start Date&repeat=prompt-num:Repeat&action=prompt:Task Action&picture=prompt:Picture&ignoreDefaults=prompt-num:Ignore Due Date Defaults&saveInClipboard=prompt-num:Save UID in clipboard&useQuickEntry=prompt-num:OS X Only, will present Quick Entry Window
Wow that is what I call a function! But I will reduce it for you and show you now step-by-step how to implement it:
twodo://x-callback-url/add?Task=Attribute
The command „add“ is only one of several commands which can be used!
Command
- Add
Adding projects, task and check lists
Attributes
- Task
The title of the task, check list or project - Type
Defines the type as follow:
0-Task (default), 1-Project and 2-check list - forlist
Defines in which list or account the task should be added and if you use more than one. In this case just enter the name of your list. For this tutorial I assume you got only one and use this as default. - forParentName
If you have already a project or check list? Then the new task will be created under the project automatically. Just enter the name of the project/check list. - note
A note for a task - priority
The priority of your task
0-none, 1-low, 2-medium, 3-high - starred
You can use stars to mark certain task as favourites. - tags
Your tags or create new ones. - due
due date in the format YYYY-MM-DD - duetime
due time in format HH:MM - start
start date and time for your task in the format YYYY-MM-DD SPACE HH:MM - useQuickEntry
If you set this to "1" then the quick entry menu will be displayed and you can check if your task has been created correctly and save it then. If you are certain that you x-callback-URL works properly then just skip this attribute and your task will be saved automatically in 2Do.
Just to mention is that if I refer to"task" it can also be applied to projects and checklists. All other attributes and much more commands I will explain in my Third part of my article series in full.
You are able to:
create a task, project or check list with a note attached and include priority, tags as well as start and due dates / times automatically. Further you are now able to create a task under a project / checklist with all attributes needed.
Knit your function
The attributes used for my example are:
- Create a task („0“)
- Title
Newsletter Steffi’s Cloud - Note
I like to sign up to Steffis newsletter which will be published on Saturday. Very Important! My reference is: http://www.steffiscloud.de - priority high (3)
- tags
Steffis Cloud - due on
Friday, 26 May 2017 (2017-05-26) - due time at
(18:00) - you can also use 6 pm - Start date and -time
Thursday, 25 May 2017 at 18 oclock (6pm) (2017-05-25 SPACE 18:00) - Before it gets save display a dialog (1)
The function looks like this now:
twodo://x-callback-url/add?task=Newsletter Steffi’s Cloud&type=0&WCF_AMPERSAND¬e=I like to sign up to Steffis newsletter which will be published on Saturday. Very Important! My reference is: http://www.steffiscloud.de&priority=3&tags=Steffis Cloud&due=2017-05-26&duetime=18:00&start=2017-05-25 18:00&useQuickEntry=1
Of course I would be very happy if you would save this task
Alternative you can sign up to my newsletter here.
More information and references you will find at 2Do directly.
Have a breather now
Wow, that was pretty much and I think have tea or coffee now and just try the URLs on your MAC and make some changes to your code.
How does Steffi work with this functions?
Now you take a rest, I will give you a small inside how I use the functions and apps for my blog.
Personally, I use all software and apps which I use in my articles in my own workflow. For my blog I have got also a "self-knitted" database which is pretty new and Ulysses for my writings.
First I tell you that DevonThinkProOffice is great to write in mark down and then Ulysses? The reason is simple, DTPO is my DMS - for my documents and references and Ulysses is specialised for people who write a lot and I am able to just upload my finished article directly to the server. But both "talk" to each other using x-Callback.
Database? You got DTPO and DTTG!
It the similar why I use BusyCal and additionally 2Do; the first is a calender the latter a to-do and project software and both have their own purpose and gets synchronised using CaldDav.
My database is used to give a structure and links to all my other programs and I use it as a Planner and it gives me directions what and how content will be published or planed. All the ideas from my readers and I will get saved in this database and later be used for projects, help articles and so on.
If I get an idea from my readers or have one it will be put to the database. At the same time, the database wil create a folder with subfolders in DTPO/DTTG under the heading "Ideas". Additionally, the unique ID of that folder gets returned to the database as a link.
After this, a project in 2Do with my "working title" will be created without having any due dates.
For all my research I use DevonAgent with DTPO together. All documents are stored there.
Everything what comes to my mind without having a document gets into my database. If I feel that certain task for an idea needs to be in place, I create a task in my database which will then create a sub task in 2Do under my project.
Writing an article
My research documents can be searched from Ulysses directly and link it within my article using x-callback, which works under MAC and IOS.
The next step is the planning which will be entered in my database with all data needed such as due dates, planned and publish date , actual publishing date and so on. All data gets then converted into 2Do and the project calculates now the due dates and I will get reminded. As for DTPO the current folder with all content will be shuffled to my "Planned" section automatically.
This goes on until the article is published but also after this date.
Can I use a database too?
Sure you can and my tip is:
I use Ninox which I just discovered for my planning and integration of data in 2Do, AirMail and DTTG / DTPO.
Yeah, there is always something to nag about new software - and I am just human too - but I was able to adapt my workflow within my own cloud for Ninox with several tools, so that I will sync'ed between MAC and IOS even thought I has not got any WebDav!
Ninox gets developed in Berlin - yes, the Capital of Germany - and the support is just awesome as the entire software is!
The advantages in comparison to other apps are:
- Version for Mac and IOS!
- Create your databases with ease and I really mean with ease as there is no need to be a database guru at all
- Simply use drag-and-drop to create a database
- Links, websites and save images and other files are just easily to implement without having to look after ID similarities
- Ninox got there support site and you will find tons of tips and tricks how to implement your database on Ipad, Iphone and MAC. There is also a manual available.
- There is a free Iphone version available and if you think that similar software will cost a fortune than roughly EUR 40 are not too much at all. Think of the money you could save if you will have your own database? Address book gone , invoice software gone, project software gone - spreadsheet gone and so on....
So, if you need an easy-to-do database tool than Ninox is your choice and you do not need to be an expert in database development at all. I can recommend Ninox fully.
Tea and coffee finished? Then we can carry on with:
Connection with Workflow.is
Time back you would have to pay for Workflow.is - I had too do But since Workflow.is belongs to Apple it is free now.
It is an app for automation of recurring tasks and got many useful functions. Only one of it is that you can use x-callback-URL which I will use for my tutorial.
If you like more to know about Workflow.is you can go to their web site.
Workflow.is got a directly a x-callback-function implemented with result, error messages and so on. But for now I will stick with the "normal" URL feature to execute our x-callback-code.
Simple usage
for your code of:
- DevonThinkProOffice
x-devonthink://createtext?title=Mein erstes Dokument&comment=Das ist fantastisch&text=Hallo, ich wurde automatisch eingerichtet - AirMail
airmail://compose?subject=This is an email automatically created using x-callback&to=info@steffiscloud.de&htmlBody= Hello Steffi, it works fantastic! - 2Do
twodo://x-callback-url/add?task=Newsletter Steffi’s Cloud&type=0&WCF_AMPERSAND¬e=I like to sign up to Steffis newsletter which will be published on Saturday. Very Important! My reference is: http://www.steffiscloud.de&priority=3&tags=Steffis Cloud&due=2017-05-26&duetime=18:00&start=2017-05-25 18:00&useQuickEntry=1
and how you can now use a widget or implement it in the share menu under IOS.
Just go on the Plus sign on the left window and search for URL now drag it to the right site of the window.
URL you will paste or wirte your x-callback code:
After that we need to tell the Ipad that it should execute this code. Just search "Open URLs" and drag it to the right site.
Additional settings can be made using the Gear symbol.
Advanced Usage
Well, lovely! To be honest with you I think it is stupid to use always the same data - do not you?
That's why I will show you the function to use variables within Workflow.is:
I will use the same example like before but now with proper user input for title, text and comments.
You will need the additional function:
- Ask for Input and
- Add to Variable.
a) for the title let it be variable „var1“
b) for comment let it be „var2“ and
c) for text „var3“
The narrative for the question you can choose what ever you like.
As for your code: Use now the variables var1 through var 3 for any text after the equal sign and fill them in.
Try to add other variables for your other both x-callback-URLs and you will see that it is much more effective than before.
In AirMail you can use user defined action and send an email as text to Workflow.is and there you can create a formatted text and send it further to DevonThink with your x-Callback-URL.
Also you can use "Save File" command in Workflow.is to save it directly into DTTG as it supports now saving location. Use iCloud and then choose DTTG to save your files.
Furfer resources for DTTG and Workflow.is you can find using the links below:
- Take or choose a image/picture and send it to DTTG
- Search within DTTG and let you show the results either in DTTG direclty or in Workflow.is
Take a minute or two and visit the developers in Berlin with their easy to use database Ninox.db and you will see how easy it is to have your own database. In the worst case - just let me know and I will help you.
In my next tutorial you will
also discover further functions and that you can do with x-callback AND what x-callback can do for you to improve your productivity. If you like feel free to share my article or forward it to your friends.
I hope you will have loads of fun and success with creating your x-Callback function in your own cloud!
Comments
Newly created comments need to be manually approved before publication, other users cannot see this comment until it has been approved.
Newly created comments need to be manually approved before publication, other users cannot see this comment until it has been approved.