applescript

How do I select the next message outside of a selection in Mail using Applescript?

I wrote a short Applescript to move the selected messages to the relevant archive for that mailbox. However when it runs there is no longer a selection. (If I then press up or down, it selects either the first or last message in the entire mailbox). I can't work out how to select the next message outside of the current selection using...

Is there a quick and easy way to dump the contents of a MacOS X keychain?

I'm looking for a way to dump (export) the contents of an OS X keychain into a file that I can easily process elsewhere, such as tab-delimited plaintext or something of the sort. The Keychain Access app does not offer any such functionality, and getting a key's data involves opening each in turn, and having to type in the keychain's pas...

AppleScript to bath export from QuickTime: Can't get it to export as .mov instead of .mp4

I need to export /compress a bunch of large .avis to .movs. I found the Action Script below (taken from http://ldopa.net/2008/05/23/batch-export-for-quicktime-pro/) to do that. It successfully takes the videos from a folder called "Input" on the desktop and exports them to a folder called "Export" on the desktop. Only problem is thou...

Parsing a set of lines in Applescript

I am trying to parse a set of lines read from a file in Applescript. This is how my code looks: my status_dialog(indexData) set AppleScript's text item delimiters to return set indexFreq to (text items 1 thru 1 of indexData) indexData contains a set of lines. The line delimiter is not working. indexFreq returns me the whole set of li...

How to take screen shot of an email inside "apple mail" and "entourage" in Mac OS X?

Hi Everyone, I want to write an AppleScript or Cocoa application in Mac OS X which will take screen shot of the email inside AppleMail and Microsoft Entourage. I did this by writing a simple AppleScript code but it takes the screen shot of the page. If email is a long one, I am unable to take screen shot of following pages. Do you hav...

How to activate (bring to front) in RubyCocoa?

How can I bring my RubyCocoa application to the front? Basically I want to acheive the same result as the applescript line: tell application "Whatever" to activate ...

How to retrieve server path of a selected item in finder

Hi there Is there a way to retrieve the server path name of the selected item within finder with applescript? I've tried the properties URL and POSIX path but they just point to the local file system instead of the server path for example: smb://server/folder1/folder2/filename code so far: tell application "Finder" set selectedIt...

Apple script - How is an app registered?

I have written an Apple Script file which stopped working after I have changed the used application from being an actual directory to a link. This change was made to ease changing versions of the application. How can I reassociate the link as an application so that the script starts the right file? Currently I always receive the error "...

Add Resources to an Xcode Project Recursively with Applescript

Is it possible to add a folder to an Xcode project as a group with Applescript, recursively adding everything below it as if it were dragged to the Groups & Files list? ...

Erase Safari cookies from Terminal

I am making an application that involves controlling Safari from Applescript. Is there a way in the Terminal (preferred) or Applescript to erase Safari's cookies. Basically I want to the "Reset Safari" item from the menu using the Terminal. Is there a method that can do this? ...

Applescript for a Newbie: Copy file to a new folder.

Hi there! I've also posted this on the macnn forums, but thought I may get a better response here. I was hoping to find some help with using applescript (something I have never tried before, though I have a good knowledge of php etc) I need to create an applescript that will copy specified files from one folder to a newly created fold...

In Applescript how do I read a website, and output the text as a variable?

In Applescript how do I read a website, and output the text as a variable? I want to read the "Latest" number from here, then use that number to download the latest version of Chromium from here. ...

How do I check if text can be converted to a number in AppleScript?

I'm trying to write a simple AppleScript to do some text manipulation on the contents of the clipboard. The following code works only if the text in the clipboard can be converted to a number: set CB to the clipboard set bugNum to CB as number But if the text in the clipboard is not a number I get an AppleScript error: "Can’t make "f...

Applescript and iCal interaction

I'm trying to write an AppleScript to query iCal and find all the events I've got for a given date, in any calendar. I started by writing a simple script that does something simple with every event in a given calendar: tell application "iCal" tell calendar "Reuniones" set the_events to every event repeat with an_event in the_events...

Counting number of loops in automator

Does anyone know of a way to keep track of the number of times a loop as executed in automatator? ...

How does one get the error message from compileAndReturnError?

I've seen plenty of examples on how to use NSAppleScript, e.g.: NSAppleScript *script = = [[NSAppleScript alloc] initWithSource:source]; NSDictionary *errorDict; if ( ![script compileAndReturnError:&errorDict] ) { // ... } But I've never seen any example code that does anything with errorDict. In my case, I'd like to extract the ...

How to check for and remove a photo from an iPhoto album using AppleScript

I want to write an AppleScript to import a photo into an album. If a photo with the same file-name already exists in the given album, I want to remove the existing one first, then proceed with the import. I tried: if album "MyAlbum" contains "pic1.jpg" then remove "pic1.jpg" from album "MyAlbum" end if but that doesn't compile. (...

Why does NSAppleScript's compileAndReturnError always succeed?

Given that NSAppleScript objects are always supposed to run on the main thread, I created a small "proxy" object to use: @interface AppleScriptProxy : NSObject { NSAppleScript *m_script; NSDictionary *m_errorDict; } - (id) init; - (void) compileScript: (NSString*)script; - (void) dealloc; - (NSDictionary*) errorDict; - ...

Measuring bluetooth signal strength via AppleScript on Mac OS X

So I just read this article. What I'm wondering is, is there any way to determine bluetooth signal strength quantitatively, whether using AppleScript or some other language on Mac OS X? I'd like to implement something like this, except the 30-foot range mentioned in the article is a bit high, IMHO. I'd like it to work when I'm more than,...

Applescript Inside of a Cocoa Application

Hello, For the application I am writing, I need to access some other applications' items, for which Applescript seems the best way to go. I have been using the Appscript framework, which worked well, because it allowed me to thread it and not make my app lock up when an Applescript was taking a while. However, now I am attempting to m...