using automator instead of hazel

Discussion in 'Mac Programming' started by punktilend, Sep 16, 2011.

  1. punktilend macrumors newbie

    Joined:
    Jul 10, 2008
    #1
    I do apologize if this is the wrong place to put this but I had a question due to me having a work computer now. I use Hazel on my personal mac but I was giving a macbook pro by my company and would very much like to use the same features that I use from hazel in either automator or even apple script. My first function I need to recreate is that I have Hazel look through my downloads folder and everything that is over a month old in the downloads folder it takes and puts into the trash, I think I have it dump the trash every other week as well. If someone could explain a way of doing this through either automator or apple script I would appreciate it.
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    Install Hazel on the work computer. Problem solved.
     
  3. punktilend thread starter macrumors newbie

    Joined:
    Jul 10, 2008
    #3
    Problem not solved, I believe you did not read the question properly. I was asking if I would be able to do the same tasks that Hazel does through automator or applescript. Sorry if I was unclear for anyone or maybe that was just an intentional smart ass answer. Either way I would love to hear helpful input on the matter.
     
  4. chown33, Sep 16, 2011
    Last edited: Sep 16, 2011

    chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #4
    It was not an intentional smart ass answer.

    Question: Are you prohibited from installing Hazel on the work computer? You have not answered this fundamental question. At best, we are left to infer that "work computer" implies you may not install or use any software on it that isn't provided or installed by your at-work IT service. That, however, is an inference, which may not be true.

    If there is no prohibition against installing your own software, then is there some other reason for not installing Hazel?

    To me, the simplest solution to a problem, for which you already have the answer, is to use the same answer. You already have the answer in Hazel. If there is some reason why that answer can't be reused, you have not yet stated it.
     
  5. punktilend thread starter macrumors newbie

    Joined:
    Jul 10, 2008
    #5
    I have the ability to install any software, I was just interested mainly in getting more familiar with applescript and or automator. I figured to ask rather than just jump back on the same crutch I have been using, learning seems a lot better answer to me at the moment rather than having someone else just do it for me. In a way I know asking on here is in a round about kind of way someone doing it for me but again I'm looking to learn. Anywho
     
  6. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #6
    So the real goal here is to learn how to perform these tasks without Hazel. Which leads to another question: What is your programming experience?

    This includes things like Excel macros, because some of the basic skills are fundamental. For example, the ability to logically thing through cause/effect relationships (X happens, and Y is the consequence), as well as the ability to logically break tasks down into smaller subtasks.

    For example, consider your description:
    Breaking this down into subtasks:
    A. Confine the subtasks to the downloads folder.
    B. Find everything over a month old.
    C. Move the things found to the trash.

    You can do subtasks A & B using a single step in an Automator workflow.
    1. Open Automator and choose New Workflow.
    2. At left, under Library, select "Files & Folders".
    3. In adjacent column, drag the "Find Finder Items" action to the gray workflow area.
    4. From the action's "Search" pulldown, choose Downloads.

    At this point you have subtask A: results are confined to the downloads folder.

    5. From the list of things to find, choose "Date last modified".
    6. From the popup next to it, choose "is not in the last".
    7. Enter 30 into the box.
    8. Choose days from the last popup.

    At this point, you've added subtask B: find things over 30 days old.

    The next subtask (C) is to move the found items to the trash. On the left, look for the "Move Finder Items to Trash" action. Drag it below the "Find Finder Items" in the workflow.

    Boom. Done.

    Well, not really done, because you have to test it. And you might want to change it, such as using "Date last opened" instead of "Date last modified". But the basic logic is complete.


    I suggest going through an actual tutorial on Automator, so you know the fundamentals of how it works, and how actions can (or can't) be connected.

    Be prepared to make several different workflows that have no direct interest for you. These are exercises, and any skill requires exercises before you can effectively undertake the thing you want. No one climbs into a jet airplane and flies it. It takes learning the fundamentals and lots of boring practice first.
     
  7. punktilend thread starter macrumors newbie

    Joined:
    Jul 10, 2008
    #7
    Thank you very much for the reply. I have gone through basic classes for C++ and have recently been indulging myself with Applescript, Python, and other scripting/code. I am a bit confused with Automator, is the output of what you build Applescript or is it some type of other script or code? Thanks again and sorry if I am asking these questions in the wrong place.
     
  8. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #8
    Automator stores workflows as workflow documents. Which you can come back later and revise.

    Automator can also create applications from workflows. Or services. Or other things.

    Try doing a few simple things in Automator, and storing the result. That should tell you what you want to know.

    If you're not willing to explore things to discover how they work, you won't get far in programming.

    It's the right place. It's just that some of your questions could be better answered simply by trying it yourself. Launch Automator. What's the first thing that comes up? What does this tell you about what Automator can produce?

    The simplest exploration of Automator is to look at its menus. What facilities do they offer, such as under the Automator menu and Help menu?

    If you're looking for a guided tour of Automator, or a beginner's tutorial of Automator, try googling those search terms.
     

Share This Page