Jump to content

Help with running a script


Recommended Posts

 

Hey,

 

I’m trying to have control Focus.app from Alfred. I found some scripts that should work on the developper’s GitHub.

I just don’t know how to write them in Alfred nor in the Terminal.

 

Here’s the script:

#!/bin/bash
open focus://focus

And here’s my Workflow so far.

 
Thanks for the help!

 

 

Create a keyword trigger (or hotkey trigger, or whatever you prefer), then create a run script action with 'open focus://focus' in the script box (don't enter the quotes in the box). Oh, and connect the trigger to the run script action.

Edited by ctwise
Link to comment

Actually, that is exactly what I got, but nothing’s happening. I also tried to run the line in the Terminal, but I don’t know how I need to type in to make it works…

 

Create a text file and save the contents in it. Make it executable from the command line with 'chmod +x <scriptname>'. Run it from the command line './<scriptname>'

Link to comment

Hum :/ Not proud of myself here, and I feal kinda dumb, but even after reading a little bit more from what you told me, I have seriously no idea what I’m doing…!

 

Here is my file script.sh

#!/bin/bash
open focus://focus

And here is me trying to run it from terminal, and failling!

Jolins-iMac:~ jolinm$ chmod +x /Users/jolinm/Desktop/script.sh 
Jolins-iMac:~ jolinm$ /Users/jolinm/Desktop/script.sh 
The file /Users/jolinm/focus:/focus does not exist.
Jolins-iMac:~ jolinm$ .//Users/jolinm/Desktop/script.sh 
-bash: .//Users/jolinm/Desktop/script.sh: No such file or directory
Jolins-iMac:~ jolinm$ /Users/jolinm/Desktop 
-bash: /Users/jolinm/Desktop: is a directory
Jolins-iMac:~ jolinm$ ./script.sh
-bash: ./script.sh: No such file or directory
Jolins-iMac:~ jolinm$ chmod +x script
chmod: script: No such file or directory
Jolins-iMac:~ jolinm$ chmod +x script.sh
chmod: script.sh: No such file or directory
Jolins-iMac:~ jolinm$ /Users/jolinm/Desktop/script.sh 
The file /Users/jolinm/focus:/focus does not exist.
Link to comment

 

Hum :/ Not proud of myself here, and I feal kinda dumb, but even after reading a little bit more from what you told me, I have seriously no idea what I’m doing…!

 

Here is my file script.sh

#!/bin/bash
open focus://focus

And here is me trying to run it from terminal, and failling!

Jolins-iMac:~ jolinm$ chmod +x /Users/jolinm/Desktop/script.sh 
Jolins-iMac:~ jolinm$ /Users/jolinm/Desktop/script.sh 
The file /Users/jolinm/focus:/focus does not exist.
Jolins-iMac:~ jolinm$ .//Users/jolinm/Desktop/script.sh 
-bash: .//Users/jolinm/Desktop/script.sh: No such file or directory
Jolins-iMac:~ jolinm$ /Users/jolinm/Desktop 
-bash: /Users/jolinm/Desktop: is a directory
Jolins-iMac:~ jolinm$ ./script.sh
-bash: ./script.sh: No such file or directory
Jolins-iMac:~ jolinm$ chmod +x script
chmod: script: No such file or directory
Jolins-iMac:~ jolinm$ chmod +x script.sh
chmod: script.sh: No such file or directory
Jolins-iMac:~ jolinm$ /Users/jolinm/Desktop/script.sh 
The file /Users/jolinm/focus:/focus does not exist.

 

 

You got it right, the script isn't working due to a problem with Focus, not with your script. You'll have to take it up with the Focus developer.

Link to comment

Basically, the problem is that the URI scheme isn't registered or registered correctly, and so the terminal is treating the string like a file and this not finding it.

 

This might be a stupid question, but have you opened the app once? The URI scheme can be registered only once the app is opened, but then it should be good to go after that.

 

If you have, then it's definitely the developer's error implementing the URI scheme.

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