PDA

View Full Version : Poll: Do you create Applescript?




MacRumors
Mar 12, 2003, 08:53 AM
Vote: Poll: Do you create Applescript? (http://www.macpolls.com/?poll_id=148&ref=forums.macrumors.com)



DeusOmnis
Mar 12, 2003, 09:47 AM
I'm a programmer and i have trouble figuring it out.

jimjiminyjim
Mar 12, 2003, 10:32 AM
If the automatic scripting would work in the OS X finder, as it did in the earlier generations, most definitely would.

scem0
Mar 12, 2003, 11:03 AM
Never have needed it. I might have tried it out if I had ever had
a need, but I live just fine without it.

Doctor Q
Mar 12, 2003, 11:25 AM
I admire the innovative design of AppleScript: the use of objects with methods and properties (before it was common), English-like commands, the ability to change to another syntax without changing semantics, and the use of application-specific dictionaries. I've written a dozen scripts but it still feels awkward. For me, the language is more readable than writable.

Stelliform
Mar 12, 2003, 11:42 AM
I read about a guy who hooked up microphones and speakers throughout his house to his Mac. He then used apple scripts to have the Mac notify him of his new email (Vocally). (Only if it met certain criteria) He would then vocally tell his computer to read it or not.

This is what first got me really interested in Apple.

(Although I nave never bothered to work with Applescript, and my speech stuff on my Macs has been limited to knock knock jokes so far. :))

ebow
Mar 12, 2003, 01:06 PM
What's with the overabundance of binary options in these polls? Yes vs. No doesn't caputure very much information about most aspects of computer usage. I decided to answer "yes" here, because I've written 2 or 3 things in AppleScript in my 8 years of Mac use. What about options like "Yes, frequently", "Yes, once in a while", and "No, never"? Bah, no one probably cares...

Anyway, my most recent dabbling in AppleScript was in conjunction with Youpi Key -- I wrote a script that allows me to hit F13 and pause iTunes instantly, from any app... Very nice!

bousozoku
Mar 12, 2003, 02:56 PM
I've done some AppleScript but not that much.

It seems simple enough but it always drives me back to look up things each time. As Doctor Q says, it's "...more readable than writeable."

iJon
Mar 12, 2003, 03:31 PM
Originally posted by ebow
What's with the overabundance of binary options in these polls? Yes vs. No doesn't caputure very much information about most aspects of computer usage. I decided to answer "yes" here, because I've written 2 or 3 things in AppleScript in my 8 years of Mac use. What about options like "Yes, frequently", "Yes, once in a while", and "No, never"? Bah, no one probably cares...

Anyway, my most recent dabbling in AppleScript was in conjunction with Youpi Key -- I wrote a script that allows me to hit F13 and pause iTunes instantly, from any app... Very nice!
that is very cool man. you shoud distribute it for mac people out there who never upgraded their keyboards to the pro. if you made a set to eject, sound down, sound up you could sell them for a small fee, although you would have to rewrite it to take advantage of the whole system and not itunes. how hard was it to write? personally i like to make self detruct buttons for the macs at school using apple script. they click on it and it shuts down the computer, very funny.

iJon

Billicus
Mar 12, 2003, 04:18 PM
I've made a couple over the years.:) One was just a simple program, that when launched simply asked if you wanted to:
A) Put the Computer to Sleep
B) Shut the Computer Down
C) Restart the Computer

Kind of cool, but it took me a while to figure out how to do even that. I like the record feature, but it doesn't record everything I want it to.

ebow
Mar 12, 2003, 08:28 PM
Originally posted by iJon
that is very cool man. you shoud distribute it for mac people out there who never upgraded their keyboards to the pro. if you made a set to eject, sound down, sound up you could sell them for a small fee, although you would have to rewrite it to take advantage of the whole system and not itunes. how hard was it to write?


It took about 3 minutes to write, and I know nearly nothing about AppleScript or Youpi Key. I googled for "itunes applescript" or something like that, found the relevant vocabulary, had to do a minute of looking thru Apple's AS info for details on "end if," and there it was. FWIW, the code I used is:
tell application "iTunes"
if player state is stopped then
play
else if player state is paused then
play
else if player state is playing then
pause
end if
end tell
I set it for F13 (not much good for those without "pro" keyboards) but Youpi Key can have it be almost anything. For compact keyboard owners, useful things would be the volume keys and eject, but I don't know how to do that, nor do I have the motivation. I'm sure it's not that hard to figure out between Youpi's documentation and what can be found on Apple's site.

ebow

OSeXy!
Mar 13, 2003, 07:58 AM
My most useful custom applescript is called "chuck Word prefs". It sits on the desktop and does just what it says. As soon as I notice the menubars, etc., going haywire in that 'wonderfu'l wordprocessing application, I double-click "chuck Word prefs" and it puts the current preferences file in the bin and replaces it with a new base preferences file. Reduces to half a second what it took at least a minute to do before:rolleyes:

jbmelby
Mar 13, 2003, 08:09 PM
I've been programming for years in quite a variety of computer languages--but by far the most popular program I've ever written is a pure AppleScript application (not even an AppleScript Studio app) called Back up user prefs, which is available free here (http://www.versiontracker.com/dyn/moreinfo/macosx/17239) from Versiontracker as well as from my own site. Since at last count 10,853 people have downloaded it from the Versiontracker link alone, I think that it demonstrates that even plain vanilla AppleScript has a lot more power than it's usually given credit for having!
;)

neutrino23
Mar 15, 2003, 12:01 PM
I don't write big applications with it but use it often to manipulate or massage text.
For example, I get price list from my company in a fairly useless format. I've written scripts to apply various formats so that I can then import it into FileMaker Pro. I use it to insert a date into my daily journal. I use it to prepend dollar signs in quotations. I use it in a simple application to help solve the cryptoquip puzzles in the newspaper. I use it to schedule applications to start or stop at desired times (AudioCorder for example). I have a script that finds the current IP address (I have a non fixed IP via ADSL) and save it in a log file. I even wrote a simple alarm clock for myself one night when I was in a hotel and concerned about getting up on time.

In general I use it a lot as a "helper" application. Something that makes other appliations more useful.

For the future I am thinking of two bigger applications. One will send selections from emails to appropriate log files.

Another is to take information selected from a FileMaker database and format it into a nice looking quotation in a page layout program (Create). Stone Studio Create is very interesting for this as any document you can build in create can be saved as an AppleScript.

gerror
Mar 17, 2003, 11:21 AM
I allways tell meself to learn this but I never do... :confused:

Eniregnat
Mar 17, 2003, 12:48 PM
I tried and failed.
I good tutorial would help. (Something that Apple would provide, not 3rd party.)
AppleScript is pretty powerful, and because of that people could get themselves in trouble.

I wonder why Apple hasn't hyped or simplified generation of AppleScripts.

It's just not as easy as writing DOS batch scripts, but it is more powerful.

kylos
Mar 17, 2003, 08:39 PM
I agree that applescript is easy to read yet hard to write (and I'm a java developer quite proficient in object oriented programming). I have however gotten used to it and make a few speakable scripts for itunes (switching playlists, etc).

inkswamp
Mar 17, 2003, 09:12 PM
Other Mac users where I work like using Safari but also have to use IE on those rare occasions where Safari's beta side shows through too much. A lot of us wanted to be able to get rid of the history, cookies and cache for both programs when we log off for the evening (ya know... the whole privacy thing.) Doing it by hand would be a chore and a half. So, I sat down and, within 5 minutes, had a script called WebWiper that cleans those items out of both Safari and IE.

Now, if Apple would just give us a shutdown items like we had in OS 9, this would be perfect. Until then, we have to do it manually.

neutrino23
Mar 17, 2003, 09:57 PM
Originally posted by Eniregnat
I tried and failed.
I good tutorial would help. (Something that Apple would provide, not 3rd party.)
AppleScript is pretty powerful, and because of that people could get themselves in trouble.

I wonder why Apple hasn't hyped or simplified generation of AppleScripts.

It's just not as easy as writing DOS batch scripts, but it is more powerful.

There are lots of stories that would answer your "I wonder why..." question.

I think one reason that AS can be daunting is that it changes to adapt to each application. Each application has its own dictionary with the behavior of the words defined by the software author. Different authors can implement the same word differently. Most Applications that are scriptable supply at least a few examples.

As you suggest the best way to learn is by example. Some programs supply a lot of examples. Tex-Edit plus, for example, ships with an extensive set of scripts and has a web site with many hundreds of user supplied scripts that you can download and study.

MacScripter.org also supplies a number of examples for many applications and links to many sources of information.

One applications, Stone Studio Create, has the interesting feature that you can save any document as an AppleScript. If you run the script it reacreates the original document. This is a perfect way to learn how to script most parts of the program.

Apple provides an AppleScript reference as a pdf file on its website. Apple also provides a tutorial for AppleScript Studio as a pdf file. You can find it on Apple's site and it is installed on your disk if you install the developer tools.

Finally, Sal Soghoian - Apple's AppleScript Guru and demo king, is writing an introductory text to AppleScript which is due out this summer. It is called "AppleScript 1-2-3".

altglbrs
Mar 18, 2003, 01:54 PM
I've been using applescript for years... I remember writing a script long long ago to periodically download a web cam image periodically so i could make time lapse animated gifs..

These days, I use applescript at work all the time to automate my work and the work of the artists I support. Its a real life saver.. I made one process here go from taking 4+hrs to about 10 minutes.

I miss the recordability that I used in OS 9.. some how it doesn't seem to work that well in OS X.

Doctor Q
Mar 18, 2003, 03:07 PM
Originally posted by neutrino23
MacScripter.org also supplies a number of examples for many applications and links to many sources of information.I can't find macscripter.org. Is that really the domain name?

DeusOmnis
Mar 19, 2003, 07:47 AM
if you search for macscripter on google, it comes up as macscripter.net

neutrino23
Mar 19, 2003, 12:33 PM
Originally posted by Doctor Q
I can't find macscripter.org. Is that really the domain name?

Sorry, DeusOmnis is correct. It is Macscripter.net.

Black Badger
Mar 26, 2003, 09:52 AM
To those that don't use AppleScript, give it a go. I use it alot for InDesign and Word.
It's really, really powerful and easy to program, once you get the hang of it. The toughest part (for me) is to get your head around objects (i.e. Object Oriented Programming) and how they work and to think in natural language and not in a "programming" language.
Take InDesign for example, to find out what style a paragraph is using say:
"get the applied paragraph style of paragraph 2 of text box 3 of page 2 of active document"
Easy!
To learn AS, learn a little about If's, variables, methods, properties and other programming constructs, get your head around OOP and give it a whirl.

I have a script I use in InDesign that produces a viewable PDF, creates a separated PS file, distills that, compresses that lot and emails it to my printer. Pain in the bum manually, 1 click with AS.