{"__v":4,"_id":"575818008abb520e00ea7b70","category":{"project":"55f0432035803d230000a9c2","version":"575818008abb520e00ea7b61","_id":"57584d29f71f5c19002d17ef","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-06-08T16:51:53.330Z","from_sync":false,"order":6,"slug":"actions-and-automations","title":"Actions and Automations"},"parentDoc":null,"project":"55f0432035803d230000a9c2","user":"55f0431435803d230000a9c1","version":{"__v":11,"_id":"575818008abb520e00ea7b61","project":"55f0432035803d230000a9c2","createdAt":"2016-06-08T13:05:04.736Z","releaseDate":"2016-06-08T13:05:04.736Z","categories":["575818008abb520e00ea7b62","575818008abb520e00ea7b63","575818008abb520e00ea7b64","575818008abb520e00ea7b65","57582f278abb520e00ea7c10","575838ddf71f5c19002d1787","57584357163a4f2b002c75ed","57584d29f71f5c19002d17ef","575850cc163a4f2b002c7621","575850f1f71f5c19002d17fa","575851066a65ec0e004153e7","575a923ad5797e0e007518cf","575eae598be8aa0e00f59ceb","575eb065e7089c0e006d0cdf"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-20T09:06:54.428Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"After using Quadro for a while, you will notice that the more you use it, the more you want to use it for.\n\nBut for as many new features that we are adding to the software, there will be something out of reach.  Thanks to the `Launch script` action, you can now extend what Quadro is able to do... by A LOT.\n\nCurrently Quadro supports **URL schemes** and **AppleScript** on Mac, and **VBScript** on Windows.\n\n**AppleScript** and **VBScript** are lightweight programming languages, which allow you to access elements of the system and applications environment in which it is running. What’s great about these simple but powerful languages is that they are very easy to learn, and can run other scripts too.\n\nFor instance, one could run a simple JavaScript that would click an item on a web page​ or execute command line scripts to interact with the system at a lower level.\n\nLet’s see a few examples of how the `Launch script` feature works inside Quadro.\n\n### Accepting Parameters\nScripts are part of the “smart\" category with an additional property: when they have the correct “wrapper”, they are able to recognize and use multiple parameters in the script to be launched.\nLet’s say that our script creates a new reminder with a Title and Body and puts it in a specific list.\nThese are our parameters for the script, which have to be fed to the script from the previous action.\n\nFor instance, if I have a `Set Text` action (that just defines a text and then passes to the next one) with [apple banana blue], followed by a script action, the script action could be launched with the 3 words interpreted as different parameters for the script, `apple`, `banana` and `blue`.\n\nOn the contrary, if I wanted to pass a single parameter, I would just add quotes to let the interpreter know that it is a single parameter. So, in the aforementioned example, I would have to have set it as `“apple banana blue\"`\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/JOweeXPxSPSKZ4ZDT8vw_parameters%20syntax.jpg\",\n        \"parameters syntax.jpg\",\n        \"2704\",\n        \"488\",\n        \"#0c6cd4\",\n        \"\"\n      ],\n      \"caption\": \"[Launch script] parameters syntax\"\n    }\n  ]\n}\n[/block]\n### Returning values \nNow we know how to give parameters to the script, but if the script we are launching returns something, this something will be passed to the next action. To do what? Well, it depends on the script, the next action, and the workflow. But I’ll be glad to give you a couple examples if you ask. 😃\n\n## Useful combinations\nIf you are fluent with scripting or you are about to become fluent, you might be able to figure out these combos for yourself, but let’s give you a headstart:\n\n### Selecting from lists \nAmong the text actions you can find our [Pick from list].\nThis simply prompts the user to select a specific item from a list.\n\nSo, if I have a list of items in a `Pick from list`, it provides the item I will select (from the list) to the script immediately after. Cool and useful, but let’s take a look at it from a different angle.\n\nWithout script actions, the list to pick from have to be specified when creating the action, and could only be changed by editing the action. Working with scripts differently, the `Pick from list` becomes much more interesting.\n \nExactly as I just explained, you can pass several parameters to a scripting action, a similar mechanism applies to the `Pick from list`. The only difference is that the `Pick from list` detects multiple items when separated by a comma, like so: `apple, banana, blue`.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/gJSy76sFQAStfthiDxQc_Artboard%201.jpg\",\n        \"Artboard 1.jpg\",\n        \"2704\",\n        \"488\",\n        \"#0c6cd4\",\n        \"\"\n      ],\n      \"caption\": \"[Pick from list] parameters syntax\"\n    }\n  ]\n}\n[/block]\nThis means that I can have a script which returns a list of, say, notes included in the current Evernote notebook, feed said list in the `Pick from list`, and have that list dynamically populated each time the action is launched. Nice.\n \n### Querying the user \nSometimes the string or value we want to act upon changes every time, and can’t be deduced automatically. For instance, when creating a new reminder.\n \nVeterans know that you could ask this from the script, but system dialogs are not as sexy as our query strip. 😉  \n[block:image]\n{\n  \"images\": [\n    {\n      \"caption\": \"Query strip\",\n      \"image\": [\n        \"https://files.readme.io/HWV9LsZ7Q7uZarvibSq4_query%20strip.jpg\",\n        \"query strip.jpg\",\n        \"2880\",\n        \"336\",\n        \"#8b4153\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nTo use the query strip to require data from the user dynamically, just use the handler `Ask me` found in the extended keyboard provided when editing a field in any text action.\nFind more infos about the `Ask Me` mode [here](http://support.quadro.me/docs/text-actions#section-text-input-modes)\n\n### Script to script \nSince we’ve seen that the `Launch script` action can get data in input and provide data as output, you can combine different scripting actions inside your macro. But why not just have everything in a single script? In a word: modularity.\n\nIf you have single, mono-function scripts, you can easily recombine them and adapt them to several cases.","excerpt":"Launch URL Schemes, AppleScript (Mac), VBScript (Windows)","slug":"scripting-actions","type":"basic","title":"Scripting"}

Scripting

Launch URL Schemes, AppleScript (Mac), VBScript (Windows)

After using Quadro for a while, you will notice that the more you use it, the more you want to use it for. But for as many new features that we are adding to the software, there will be something out of reach. Thanks to the `Launch script` action, you can now extend what Quadro is able to do... by A LOT. Currently Quadro supports **URL schemes** and **AppleScript** on Mac, and **VBScript** on Windows. **AppleScript** and **VBScript** are lightweight programming languages, which allow you to access elements of the system and applications environment in which it is running. What’s great about these simple but powerful languages is that they are very easy to learn, and can run other scripts too. For instance, one could run a simple JavaScript that would click an item on a web page​ or execute command line scripts to interact with the system at a lower level. Let’s see a few examples of how the `Launch script` feature works inside Quadro. ### Accepting Parameters Scripts are part of the “smart" category with an additional property: when they have the correct “wrapper”, they are able to recognize and use multiple parameters in the script to be launched. Let’s say that our script creates a new reminder with a Title and Body and puts it in a specific list. These are our parameters for the script, which have to be fed to the script from the previous action. For instance, if I have a `Set Text` action (that just defines a text and then passes to the next one) with [apple banana blue], followed by a script action, the script action could be launched with the 3 words interpreted as different parameters for the script, `apple`, `banana` and `blue`. On the contrary, if I wanted to pass a single parameter, I would just add quotes to let the interpreter know that it is a single parameter. So, in the aforementioned example, I would have to have set it as `“apple banana blue"` [block:image] { "images": [ { "image": [ "https://files.readme.io/JOweeXPxSPSKZ4ZDT8vw_parameters%20syntax.jpg", "parameters syntax.jpg", "2704", "488", "#0c6cd4", "" ], "caption": "[Launch script] parameters syntax" } ] } [/block] ### Returning values Now we know how to give parameters to the script, but if the script we are launching returns something, this something will be passed to the next action. To do what? Well, it depends on the script, the next action, and the workflow. But I’ll be glad to give you a couple examples if you ask. 😃 ## Useful combinations If you are fluent with scripting or you are about to become fluent, you might be able to figure out these combos for yourself, but let’s give you a headstart: ### Selecting from lists Among the text actions you can find our [Pick from list]. This simply prompts the user to select a specific item from a list. So, if I have a list of items in a `Pick from list`, it provides the item I will select (from the list) to the script immediately after. Cool and useful, but let’s take a look at it from a different angle. Without script actions, the list to pick from have to be specified when creating the action, and could only be changed by editing the action. Working with scripts differently, the `Pick from list` becomes much more interesting. Exactly as I just explained, you can pass several parameters to a scripting action, a similar mechanism applies to the `Pick from list`. The only difference is that the `Pick from list` detects multiple items when separated by a comma, like so: `apple, banana, blue`. [block:image] { "images": [ { "image": [ "https://files.readme.io/gJSy76sFQAStfthiDxQc_Artboard%201.jpg", "Artboard 1.jpg", "2704", "488", "#0c6cd4", "" ], "caption": "[Pick from list] parameters syntax" } ] } [/block] This means that I can have a script which returns a list of, say, notes included in the current Evernote notebook, feed said list in the `Pick from list`, and have that list dynamically populated each time the action is launched. Nice. ### Querying the user Sometimes the string or value we want to act upon changes every time, and can’t be deduced automatically. For instance, when creating a new reminder. Veterans know that you could ask this from the script, but system dialogs are not as sexy as our query strip. 😉 [block:image] { "images": [ { "caption": "Query strip", "image": [ "https://files.readme.io/HWV9LsZ7Q7uZarvibSq4_query%20strip.jpg", "query strip.jpg", "2880", "336", "#8b4153", "" ] } ] } [/block] To use the query strip to require data from the user dynamically, just use the handler `Ask me` found in the extended keyboard provided when editing a field in any text action. Find more infos about the `Ask Me` mode [here](http://support.quadro.me/docs/text-actions#section-text-input-modes) ### Script to script Since we’ve seen that the `Launch script` action can get data in input and provide data as output, you can combine different scripting actions inside your macro. But why not just have everything in a single script? In a word: modularity. If you have single, mono-function scripts, you can easily recombine them and adapt them to several cases.