applescript

making an apple-scriptable application in Objective C, getting bizarre errors

Ok, so I've got an application, and I want to make it scriptable. I set up the plist, I set up the sdef file. So far I have only one apple Event command: gotoPage. it takes an integer. and returns a boolean. The relevant XML is: <command name="gotoPage" code="dcvwgoto" description="Goto a specified page"> <cocoa class="A...

What programming language is the most English-like?

I'm mainly a Python programmer, and it is often described as being "executable pseudo-code". I have used a little bit of AppleScript, which seems to be the most English-like programming language I have ever seen, because almost operators can be words, and it lets you use "the" anywhere (for example, this stupid example I just came up wi...

Applescript uses wrong python version, how to change?

I recently installed python 2.6.5 over 2.6.1 on OS X. Everything works fine except when I try executing python scripts via the Applescript editor. If I execute the following line I get version 2.6.1: Applescript: do shell script "python -c \"from sys import version; print version\"" But if I execute the similar line in the OS X termi...

Hiding a Chromium window through AppleScript

I recognise that Google Chrome & Chromium aren't highly AppleScript enabled yet. But, I was wondering if there was a way to use the "System Events" to hide a particular window or tab? Here is what I have so far ... tell application "System Events" tell process "Google Chrome" repeat with theWindow in windows set thePageName...

NSAppleScript Wont Work.

Can someone please tell me why this won't work? NSAppleScript* playPause = [[NSAppleScript alloc] initWithSource: @"\ tell application \"System Events\"\n\ tell application \"Final Cut Pro\" to activate\n\ keystroke \" \"\ end tell"]; I get the error "Expected ':' ',' ';' '}' or 'attribute' before '=' token". WT...

How to make a droplet on mac osx with automator?

I readed some tutorials about making droplets with apple script or with automator's help. First, I need to know if these droplets only works with the drag n drop file action, or if you can do the action in the current directory you are.And if the last answer is yes, how to do with automator? This was a general question. In my case. I ne...

Getting Applescript to do some work...

I have two files. One has a list of words. The other has a large list of words that includes all words in the original file. How can I write a script to search all words in list 1 and get the line on list 2 with that exact word (list 2 has the words plus additional information) and write them to a third file? I've been searching onli...

Set list to shell script output in AppleScript

I have a shell script that outputs filenames (one per line). I want to put that output into a list in AppleScript. How can I do this? Bonus points for how to then turn those filename strings into file objects. EDIT: When trying this: set theFiles to {} repeat with i from 1 to count of filenames set end of theFiles to (POSIX file...

Get only regular files from a list of aliases in AppleScript

If I have a list of aliases, how can I either remove the ones that are not regular files or create a new list with only regular files. The main question is how to determine if an alias is a regular file. I tried this, but it's hacky and it doesn't always work (like with .app files). if (theFile as string) does not end with ":" then ... ...

Download .dmg file in Cocoa

How can I download and open a .dmg file using cocoa or applescript ...

How to tell Finder to select/reveal multiple files in AppleScript

Using the following code: tell application "Finder" to reveal every item of theFiles Works when theFiles contains a single file, but when it contains multiple files, I get: error "Finder got an error: AppleEvent handler failed." number -10000 What am I doing wrong? I simply want to highlight a list of files in Finder. ...

Hiding a Mac application from the dock

I am trying to create an application with the only purpose to implement a Applescript dictionary, and extend Applescript. I have read of faceless applications (agents), but my application allows Applescript scripts to show some dialog boxes. What can I do to avoid my application icon appears in the dock when it is invoked by Applescript?...

Can AppleScript listen for events?

I want to write a script that takes action when a document is opened on a certain application, or before an application quits, etc. Is there a way to attach a script to an event in an application? Does AppleScript support any form of hooks at all? If not, can I hack my way into getting what I want? ...

How to make the hardware beep sound in Mac OS X 10.6

I just want that Mac OS X 10.6 does a hardware beep sound like in open suse and other distributions. I tried following approaches Terminal -> beep = -bash: beep: command not found Terminal -> say beep = voice speaks out beep (Not a Hardware beep but awesome ;) ) applescript -> beep = Macintosh bell (I want a Hardware beep!) Does anyb...

How do I set the time and date using AppleScript (or any other type of script) at start up?

I need to set the date and time on my Mac (Intel, Snow Leopard) to a specific date and time each time it boots. Does anyone know how I can accomplish this using AppleScript or something else? ...

Programmatically tampering with Mac OSX MenuBar settings.

I have a program that needs to turn on and off the system clock in the menu bar. This will do that: defaults write com.apple.MenuBarClock ClockEnabled -bool false (with false->true to turn it back on). Except it doesn't actually take effect until I manually open up Date & Time settings (just opening the settings causes the menu bar t...

how to create AppleScript app to run a set of terminal commands

How would I go about creating an AppleScript command that when I just run the script (or double click it in Finder?), it would run a set of terminal commands? The set of commands completely remove MySQL, and it has become a pain to constantly write them out. The commands are: sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo r...

How to insert some data into a string of AppleScript

I have a function that sends a string "theData". I want to insert that string here in this code. Would someone please tell me the correct syntax for this? Things get a bit hairy with the \"s and the "s. Thanks! NSTask *task; task = [[NSTask alloc] init]; [task setLaunchPath:@"/usr/bin/osascript"]; [task setArguments:[NSArray arrayWi...

Py-appscript: How can I make message with Mail.app

I'm trying to create mail with py-appscript (AppleScript interface for python). I tried following code, from appscript import * mail = app('Mail') msg = mail.make(new=k.outgoing_message, with_properties={'visible':True, 'content':"hello", 'subject':"appsc...

Applescript to batch export with quicktime pro

I need to export over 50 mp4 files to three different formats using Quicktime Pro. Currently I open the mp4, select the export options, choose filename to "save as" and start the process. I do this three times (one for each format) for each file. Does anyone have Applescript scipt to automate such a process, or a tool that already exist...