Make Hazel move parent folder

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Make Hazel move parent folder

Postby missdigital » Wed Jul 14, 2010 5:44 pm

Hi!

I would like to create a rule to move a folder based on the contents of this folder. What I have so far, is this:

If Kind is Folder
Run rules on folder contents

Then a new rule

If name contains <some_characters>

Do the following:
move the parent/containing folder to a new location.

Is there a way to do this without using AppleScript?
As in Subfolder Depth is -1 or something?

I'm new to Hazel, so sorry if I'm asking something that is really obvious.
Thanks for helping!
missdigital
 
Posts: 3
Joined: Wed Jul 14, 2010 5:38 pm

Re: Make Hazel move parent folder

Postby Mr_Noodle » Thu Jul 15, 2010 12:09 pm

The bad news is that it does require AppleScript but the good news is that I've posted the script and you can use it as is: viewtopic.php?p=1545#p1545

That uses a mechanism I added to the AppleScript support where the script can re-target the file that Hazel will operate on in subsequent actions (in this case, the parent folder).

I will be adding a built-in way to do this in a future release.
Mr_Noodle
Site Admin
 
Posts: 2975
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Make Hazel move parent folder

Postby missdigital » Thu Jul 15, 2010 12:12 pm

Mr_Noodle wrote:The bad news is that it does require AppleScript but the good news is that I've posted the script and you can use it as is: viewtopic.php?p=1545#p1545

That uses a mechanism I added to the AppleScript support where the script can re-target the file that Hazel will operate on in subsequent actions (in this case, the parent folder).

I will be adding a built-in way to do this in a future release.


Thank you. So where do I add this AppleScript code? Sorry, I'm very new to this...

ETA: Found it. :) Thanks!
Last edited by missdigital on Thu Jul 15, 2010 12:39 pm, edited 1 time in total.
missdigital
 
Posts: 3
Joined: Wed Jul 14, 2010 5:38 pm

Re: Make Hazel move parent folder

Postby Mr_Noodle » Thu Jul 15, 2010 12:39 pm

Select the "Run AppleScript" action, click "Edit script" and paste in the script from that article in there. No need to edit it. "theFile" is a variable that represents the file being processed at the time and gets replaced with the actual file when the script runs.
Mr_Noodle
Site Admin
 
Posts: 2975
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Make Hazel move parent folder

Postby missdigital » Thu Jul 15, 2010 12:40 pm

Mr_Noodle wrote:Select the "Run AppleScript" action, click "Edit script" and paste in the script from that article in there. No need to edit it. "theFile" is a variable that represents the file being processed at the time and gets replaced with the actual file when the script runs.


Thank you! I just figured it out, and it works like a charm. I just love this program, it's worth every cent. When I get all my rules set up, it will save me hours of work.
missdigital
 
Posts: 3
Joined: Wed Jul 14, 2010 5:38 pm

Re: Make Hazel move parent folder

Postby gcoghill » Sun Nov 28, 2010 12:03 pm

Mr_Noodle wrote:I will be adding a built-in way to do this in a future release.

Has this been added or should we still use the AppleScript method?
gcoghill
 
Posts: 215
Joined: Tue Sep 18, 2007 8:09 am
Location: Kent, OH

Re: Make Hazel move parent folder

Postby Mr_Noodle » Tue Nov 30, 2010 11:56 am

It's slated for 3.0 so for now, use the AppleScript.
Mr_Noodle
Site Admin
 
Posts: 2975
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Make Hazel move parent folder

Postby gcoghill » Tue Nov 30, 2010 12:03 pm

Cool, thanks.
gcoghill
 
Posts: 215
Joined: Tue Sep 18, 2007 8:09 am
Location: Kent, OH

Re: Make Hazel move parent folder

Postby papo » Wed Mar 28, 2012 4:43 pm

can you please explain how to do this on 3.0?
papo
 
Posts: 10
Joined: Wed Mar 28, 2012 4:43 pm

Re: Make Hazel move parent folder

Postby Mr_Noodle » Wed Mar 28, 2012 5:07 pm

You need to think of it in the opposite fashion, from the top-down:

Code: Select all
If all of the following are true for any sub-file or folder
  Name contains <whatever>
Then
  Move <wherever>


Basically, if this folder has any subfiles with that name, then move the folder wherever.
Mr_Noodle
Site Admin
 
Posts: 2975
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

Who is online

Users browsing this forum: Google [Bot], jxp05j, sjk and 3 guests



Copyright © 2006-2012 Noodlesoft, LLC, All Rights Reserved. Mac and the Mac logo are trademarks of Apple Computer, Inc., registered in the U.S. and other countries.