Jump to content

My Ruby Alfred Workflow Loop Stops after "exec"


Recommended Posts

Hello,

 

I'm trying to create a workflow that does image processing to selected images in Finder. For some reason, when the script runs, it would stop executing after the first "exec" is called (e.g. when I call the "convert" command).

 

Here's what my Alfred workflow looks like: http://goo.gl/45BiWd

 

and here's what my Ruby script looks like: http://goo.gl/Fo7ssF

 

I'm sorry. I have spent many hours trying to figure out why it stops after the first image is processed (resized and alpha removed).

 

Does anyone know what the cause could be?

Link to comment
  • 3 weeks later...

This article will explain it for you: http://rubyquicktips.com/post/5862861056/execute-shell-commands

 

Basically, Exec exits ruby to run the command. Therefore, if you are in the middle of a loop, you loop will suddenly be exited. The better way is to use backticks `. The article explains it.

 

Sorry, I just saw this post today. Otherwise, I would of spoken up sooner.

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