You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you begin to have many tasks in Tyme2, the workflow starts to load tasks for ~2-3 seconds. I've tried to improve the AppleScript used to list the tasks, and ended up making a new implementation using JXA. I don't have the time for a PR, so I'm just dropping the code here for anyone who want an instant loading of tasks!
var query = "{query}".toLowerCase();
var tyme = Application('Tyme2');
var xml = "<?xml version='1.0'?><items>"
if ("stop".includes(query)) {
xml += "<item arg='stop' uid='stop' autocomplete='stop' active='YES'><title>Stop</title><subtitle>Stop running task</subtitle></item>"
}
var allProjectNames = tyme.projects.name();
var allTasksNames = tyme.projects.tasks.name();
nbProjects = allProjectNames.length;
for (var i = 0; i < nbProjects; i++) {
nbTasks = allTasksNames[i].length
tasksOfThisProject = allTasksNames[i];
for (var j = 0; j < tasksOfThisProject.length; j++) {
projectName = allProjectNames[i];
taskName = tasksOfThisProject[j];
if (projectName.toLowerCase().includes(query) || taskName.toLowerCase().includes(query)) {
xml += "<item arg='" + projectName + "|_|" + taskName + "' uid='" + projectName + ": " + taskName + "' autocomplete='" + projectName + ": " + taskName + "'><title>" + projectName + ": " + taskName + "</title></item>";
}
}
}
xml += "</items>"
Just replace current AS code with this JXA code (in Script Filter block), and change language to osascript (JS).
Hope someone will find this useful! 😉
The text was updated successfully, but these errors were encountered:
Hi!
First, thanks a lot for this workflow!
When you begin to have many tasks in Tyme2, the workflow starts to load tasks for ~2-3 seconds. I've tried to improve the AppleScript used to list the tasks, and ended up making a new implementation using JXA. I don't have the time for a PR, so I'm just dropping the code here for anyone who want an instant loading of tasks!
Just replace current AS code with this JXA code (in Script Filter block), and change language to osascript (JS).
Hope someone will find this useful! 😉
The text was updated successfully, but these errors were encountered: