Jump to content

Piping info to pbcopy works in terminal, not in "run script"


Recommended Posts

Hi there, I'm trying to make a workflow that does the following:

1. type in keyword

2. have alfred "Run Script" which looks like the following: "node ~/documents/scripts/javascript/haiku.js | pbcopy"

3. Have the output from the node process copy to the clipboard as it should.

 

This does not work, and I get an empty clipboard.

 

However if I do the same thing, but instead of "Run Script" I do "Terminal Command", it works just fine and I get the output from the node process copied to my clipboard.

 

Is this a limitation of the "run script" option?

 

Thanks. 

Link to comment

Hi there, I'm trying to make a workflow that does the following:

1. type in keyword

2. have alfred "Run Script" which looks like the following: "node ~/documents/scripts/javascript/haiku.js | pbcopy"

3. Have the output from the node process copy to the clipboard as it should.

 

This does not work, and I get an empty clipboard.

 

However if I do the same thing, but instead of "Run Script" I do "Terminal Command", it works just fine and I get the output from the node process copied to my clipboard.

 

Is this a limitation of the "run script" option?

 

Thanks. 

 

Not sure what the issue is right off but, why use pbcopy? Just have the script output the result and use the Copy to Clipboard output item to easily copy the output from the script to the clipboard.

Link to comment

Copy to Clipboard doesn't work either. I was using pbcopy because it was one less step, and was integrated into what I was already doing. 

 

There has to be something missing in the workflow or script then. I know you say it works at the terminal but, if your script is producing output, the Copy to Clipboard item should work.

Link to comment

There has to be something missing in the workflow or script then. I know you say it works at the terminal but, if your script is producing output, the Copy to Clipboard item should work.

I've made a short video covering the issue:

 

As you can see they each do the following:

1. Runs the script and tries to send it to copy to clipboard - fails doesn't copy anything (leaves old clipboard)

2. Runs in Terminal and tries to send it to copy to clipboard - fails doesn't copy anything (leaves old clipboard)

3. runs script with pbcopy - copies blank

4. runs in terminal with pbcopy - copies the output properly

Edited by WillsonSmith
Link to comment

I've made a short video covering the issue:

 

As you can see they each do the following:

1. Runs the script and tries to send it to copy to clipboard - fails doesn't copy anything (leaves old clipboard)

2. Runs in Terminal and tries to send it to copy to clipboard - fails doesn't copy anything (leaves old clipboard)

3. runs script with pbcopy - copies blank

4. runs in terminal with pbcopy - copies the output properly

 

 

Doh! While watching the video I realized what the issue more than likely is. Alfred doesn't import your profile and so therefore probably isn't finding and actually running the node executable. Try providing the full path to the node executable and let me know the outcome of that. I don't use node at all so I'm not aware of where it's installed by default, but, is the node app is installed in /usr/local/bin, then instead of the command being just 

node <path to file>

 

Specify the full path to it, such as:

/usr/local/bin/node <path to file>
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...