applescript

Applescript detect new drives

I have an applescript studio application that I use for imaging hard drives. Right now it runs a shell script (diskutil list -plist) to get information about the drives attached to the computer, it then presents this information to the user, and the proper drive to image is selected. Ideally I would like my application to be able to d...

reduce the number of colours used for PNG image with Automator/Applescript

I want to convert scanned text (black & white) to a PNG image with a colour depth of 1 bit. With Image Events it is possible to convert the scanned image. But "bit depth" is read only. Is there a better way to set the colour depth of a PNG image than to call the shell and use ImageMagick? Thanks ...

AppleScript for unlock screen dialog

I've written an Applescript that sets various IM clients to away, closes iTunes, and then starts my screensaver. tell application "Adium" go away end tell tell application "Skype" send command "SET USERSTATUS AWAY" script name "StatusSetter" end tell tell application "iTunes" if player state is playing then pause ...

How can I ask an object whether it's a subclass of file in Applescript?

I have an object. It might be a document file, an alias file, a disk, a folder, etc. I can write code that looks like this: if (class of f) is in {document file, alias file} then -- do something with this item end if I would like to change that code to something like this: if f is an instance of file then -- do something with...

Looking for Applescript documentation

I've done iPhone development for the last year without needing to learn the first thing about Applescript, but now I'm finding I want to automate some tasks. But I can't find any good documentation on the language. Even the Apple developer site doesn't seem to have what I want. I don't need a tutorial -- just a document that tells me ...

Defining and executing simple AppleScript commands in a Cocoa app

I'm trying to add some scripting functionality to a Cocoa app that I've written. I've created an sdef (Scripting Definition File) for my project. So far I have been successful in accessing object children (elements) with AppleScript but I cannot for the life of me figure out how to call methods (commands). Here is my sdef file. <suite ...

How to (programatically) change slides in a running Keynote presentation?

I'm working on a Cocoa application I'd like to use to remotely (on the same machine, from a different process) control which slide is currently displayed in a running Apple iWork '09 Keynote presentation. How should I approach this? ...

syntax error: Expected end of line but found unknown token.

Hi Everyone: I am attempting to run some AppleScript in the terminal, just to learn how to do it, and I am running into some trouble with the & sign. Even when the & is replaced with the "&", it still returns the same error.. I have narrowed it down to the problem with the & sign, and am wondering if anyone has any advice about it. I...

Applescript path to application using variable

If I have an applescript snippet such as this tell application "Finder" set thePath to (POSIX path of (path to application "MyApp")) end tell it will return to me "/Applications/MyApp.app" Now, what I can't seem to figure out is how to instead specify "MyApp" via a variable rather than the literal. My applescript reads in some XM...

Disable/Cancel Sleep Command on MacOSX

It seems to be impossible to completely disable the Sleep option in MacOSX so that a user cannot manually put the system to sleep. Is there a way in Leopard (or even Snow Leopard) for AppleScript to catch the Sleep event and cancel it? ...

Launchd PLIST Not Running

Hi Everyone: I am attempting to run an Applescript inside a launchd plist, but for some reason it just isn't working. It could be that it is my computer, but I am thinking that there may be something else wrong with it. If someone could take a look and comment on this post, I would really appreciate it! <?xml version="1.0" encoding="...

How to Extract AppleScript Data from a NSAppleEventDescriptor in Cocoa and Parse it

Hello! What I'm doing is executing an AppleScript inside of Cocoa. It returns some data as a NSAppleEventDescriptor, which NSLog() prints like so: <NSAppleEventDescriptor: 'obj '{ 'form':'name', 'want':'dskp', 'seld':'utxt'("69671872"), 'from':'null'() }> I want to take that data and turn it into a NSDictionary or NSArray, or someth...

Applescript question - using Applescript month type

I have a record-type for which I need to store a Month value. I'm trying to leverage the month class/type that Apple has ( you can define the month of a date i.e., set month of fooDate to July). This record-type is going to be one of 6 possible types of another property in another object. I have tried creating a property called month ...

How do I remove a group from an xcode project using AppleScript

I've successfully managed to add files to a group with AppleScript, but I also need to be able to remove a child group. I thought something like tell currentGroup --remove any groups already present repeat with groupItem in groups --display alert " " & name of groupItem remove groupItem from groups end repeat end ...

How do I set the Active SDK in xcode using AppleScript?

I've managed to set the active target, executable and the build configuration of my project using AppleScript but I can't work out how to set the Active SDK. Any ideas? ...

Acessing Mac applications from Ruby or PHP or Cocoa

I would like to access a couple of different Mac OS X applications from preferably Ruby, but I would settle for PHP. The applications are Elgato's turbo.264 and Apple's iTunes. Both have Applescript Libraries defined that would allow me to do what I want to do from Applescript, but I don't want to do this in Applescript. If I can't do th...

Apple Event Handler Failure (Ruby/AppScript) while trying to growl

I'm trying to growl from Ruby/Appscript, based on this sample Applescript code: tell application "GrowlHelperApp" set the enabledNotificationsList to {"Mail Notification"} register as application "MailWidgetGrowlHelper" all notifications enabledNotificationsList default notifications enabledNotificationsList icon of application ...

Avoiding AppleScript through Ruby: rb-appscript or rubyosa?

Hello fellow Mac rubyists and AppleScript haters, For those of you that have experience with both rubyosa and rb-appscript, I'd like the hear the pros and cons of each, which one you decided to stick with, and which one you'd recommend for a totally non-AppleScript savvy ruby old-timer. Also, are there any other options that I have miss...

Learning AppleScript

What resources would you recommend to pick up AppleScript. I come with a traditional C/C++ with Objective-C background. I am also looking for tips on how to develop better and get faster documentation from the script editor. A sample tip would be 'lookup the sdef file of the app you want to script. ...

What is applescript and what is it used for?

What is applescript and what is it used for? ...