jjaco Posted July 31, 2013 Share Posted July 31, 2013 Hi, I am trying to achieve something quite simple, but can't do it. I want a workflow which gzips all selected files in the Finder in an archive each. So I created a hotkey, and a Terminal command with gzip - but to no avail. Just nothing happens, no error, nothing. Any ideas to get me started? Thanks in advance, J Link to comment
jdfwarrior Posted August 1, 2013 Share Posted August 1, 2013 Hi, I am trying to achieve something quite simple, but can't do it. I want a workflow which gzips all selected files in the Finder in an archive each. So I created a hotkey, and a Terminal command with gzip - but to no avail. Just nothing happens, no error, nothing. Any ideas to get me started? Thanks in advance, J Creating a workflow with a file action would be an easy way to accomplish this. Add the File Action item, set properties on it (allow it to accept multiple files), then add a Run Script item. Leave the language as bash and try the following code. query="{query}" for element in $query do gzip "$element" done That should grab all files that you passed to it and gzip each. Link to comment
jjaco Posted August 1, 2013 Author Share Posted August 1, 2013 Thank you very much for your quick reply. Unfortunately, I can't get it to work. The File Action and Run Script I did set up, but invoking the workflow seems to do nothing. Is it possible that there is a problem with the $-signs in the code? I am new to bash, but shouldn't $query and $element have a $-sign? But adding them did not did the trick for me. Neither did the script gzip {query} work for a single file. It seems so simple, but I am stuck - embarrassing. Link to comment
jdfwarrior Posted August 1, 2013 Share Posted August 1, 2013 Thank you very much for your quick reply. Unfortunately, I can't get it to work. The File Action and Run Script I did set up, but invoking the workflow seems to do nothing. Is it possible that there is a problem with the $-signs in the code? I am new to bash, but shouldn't $query and $element have a $-sign? But adding them did not did the trick for me. Neither did the script gzip {query} work for a single file. It seems so simple, but I am stuck - embarrassing. My bad, missed a step, I forgot that the for loop would look for items in the string based on a space as a separator. It should be a tab. query="{query}" IFS=" " set $query for element in $query do gzip "$element" done Try that instead Link to comment
jjaco Posted August 1, 2013 Author Share Posted August 1, 2013 Hm, still nothing. Here is what I did: https://dl.dropbox.com/u/84747/gZip-Files.alfredworkflow Link to comment
jdfwarrior Posted August 1, 2013 Share Posted August 1, 2013 Hm, still nothing. Here is what I did: https://dl.dropbox.com/u/84747/gZip-Files.alfredworkflow In the Run Script, untick the option to escape Slashes Link to comment
jjaco Posted August 1, 2013 Author Share Posted August 1, 2013 Sorry, it still doesn't work :-( Link to comment
jdfwarrior Posted August 1, 2013 Share Posted August 1, 2013 Sorry, it still doesn't work :-( Weird. It works every time for me? Put a single file, no spaces in the name, on your desktop. Select it, press Cmd+opt+\ and select the action. It doesn't produce a .gz file? Link to comment
jjaco Posted August 2, 2013 Author Share Posted August 2, 2013 Ah, this was the right tip! The problem was that I had the Escape Spaces option checked. Without it it works!!! Thanks a lot again for your help! Link to comment
jdfwarrior Posted August 2, 2013 Share Posted August 2, 2013 Ah, this was the right tip! The problem was that I had the Escape Spaces option checked. Without it it works!!! Thanks a lot again for your help! Ah stupid me. I actually meant Escape Spaces. Don't know why I said Slashes. I've been working too much lately. I think my brain is fried ha. Link to comment
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