applescript

Delete file without playing sound in Applescript ?

tell application "Finder" set deletedfile to alias "Snow Leopard:Users:test.pdf" delete deletedfile end tell The problem is I repeatedly call this script from my Cocoa application so the sound is played repeatedly too. Is it possible to disable that sound ? ...

Using AppleScript to copy a webpage TITLE to clipboard

I am looking to copy the webpage title (of an open webpage in safari) to the clipboard using apple script (or a javascript snippet will do). I will then use that Variable in Automator. I have looked all over the web, but cannot seem to find the answer. ...

Downloading Images to a specific directory using Automator / Applescript

Im trying to use a variable in Automator to save images into a specific folder. Strangely when you create a new folder and you use a variable, it allows you to set the base path... but if you try to "Download URL" it does not allow you to select the base path to add the variable onto and it breaks the transaction. Im sure applescript ...

How do I embed an AppleScript in in a Python script?

I am trying to embed an AppleScript in a Python script. I don't want to have to save the AppleScript as a file and then load it in my Python script. Is there a way to enter the AppleScript as a string in Python and have Python execute the AppleScript? Thanks a bunch. Here is my script: import subprocess import re import os ...

Using ScriptingBridge framework for communicating with Entourage

Hi, The motivation for my question is the following doc, which describes how mail.app could be integrated using ScriptingBridge: http://developer.apple.com/mac/library/samplecode/SBSendEmail/Introduction/Intro.html I tried to apply a similar technique with Entourage as well but could not get any results so far. I understand that using...

xcode user script - Apple Script - Sort selected lines by length

I need to create a user scripts in xcode where I can sort a selection of multiple lines, by their length (number of characters) I know of this macro variable PBXTextLength, but not sure how to write the script. this is the sort selection script in Xcode: echo -n "%%%{PBXSelection}%%%" sort <&0 echo -n "%%%{PBXSelection}%%%" how can ...

making an Objective C program respond to applescript

I have an Objective C program, and I'm trying to add scriptability. I have read the docs, and I've seen the SimpleScripting examples. so, I have two questions: 1) Am I correct in saying that every (non-standard) command is going to need it's own class to respond to that command? And that class will probably only have one method. 2) Wha...

AppleScript to open URL in Safari crashes for Flash-based websites

I'm trying to open a URL in Safari. It works fine for websites without Flash embedded, but crashes Safari for Flash sites. Example (this WORKS): tell application "Safari" to open location "http://google.com" This CRASHES when Safari is not already running: tell application "Safari" to open location "http://grooveshark.com" Two thi...

using Applescript to retrieve movie file duration via Finder properties

When using Get Info on movie files in the Finder, I've noticed that many movie files have an accessible "Duration" property under the More Info tab. Is there an easy way to access this data using Applescript? I've tried lines like "set theTime to (duration of aFile)", but it doesn't seem to be as simple as that. Ideally I'd like to acce...

Cocoa/AppleScript move file

I have a list of file paths and a destination path. I need something (AppleScript, Cocoa) that will move the files from one location to an other. I first tried using the following AppleScript, just to see what happens: set the_folder to (choose folder) tell application "Finder" move selection to the_folder end tell The problem is t...

Changing window focus on OS X

As part of an InstallationCheck script on OS X I need to use finder dialogs to let the user browse for files. When I'm done I want to move the installer application up front again so that the user can easily continue with the installation. I have already tried the simple: tell application "Installer" to activate This does not work be...

Set Active Build Configuration in Xcode via User Script

How could I set the active build configuration of my current project in xcode with a shortcut? The idea is to have a shortcut to simply change between building for a device and the iphone-simulator. I think this could be easily be done in AppleScript and then integrated into user scripts but since I don't have any knowledge in AppleScrip...

How do you programmatically press a toolbar button with AppleScript?

I hope this isn't too obvious, but I'd like to press one of the toolbar buttons within an application by means of AppleScript. Background: The button doesn't have any menu item or keyboard shortcut. Thus, I can't activate it by any of those methods; I need to find an AppleScript way of actually 'pressing' the button. ...

How do I create a Numbers spreadsheet using objective-c?

I'm writing a Cocoa application and I'd like to generate a Numbers spreadsheet from my application using Scripting Bridge. I've generated the Numbers.h file and linked the ScriptingBridge.framework per the directions in Apple's Documentation. Below is the code I'm using to try to simply create a Numbers document and save it. NSString *...

#include like directive in AppleScript

Possible Duplicate: Import AppleScript methods in another AppleScript? Is there anything in AppleScript that can be used like the #include directive in C? For instance: INCLUDE_DIRECTIVE "Path/To/Applescript.scpt" //Some AppleScript code here ...

Tell system events to keystroke in Xcode?

Hello, I'm making an application, in which I need to run a code that will tell system events to keystroke a certain phrase. Like in an AppleScript, I would do: Tell Application "System Events" to keystroke "This is a test" I don't know how to do this from Xcode, and I would really appreciate any help. Thank you! ...

What's wrong with this "if"?

Hello, I'm currently trying to make an AppleScript which should recognize the selected file in Finder and do the relative command in Terminal. Everything was going fine since I reached the part where it should define the language of the selected file: it just doesn't check the ifs. I checked if it writes fileExtension correctly (via re...

applescript click every element via gui scripting

Hi, I'd like to iterate through every element on an iTunes window and try to click on each element. I'd also like to write to a text file showing each element that I've clicked. The code that I wrote below isn't working. Specifically, I get the error process "iTunes" doesn’t understand the click_an_element message. Thoughts on what I...

Applescript: Get directory dropped on

Hi, I have a applescript with the following: on open dir tell application "Finder" tell application "Terminal" activate tell application "Terminal" do script "cd " & dir end tell end tell end tell end open It works, and gets the directory thats droppe...

where can I get a good SDEF editor?

I'm writing an objective C program which will need to be applescriptable. so, I need to create and edit an SDF file. I'd MUCH rather not have to write XML if I don't have to, so I'm hoping that someone can point me to a good editor... I've found SDEF EDitor but I'd like a couple of options to play around with... Surprisingly, the apple...