newbie needs mac os x applescripting help

Discussion in 'Mac Programming' started by nukiduz, Jan 8, 2007.

  1. macrumors 6502

    nukiduz

    Joined:
    Apr 23, 2006
    #1
    Hello there. I don't know almost anything about programming but I found Applescript very easy. I want to make a small script that copies a folder from my mac to a USB drive when it mounts. Something like a simple backup script. I don't know if this is possible but coul you help me with this? I'm not asking you to make it for me, in fact I prefer to do it myself. Thanks.
     
  2. Administrator emeritus

    xUKHCx

    Joined:
    Jan 15, 2006
    Location:
    The Kop
    #2
    This is actually identical to my first applescript project. Great place to learn.

    I have given you a little starter to help things along.


    For this to work you will need to attach a folder action to your /Volumes folder.
    So your script should look something like this

    ----------
    on adding folder items to this_folder after receiving added_items

    Your code here

    end adding folder items to
    ----------
    Where added_items is the variable that is assigned to the item that was added to that folder.

    You may want to read the Finder dictionary to get the copying part done.

    To do this open up script editor and File -> Open Dictionary and select finder.


    To add the folder action you need to save the script, then in Finder Go -> Go To Folder -> /Volumes control- click and choose attach folder actions. (You may have to select enable folder actions first.)
     

Share This Page