applescript

iTunes suit commands not working for remote machine

Hi all, I have found that Standard Suite commands in iTunes are working for remote machine but not the iTune Suite commands! ie. if I am using this command, it is working fine: set targetMachine to "eppc://[email protected]" tell application "iTunes" of machine targetMachine quit end tell but if I am using this, it is not working...

Can I put shared applescript code in a separate file and load it in various scripts?

I'm starting to poke around with Applescript and am looking at writing a few scripts for managing windows. A common task they will all need is to get the current screen size. I've created a screen_size subroutine that seems to work, and I want to be able to share that with all my scripts. However, I can't figure out a way to put that ...

Make ESCAPE (ESC) key close window.

How do I make an application that I can make the ESC key close a window? Or really any key (I can change if I want to). Please help. Thanks Here is what I have and I can't get it to work. -- close window with "ESC" tell application "System Events" tell application "Finder" to activate key code 53 end tell beep 3 Thanks!...

Making cocoa application scriptable

I am new to cocoa development Can any one please tell me how I can make my cocoa application scriptable. I want my application to perform certain actions,in response to scripts. I could not find easy guide or help. ...

How to activate Mac OS X application with a given process ID?

I know the process id of an application in Mac OS X. How can I switch to it (using applescript, or python, or whatever)? By "switch", I mean, put in focus. The usual solution is to use the applescript code tell application "Foo" activate, but here the name is not useful because I have many instances of the same application running. I a...

Applescript; opening an app in Space number N

Hi, I wonder if it is possible in applescript to create a script for which we give as input the application name and a number N, so this app gets opened in the Space's space number N. I would like with this to create a meta-applescript, so when the computer boots and after login, on each space I get different apps, and important, I ca...

How can I programatically move one Terminal.app window to another space?

If I have several OS-X Terminal.app windows open, how can I move one Terminal window to another space? I'm happy to use any scripting or programming language to achieve this, but would prefer AppleScript or calls to standard frameworks. (Note this is to move only one window of an application not all windows.) ...

Finder applescript: Odd behaviour

I'm on OSX Snow Leopard (I had the same issue on Leopard, though..) This is the applescript: tell application "Finder" to set my_from to selection tell application "Finder" to set my_to to target of window 2 tell application "System Events" to keystroke (ASCII character 31) tell application "Finder" to move my_from to my_to It moves t...

log keydown events using applescript

Hi I'm interested in writing an applescript project that records the date on every keypress. Can applescripts read this information while they're in the background? Or must they always be the selected window? Where is a gool tutorial to start on something like this? I have programming experience, but not in Applescript or Objective-C ...

auto-run for applescript editor

Can I make an apple script that auto runs when I put in my flash drive? I want to be able to do this so that when I put my flash drive in the computer at school I can make my presentation automatically play to save time and so i don't have to go through all my files in front of the class. We use macs at school and I have a mac. ...

Open window of an application and move it to a different Space in OSX, is it possible?

Hi, for some application I would like to have an "instance" of it running in Space (Apple's workspace) 4 and another one in number 2. How can I somehow tell (in bash/applescript or whatever) to an instance of an application, to "move" to Space number N? Applescript? Bash? External app? I want to do this automatic and for a lot of diffe...

How to increase window height longer than the screen height in applescript?

Hi, I have such an AppleScript: tell application "Firefox" activate set the bounds of the first window to {0, 0, 6000, 6000} end tell But this code doesn't let me to re-size the height of the window higher than the screen bounds. How can I make this happen? p.s. The window width is set to 6000px successfully, but no luck wi...

Application does not accept keystroke

I am trying to send keystrokes to the application VisualBoyAdvance using AppleScript, but I cannot get it to work. My code, so far, is this: tell application "VisualBoyAdvance" activate tell application "System Events" keystroke "k" end tell end tell When I tell VisualBoyAdvance directly, I get this error: erro...

Batch edit pdf - change Page Layout and Magnification with Automator Action or AppleScript

Hey! Just wondering if there is a way to batch edit pdf documents and set the "Page Layout" and "Magnification" attribute of a document so that they all the documents are displayed the same way if you open them. I'm a Mac so a Automator or AppleScript solution would be cool! BTW I have Acrobat Pro. Thanks!! ...

Adding user Authentication using Applescript

I want to add user authentication in my applescript to perform some task. If the username and password is correct then only the next task should happen. How to do this using applescript? ...

Applescript conversion to Bash

I would like to make sure that an applescript can be converted to bash. Are there any ideas on how to do this? And if so, I'll place a simple applescript below to give you an example of how the script runs. In more clarity, I simply want a bash script or shell script to do what my applescript is doing. I want it to "enable" or change the...

Setting expiration time when script tries to mount a network drive

Hello, guys. The start up script bellow mounts a network drive in my macbook: try tell application "Finder" mount volume "afp://iMac-01._afpovertcp._tcp.local/Backup%20HD" end tell end try There is two problems with this script for me: If I am out of the local network that the network drive is located, the script takes a l...

How do I get the path of a document open in Preview using AppleScript?

I have tried this but it doesn't work: tell application "Preview" set myfile to path of document 1 of window 1 end tell I have verified that my Preview is scriptable (NSAppleScriptEnabled). ...

Applescript iTunes Reveal

Is it correct that the reveal applescript command is broken with iTunes 9? Works: tell application "iTunes" play (track "Los") end tell Doesn't work: tell application "iTunes" reveal (track "Los") end tell But the following does work: tell application "iTunes" reveal (playlist "Music Videos") end tell Can anyone reproduce th...

Is Xcode capable of showing .scpt files inside the IDE or does it have to launch the AppleScript editor?

I had a weird problem, where I opened up a source code project for Xcode (probably version 2 or earlier) in Xcode 3.1.2, and when I clicked on apple script (.scpt) files that are part of the project it displayed them inside the Xcode editor as if they were source code files, but showed them as gibberish. When I right clicked and used Ge...