Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Page 1 of 2 12 LastLast
Results 1 to 8 of 12
  1. #1
    Amie's Avatar
    Amie is offline Mac Convert for Life
    Join Date
    Jun 2005
    Posts
    1,404
    Thanks
    32
    Thanked 5 Times in 4 Posts

    Can Someone PLEASE Help Me with AppleScript?

    OK, I was doing some reading and going through tutorials in order to learn AppleScript (I bought my first Mac about six months ago--lovin' it!--and I'm going for my Geek Badge). Seriously though, as I was about halfway through the first tutorial, I asked myself, "What in the HECK is the point of AppleScript?" Wouldn't it be easier to just CLICK on the darn window/menu bar/command in order to accomplish the task? For example, the tutorial gives a simple example of an AppleScript: tell application "Finder" to open the startup disk. And then: tell application "Finder" to close window "Macintosh HD". Now, wouldn't it be a heck of a lot easier--and faster!--to just CLICK on the HD to open the window, and then click on the X to close it--instead of typing all that MESS?!?!?

    Someone PLEASE explain this to me ... 'cause I have a feeling I'm missing something. LOL
    RIP iBook G4. You were the best computer for 8 years and you never failed at ANYTHING. I am the proud new owner of a MacBook Air. Do NOT be fooled by its sleek, super lightweight design. It's a POWERFULLY AWESOME lil' machine.

  2. #2
    bobw's Avatar
    bobw is offline The Late: SuperMacMod
    Join Date
    Mar 2001
    Location
    Phila,PA
    Posts
    8,835
    Thanks
    0
    Thanked 49 Times in 26 Posts
    Applescripts can be used for more than just basic tasks like that. Check this site;

    http://macscripter.net/

    http://bbs.applescript.net/

    You can also record scripts using the Applescript editor. Open that, click record, then perform some actions, and if it's scriptable, it will record a script for you.


  3. #3
    Lt Major Burns's Avatar
    Lt Major Burns is offline "Dicky" Charlteston-Burns
    Join Date
    Jan 2005
    Location
    Manchester
    Posts
    3,333
    Thanks
    0
    Thanked 2 Times in 2 Posts
    the idea is that you string up a succession of commands like close window etc. to make a script that runsa tedious task on it's own. the script i use the most is for itunes, all it does is force quit the application itunes after 60 minutes (it's actually a huge number in seconds, but the theory works), a sleep timer.
    Dual 1.8GHz G5 2GB, 1TB, Radeon 9600XT 128MB, 10.5
    20" Apple Cinema Display + Dell 2005FPW 20" dual-head
    iBook G3 700MHz
    640MB, 40GB, Rage128 16MB, 10.4, dying battery

  4. #4
    Rhisiart's Avatar
    Rhisiart is offline Registered User
    Join Date
    Apr 2005
    Location
    Procrastinateville
    Posts
    2,458
    Thanks
    94
    Thanked 13 Times in 13 Posts
    Publishers often use Applescript for workflow automation.
    Mac Mini 1.83GHz 2GB 10.7.5
    Macbook Pro 2.53GHz 4GB 10.8.2

    "The past is a foreign country: they do things differently there." L. P. Hartley, British novelist 1895 – 1972

  5. #5
    dmetzcher's Avatar
    dmetzcher is offline Metzcher.com
    Join Date
    Apr 2005
    Location
    New Jersey, USA
    Posts
    578
    Thanks
    0
    Thanked 0 Times in 0 Posts
    AppleScript's also not bad if you want to use Xcode (once you've learned a little AppleScript) to create a standalone application (Google: "AppleScript Studio). Check out something like Carbon Copy Cloner for an example of an app written in AppleScript Studio. Mostly, though, AppleScript is designed for workflow automation, and can be really helpful when you have several steps in a process flow. (i.e. - "copy pictures from a folder into another folder, apply these settings to them, crop them, upload them to my FTP server.")
    Dennis R. Metzcher
    Metzcher.com

  6. #6
    Mikuro's Avatar
    Mikuro is offline Crotchety UI Nitpicker
    Join Date
    Mar 2005
    Posts
    2,832
    Thanks
    8
    Thanked 74 Times in 64 Posts
    The tutorials just give you simple examples to get you familiar with the syntax and stuff. Yes, using an AppleScript for such a simple task would be a little silly. The usefulness of AppleScript comes from its ability to string together these simple tasks to do very complicated things.

    Here are a few examples of things I do with AppleScript:

    1. File sorting. I have a script attached to my web downloads folder that automatically sorts incoming files into sub-folders based on their type. It also changes the modification date of each incoming file so that I can sort them by the date I downloaded them rather than the date the file's author last edited it. Moving files is a simple task, but it's much faster to have a script do it for me automatically, in the background. And altering modification dates is something you can't easily do "manually".

    2. Process my iTunes tracks. iTunes has a robust scripting library, and you can do all sorts of neat things with it. For example, I have a script to do a simple find-and-replace in the title or album of all selected tracks. There's no quick way to do this without AppleScript. I also have some scripts to rename files based on their title/artist/etc. tags (iTunes can do this automatically, but not in a way I like).

    3. Quick & easy backups. I have a script in my Dock that when launched will automatically create a complete working backup of the project I'm currently working on in Xcode. It automatically puts it in the appropriate folder, automatically names it based on the current time, and asks me if I want to attach a comment to it. This makes my life so much easier.

    4. Batch renaming files. Apple includes some very useful renaming scripts with OS X. They're located in "/Library/Scripts/Finder Scripts" (that's the root Library, not the one in your Home folder). They're a little scary, but don't be discouraged; you can make useful and effective scripts that are much shorter and simpler than that. Apple's are so complicated because they're made to be more flexible than most scripts you'd make for your own personal use. Most of my scripts, even ones that do much more complicated things than renaming files, are nowhere near so long and confusing-looking as Apple's.

    Those are just a few examples. AppleScript is an incredibly useful and powerful tool. It's well worth learning.
    Mac mini — 1.25GHz G4, 1GB RAM — OS 10.5.8
    MacBook Pro — 2.26GHz C2D, 8GB RAM — OS 10.6.8

    Useful programs: Privoxy, Butler, ffmpegX, VLC, Perian, Tofu, Wcalc

  7. #7
    sourcehound's Avatar
    sourcehound is offline Registered User
    Join Date
    Aug 2005
    Posts
    211
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MacScripter is it

    Quote Originally Posted by Amie
    OK, I was doing some reading and going through tutorials in order to learn AppleScript (I bought my first Mac about six months ago--lovin' it!--and I'm going for my Geek Badge). Seriously though, as I was about halfway through the first tutorial, I asked myself, "What in the HECK is the point of AppleScript?" Wouldn't it be easier to just CLICK on the darn window/menu bar/command in order to accomplish the task? For example, the tutorial gives a simple example of an AppleScript: tell application "Finder" to open the startup disk. And then: tell application "Finder" to close window "Macintosh HD". Now, wouldn't it be a heck of a lot easier--and faster!--to just CLICK on the HD to open the window, and then click on the X to close it--instead of typing all that MESS?!?!?

    Someone PLEASE explain this to me ... 'cause I have a feeling I'm missing something. LOL
    I agree with Bob, MacScripter is the best place to go for help learning AppleScript.

    Sourcehound, author of Mac HelpMate (made with AppleScript)

    http://www.macworkshops.com/machelpmate

  8. #8
    Amie's Avatar
    Amie is offline Mac Convert for Life
    Join Date
    Jun 2005
    Posts
    1,404
    Thanks
    32
    Thanked 5 Times in 4 Posts
    Wow. Thanks for all the replies, guys! And thanks for the links. Gonna check 'em out...

    Much appreciated.
    RIP iBook G4. You were the best computer for 8 years and you never failed at ANYTHING. I am the proud new owner of a MacBook Air. Do NOT be fooled by its sleek, super lightweight design. It's a POWERFULLY AWESOME lil' machine.

 

 
Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •