1
0
Fork 0
mirror of https://github.com/marty-oehme/scripts.git synced 2024-11-14 05:48:08 +00:00

+ script: add-multiple-tags/add-multiple-tags.qml

This commit is contained in:
Flashwalker 2018-04-27 21:49:15 +03:00
parent ac5a0dc485
commit 509dda73ae
2 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,35 @@
import QtQml 2.0
/**
* This script creates a menu item and a button with which you can add space separated tags to the current note
*/
QtObject {
/**
* Initializes the custom action
*/
function init() {
// create the menu entry
script.registerCustomAction("addMultipleTags", "Add Multiple tags", "fav", "bookmark-new");
}
/**
* This function is invoked when a custom action is triggered
* in the menu or via button
*
* @param identifier string the identifier defined in registerCustomAction
*/
function customActionInvoked(identifier) {
switch (identifier) {
// add tags to the current note
case "addMultipleTags":
var tags = script.inputDialogGetText("Add tags", "Enter tags separated by space", "");
script.log(tags);
var tagsList = tags.split(' ');
var i;
for (i = 0; i < tagsList.length; i++) {
script.tagCurrentNote(tagsList[i]);
}
break;
}
}
}

View file

@ -0,0 +1,10 @@
{
"name": "Add Multiple tags",
"identifier": "add-multiple-tags",
"script": "add-multiple-tags.qml",
"authors": ["@Flashwalker"],
"platforms": ["linux", "macos", "windows"],
"version": "0.0.1",
"minAppVersion": "17.06.2",
"description" : "This script creates a menu item and a button with which you can add space separated tags to the current note."
}