Jump to content
Sign in to follow this  
iRMac

Apple Script

Recommended Posts

Hello, I have had minimal experience writing script and would learn how to run applescripts and maybe even write some simple ones of my own. I've got script editor on my dock ready to go and now all I need is to learn the language. Someone explain to me the language and maybe even give me a few simple codes to try for myself to start off my coding career. Thanks.

Share this post


Link to post
Share on other sites

Also have you tried using Automator yet? While you are learning to script it could help you automate many apps. And it is much easier to understand that Applescript ... especially if you are new to coding.

Share this post


Link to post
Share on other sites
Hello, I have had minimal experience writing script and would learn how to run applescripts and maybe even write some simple ones of my own. I've got script editor on my dock ready to go and now all I need is to learn the language. Someone explain to me the language and maybe even give me a few simple codes to try for myself to start off my coding career. Thanks.

 

Macscripter is a great site but I would also join the AppleScript Users ListServer on Apple's Website. (there is a link on the iScript Netcast's website)

 

And you could always pick up the iScript Netcast (my podcast about AppleScripting). I should have more episodes on the way any day now.

 

I would also find something that you want to script... that is the best way to learn anything. Make it important to you and it will come to you much easier.

 

There are a number of books on AppleScript but many of them are out of date as far as "current concepts" are concerned but still good references for someone starting out.

 

And, you can always send me an email. I try my best to answer all questions that come in.

Share this post


Link to post
Share on other sites
Yes, ok, I've opened automator, I have no idea what to do!

 

Check the Apple website for tutorials ( look under Automator of course ). It sounds to me like you have little programming experience and Automator, IMHO, might be the best place for you to start. It would at least get you used to the logic behind programming.

Share this post


Link to post
Share on other sites

Yes, thank you, I am very interested in learning how to program, what's IMHO?

Share this post


Link to post
Share on other sites
Yes, thank you, I am very interested in learning how to program, what's IMHO?

"In my humble opinion" is what IMHO stands for.

 

Apple Geek

Share this post


Link to post
Share on other sites

Ok, so heres the thing guys, I have had a LITTLE experience using applescript, I can write simple commands such as beep 10, open location, activate application, etc. I just want to know how to do something useful and maybe write some of my own.

 

Can someone give me an example of what you use automator for with your daily life?

 

Thanks!

Share this post


Link to post
Share on other sites

A friend of mine likes to listen to "Today" on BBC Radio 4 over breakfast but as that finishes roughly when he gets up and since until recently the "Listen Again" file wasn't available quickly enough he used Automator (via an iCal event) to convert an EyeTV recording of it to an iTunes-compatible format and then stream it to some speakers plugged into an AirPort Express unit in the kitchen/dining room. (These days the "Listen Again" file is available much more quickly and he streams that to the same place via Airfoil.) I think he had to manually set EyeTV via a repeating event rather than getting Automator to drive it - though the latter may be better as it might allow things not to happen when, according to iCal, he's away. Although EyeTV could automatically export it he actually got Automator to find and process the recording (presumably via EyeTV) in order to learn about it. It's a long (radio) programme - the last hour of three usually being the best in my view - and only a Hobbit's breakfast time would allow all of it to be taken in. Of course he has the option to put it on his iPod as well so that he can listen to more in the car on his way to work - or even some of it if he overlays and has to skip breakfast. (I don't think he's got an iTrip or similar - though guess he's got a "plug and play" thing.) His car is in range of his wireless network when parked up outside so he's thinking of looking for an in-car audio device which will allow him to port such audio files across automatically (e.g. via Automator) and play them on the road.

Edited by Harry_The_Bustard

Share this post


Link to post
Share on other sites

A mac mini in the car would be a good idea - or an iPod Touch / iPhone with the automator publishing the file as a podcast to some webspace - it can then be downloaded right from the device (anywhere with a cell connection if it's an iPhone).

Share this post


Link to post
Share on other sites

I use automator to do batch editing of photos as well as Combining of PDF files. Play with it .... you'd be surprised what it can do. Another thought about Applescript is that you could try "Applescript: The Missing Manual" by O'Reilly Press. It's an older book ( hasn't been a new version in awhile ) so you might be able to get a copy for cheap at your local Bookstore ( Currently Amazon sells it for $16.50. )

Share this post


Link to post
Share on other sites

Ok sounds good, with the Watch Me Do action in Automator, you essentially have a keylogger, but it shows it recording your keystrokes. Is it possible to make an application out of a workflow with this action and record all the mouseclicks and keyboard strokes without having to open Automator and click record? Thanks

Share this post


Link to post
Share on other sites

I can't seem to get that to work. You might need the Automator app open for WMD to function.

Share this post


Link to post
Share on other sites

I know, it's quite annoying, Dolphbucs, could you give me a few simple applescript script examples? A little more complicated than beep or say, but maybe like a three or four lined command? Thanks

Share this post


Link to post
Share on other sites

Quite honestly, even though I do own Applescript : The Missing Manual and have an old-time background in coding, I have never really gotten far into Applescript ... Automator does what I need so far.

Share this post


Link to post
Share on other sites

Ok, here's a script I've got (had it for ages, can't remember if I wrote it or stole it) that toggles hidden files being show in the finder.

set Leopard to (system attribute "sysv") mod 4096 div 16 = 5

quit application "Finder"
try
if Leopard then
	set b to (not ((do shell script "/usr/bin/defaults read com.apple.finder AppleShowAllFiles") as integer as boolean)) as integer
else
	set b to (((do shell script "/usr/bin/defaults read com.apple.finder AppleShowAllFiles") is "ON") as integer) + 1
end if
on error
set b to 1
end try
if Leopard then
do shell script "/usr/bin/defaults write com.apple.finder AppleShowAllFiles -bool " & item (b + 1) of {"No", "Yes"}
else
do shell script "/usr/bin/defaults write com.apple.finder AppleShowAllFiles O" & item b of {"N", "FF"}
end if
delay 1
launch application "Finder"

Share this post


Link to post
Share on other sites
...that toggles hidden files being show in the finder.

Share this post


Link to post
Share on other sites

Copy and paste it into script editor and run it. You'll see lots of hidden files appear (.DS_Store for example which contains your viewing preferences for each folder).

Share this post


Link to post
Share on other sites

Ok so I've done this, now .DSstore is on my desktop and when I try to delete it and empty trash it reappears...How do I toggle the script and reverse what ever I just turned on...???

Thanks

 

 

Before I change this back, are their any hidden files worth looking at?

Edited by iRMac

Share this post


Link to post
Share on other sites

Sorry to keep bothering you guys, but this is kinda of annoying with all these random files everywhere, do they mean anything and how do I change it back? Thanks!

 

NVM, found it as a SuperDocker option!

Edited by iRMac

Share this post


Link to post
Share on other sites

Or you could just run the script again. If they're showing, they'll hide and vice versa.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing

    No registered users viewing this page.

  • Who's Online (See full list)

    There are no registered users currently online

×