applescript

Applescript to launch iTunes with a specific library

I would like to write an AppleScript that would allow me to launch iTunes with a given Library instead of having to hold down the Option key and browsing for one. I'm already aware of Doug's Library manager, which is not quite what I want. The AppleScript would be for a specific library. ...

In applescript, how can I access the keyboard shortcut of a menu item?

I'm trying to figure out the keyboard shortcut (e.g., shift+cmd+S) of a given menu item in Applescript. The "Probe Menu Bar" script has helped me to access the menu items and even inspect their properties and such, but I've been unable to discover which of these will print out the keyboard shortcut. The probe script is like this: tell ...

How to parse Skype response with AppleScript?

Essentially, I need to parse the response string of the CHAT CREATE command with AppleScript to get the chatid. The response looks like: CHAT #my.username/$123abc456blah STATUS MULTICHAT I tried set chatid to item 2 of response but that returns 'H' -- I also tried set chatid to word 2 of response but that returns 'my'. I ima...

Restrict file types on droplet.

This question isn't limited to people who know AppleScript, if you do Cocoa, etc., you should know the answer to this: I'm making a droplet in AppleScript that compresses JavaScript files, so obviously, I only want JavaScript files to be allowed into the scripts. Any ideas? Thanks so much. ...

AppleScript: Index of substring in string

I want to create a function that returns a substring of a specific string from the beginning of said string up to but not including the start of another specific string. Ideas? So something like: substrUpTo(theStr, subStr) so if I inputted substrUpTo("Today is my birthday", "my"), it would return a substring of the first argument u...

Applescript to archive email in Mail.app

I need to write an Applescript for Mail.app that will take all messages in my Inbox and Sent Messages that are older than a certain # of days and move them into respective folders "On My Mac", or local folders. The reason for this being my IMAP account has a 120 day quota limit, and I'd rather automate "archiving" my email to a local fo...

Is there a way to hook in to OSX sleep/wake events via Applescript?

The problem I am trying to solve is quite simple. When I open the lid of my MacBook I like to have the Dock on the left side of the screen, but when I get home and connect my MacBook to my Cinema display and set up dual monitors, I want the dock on the bottom of the Cinema, not on the left side of the MacBook. I don’t want to have to g...

Why does an applescript receive an event multiple times from iChat?

While writing an auto-relogin tool for iChat, I came across an interesting issue. Given the following script: using terms from application "iChat" on logout finished for this_service delay 1 display dialog (connection status of this_service as string) & ":" & name of this_service as string if status of this_s...

User properties/ privileges in AppleScript

I want to write an applescript program that first checks to see if the user has Admin privileges, and if it doesn't then requesting a re-log-in or something. Eventually the script is going to need to do a sudo chmod of a folder I just created... I can do that with a do script and a with Administrator Priviledges. However I haven't figu...

How use Apple Script to put rtfd data on the clipboard

Does anyone know how to set the clipboard data type using Apple Script? I can see how to set the clipboard data, but can't find any way to set the data type. ...

Why Doesn't Applescript Exit After Background Shell Job?

I can created an (very) simple applescript app to run Firefox background & exit. (The reason is I have different profiles for work & home). My script is basically: do shell script "/Applications/firefox.app/Contents/MacOS/firefox -no-remote -P 'Personal' &" It works, but the script/app doesn't exit until I quit Firefox. How...

Store returned reference of tell Finder action in Applescript

I am building a Applescript droplet to automate some stuff. I have the following line: tell application "Finder" to duplicate dropped Dropped being a reference to the file that was dropped on the droplet. The documentation says that this returns a reference to the duplicated object. I want to set myVariable to the reference that i...

Hello World Error

Hello, I'm learning AppleScript and my first program is a Hello World(of course!): display dialog "Hello World" But when I try to run this I got the error: The result of a numeric operation was too large. Why this? How I can solve it? ...

Can AppleScript take output of shell script and put in paste buffer?

Can AppleScript take the output of a shell script or variable and put it in the paste buffer? I have a file with a password for every day (formatted "date,password") and I want to write a script that when run will look up the date and output the password for that date. That part is not a problem, I'm just wondering if there is a way ...

AppleScript to open named terminal window

I have two windows/tabs set up to run in Terminal.app, "syd" and "mel". i.e. in Shell | New Window, "syd" and "mel" are listed. How can I open these terminal configurations with AppleScript? ...

batch concatenating of png images to single file.

Hi, I want create texture atlas(matrix of images) from multiple images.Is their any applescript that can create image matrix. ...

Automate the XCode build settings

I've developed a static library that I'd like to share between XCode projects. I did some reading to learn exactly how to include this library as a binary dependency so that it runs on both the device and the simulator and that lead to a couple of manual steps which I'd now like to automate. Overall I'd like to be able to release new ver...

Finding out if a Window is being Dragged

I am trying to write a program that requires to know if a window is being dragged (moved around). The catch is that it's not the program's window, but rather any window in the OS (eg. Safari, iTunes, Adium, TextMate, etc.), and what program it belongs to I was thinking AppleScript would be a potential way to do this, but there doesn't s...

AppleScript to take text and turn it into pasteable HTML

Hi all, We work with bugzilla. Whenever you need to query a ticket you just need to know the bugid (integer) and you simply prepend this to it. http://<bugzilla_server>/bugzilla/show_bug.cgi?id=<bug_id> Suppose I have a bug link which looks like this 777. If I select and copy this it is preserved on the pasteboard so wh...

Applescript download & open link

I've set a rule in Apple Mail to run a "Download & Open link" applescript. I would like this script to download the url in the mail message and after downloading it should open the file. No idea how to start on this... ...