|
#1
| ||||
| ||||
| 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
__________________ I have an iBook G4 with 1.25 GB RAM. I'm cool now. |
|
#2
| ||||
| ||||
| 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
| ||||
| ||||
| 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
| ||||
| ||||
| Publishers often use Applescript for workflow automation.
__________________ Intel Mac Mini 1.83 1GB 10.5.4 PowerMac G4 833Hz 768MB 10.3.9 Education is when you read the fine print - experience is what you get when you don't. Pete Seeger |
|
#5
| |||
| |||
| 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 MyMacBlog.com: My experiences with the Mac OS, a switcher's point of view. With a new Mac tip each week day. |
|
#6
| ||||
| ||||
| 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. |
|
#7
| ||||
| ||||
| MacScripter is it Quote:
Sourcehound, author of Mac HelpMate (made with AppleScript) http://www.macworkshops.com/machelpmate |
|
#8
| ||||
| ||||
| Wow. Thanks for all the replies, guys! And thanks for the links. Gonna check 'em out... Much appreciated. ![]()
__________________ I have an iBook G4 with 1.25 GB RAM. I'm cool now. |