Marcoen Posted January 5, 2015 Posted January 5, 2015 I'm using a small todo app called Focus. What I need is a workflow to make a new todo without opening the app. I'm using a modified workflow (I modified it from the new calender event) but that opens the app. To continue working I would like a workflow that does not open the app but makes a new entry in the background like what happens when I use the Evernote workflow. Can anyone help me with a script to do that. The script I use now looks like this: set newAppt to "{query}" as string tell application "Focus" to activate tell application "System Events" keystroke "n" using {command down} keystroke newAppt keystroke return end tell
RodgerWW Posted January 5, 2015 Posted January 5, 2015 Hmm, the key here is the "activate" command in applescript. This will always bring the window up front. Some apps allow for sending functions to them through and Applescript API ... like Messages for instance: tell application "Messages" set theBuddy to buddy "someone@mac.com" of service "iMessage" send "Hi there" to theBuddy end tell Basically, this means that Messages has an applescript library of functions that can be used in scripting. I am not at all familiar with "Focus" but perhaps it has an applescript library [also known as a dictionary]? If not, the only other thing I can think of is adding a line to the applescript you have to Hide or minimize the app after the entry is added.
ctwise Posted January 5, 2015 Posted January 5, 2015 I'm using a small todo app called Focus. What I need is a workflow to make a new todo without opening the app. I'm using a modified workflow (I modified it from the new calender event) but that opens the app. To continue working I would like a workflow that does not open the app but makes a new entry in the background like what happens when I use the Evernote workflow. Can anyone help me with a script to do that. The script I use now looks like this: set newAppt to "{query}" as string tell application "Focus" to activate tell application "System Events" keystroke "n" using {command down} keystroke newAppt keystroke return end tell Luckily, it's trivial, just attach a keyword to the Open URL action with the URL 'focus://toggle'.
Marcoen Posted January 5, 2015 Author Posted January 5, 2015 Thanks for the answer ctwise but I'm not sure I understand that. Where do I attach this keyword? There's no URL in this workflow.
ctwise Posted January 6, 2015 Posted January 6, 2015 Thanks for the answer ctwise but I'm not sure I understand that. Where do I attach this keyword? There's no URL in this workflow. Create a new workflow. Add a keyword input. Use whatever keyword you like, e.g., 'focus'. Give it a title, e.g., 'Toggle Focus'. Add an Open URL action. Use the URL 'focus://toggle'. Connect the input to the action. You're done. Now when you invoke Alfred, entering the keyword will toggle Focus.
Marcoen Posted January 7, 2015 Author Posted January 7, 2015 Sorry ctwise, won't work. (or am I doing it wrong?)
ctwise Posted January 7, 2015 Posted January 7, 2015 Are we talking about the same app? https://heyfocus.com
Marcoen Posted January 8, 2015 Author Posted January 8, 2015 No. http://www.focusapp.io It's a todo list, combined with a pomodor timer.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now