Anyone wanna write me a quick AppleScript?

Discussion in 'Mac Programming' started by Benjamindaines, Dec 30, 2006.

  1. macrumors 68030

    Benjamindaines

    Joined:
    Mar 24, 2005
    Location:
    A religiously oppressed state
    #1
    What I need it to do:
    • Start Terminal (hidden if you can)
    • run cp ~/Documents/Stuff/.VolumeIcon.icns /volumes/"Back Up"/
    • Have it relaunch Finder
    • Have it quit Terminal

    Much Thanks!
     
  2. Administrator

    HexMonkey

    Staff Member

    Joined:
    Feb 5, 2004
    Location:
    New Zealand
    #2
    You can bypass Terminal altogether:

    Code:
    do shell script "cp ~/Documents/Stuff/.VolumeIcon.icns /volumes/\"Back Up\"/"
    do shell script "killall Finder"
     
  3. thread starter macrumors 68030

    Benjamindaines

    Joined:
    Mar 24, 2005
    Location:
    A religiously oppressed state
    #3
    Awesome thanks! I hate coding :p
     
  4. macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
  5. macrumors 68030

    crazzyeddie

    Joined:
    Dec 7, 2002
    Location:
    Florida, USA
    #5
    AppleScript is not even close to coding. Its really not bad and uses mostly english. Its hard to get used to it at all.
     
  6. thread starter macrumors 68030

    Benjamindaines

    Joined:
    Mar 24, 2005
    Location:
    A religiously oppressed state
    #6
    Yes I know AS is easy compared to cocoa (I've looked over source code for various apps) but it's the fact that I don't know it and am too lazy to learn it for the few times I need it that makes it difficult for me ;)
     
  7. ATG
    macrumors regular

    Joined:
    Aug 7, 2005
    #7
    It's actually not so bad once you get used to it. I'm in the process of adding scripting to my Cocoa app and obviously I had to learn AppleScript first.

    But it's easy for me as a prior programmer. I do remember trying to learn it many years ago before I had even heard of C and it's lack of structure was really infuriating.

    It's great for making small apps though if you don't want to go through the trouble of creating a whole Cocoa app.

    [/OFFTOPIC]
     

Share This Page