Jump to content

need a workflow for Focus app


Recommended Posts

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
 
Link to comment

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.

Link to comment

 

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'.

Link to comment

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.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...