Questions tagged [applescript]

AppleScript is the Mac OS scripting language.

Filter by
Sorted by
Tagged with
36 votes
4 answers
53k views

Assign a shortcut to running a script in OS X

Does OS X provide an easy way to bind key combinations to commands which are typically run on the command line? For example, is there some way to assign ⌘ Cmd+L as a global shortcut to quickly lock ...
Stefan Lasiewski's user avatar
28 votes
6 answers
37k views

How to find my stolen Macbook

A friend of mine just had her Macbook stolen. Her Dropbox account is still working on the Macbook, so she can see each time the Macbook comes online, and she can get its IP address. She has given ...
Dan J's user avatar
  • 433
24 votes
7 answers
15k views

Programmatically set the color of a tab in iTerm2?

My daily workflow includes me Launching iTerm2 Creating 3 tabs Setting one tab each to red, orange and yellow Changing to a specific path in each tab I would like to script this process; shell, ...
John Kramlich's user avatar
22 votes
2 answers
23k views

Only get the size from "du" command, not the folder names

I am doing an applescript that is supposed to set the size of an folder to an varible. This is the code so far: set sizeVar to do shell script "du -skh -m /Users/JS_Admin/Desktop" Output: "4242 /...
DevRandom's user avatar
  • 385
22 votes
1 answer
17k views

AppleScript: Open a new window in current space without switching to active window in another space

I want to have an application open a new window in the current space without switching to a space in which a window is already open, but I want to keep the When switching to an application, switch ...
Will's user avatar
  • 650
21 votes
5 answers
38k views

Execute AppleScript without opening the editor

Every time I want to run an AppleScript the editor pops up. Is there a way to run it directly?
OscarRyz's user avatar
  • 4,131
19 votes
4 answers
25k views

Applescript to open a NEW terminal window in current space

Yes, I'm having a terrible newbie experience with Apple Script. I need to open a new Terminal window in the current desktop space. NOT move me to another space which has a Terminal running and then ...
zaf's user avatar
  • 551
19 votes
4 answers
21k views

How do I set up an AppleScript to open a new iTerm2 tab and change the directory?

In OS X, how do I set up an AppleScript to open a new iTerm2 tab change to a directory clear the console echo the current directory I had something like this before for regular Terminal, but I can'...
cwd's user avatar
  • 18.1k
16 votes
9 answers
16k views

MacOS X: How to have a handy "Open this folder in iTerm" shortcut?

I think the title states exactly what I want to do. I want a shortcut or even a button within Finder which fires up a new iTerm Tab and changes the location to the location I've open in Finder. Some ...
Malax's user avatar
  • 1,065
14 votes
2 answers
22k views

Make AppleScript wait for an Application to finish loading

I have an applescript to initiate my work environment, but have a small quibble with it. I want the script to launch several programs, and then hide them, once they started. The code looks like this ...
Christian Macht's user avatar
13 votes
5 answers
131k views

Track kids browsing history even when they know how to clear it manually

I have a colleague with two teenage boys (yes, cue cliche's about 'I have this friend see...') He's currently having issues with them browsing pr0n and wants to do a little spying on their browsing (I'...
Darren Newton's user avatar
12 votes
1 answer
2k views

OS X Lion Inverted Scrolling Automation Shortcut

As everyone will know (who has Mac OS X Lion), by default, scrolling is inverted to make it a bit like the iPhone. Problem: There is no way to have "normal scrolling" for a USB mouse, and "natural/...
jtnire's user avatar
  • 277
11 votes
6 answers
11k views

How do you duplicate current open Finder view in new tab (Mavericks)?

In a thread on this forum there is an interesting solution on how to open a duplicate of an already open Finder window with the help of an AppleScript: How do you duplicate current open Finder view? ...
magoo's user avatar
  • 113
11 votes
2 answers
21k views

Get path of parent folder of script location : Applescript

Background: I'm trying to write a simple applescript app that will launch a tcl app, but I'm getting stuck on the first part of the script. I need to get the parent folder of the path to the ...
Simon's user avatar
  • 213
10 votes
2 answers
24k views

How do I close a window from an application, passing the file name?

I’m trying to produce an Applescript-based shell command that tells the Preview application from Mac OS X to close a particular window. #!/bin/sh osascript <<EOF tell application "Preview" ...
Ewan Delanoy's user avatar
10 votes
3 answers
33k views

How do I automate clicking a button in an application's window with AppleScript?

Let's say I want to click a button that appears somewhere within a window, using AppleScript. click button works, but you have to know which button exactly you want to press. For example: Scanning is ...
slhck's user avatar
  • 228k
10 votes
1 answer
7k views

Identify Mac OS X Window, Group, and Text Field names for use in AppleScript

I have an Applescript in which I wish to set the value of the text fields Name and Password of a window belonging to the process SecurityAgent. It is similar to the following: tell window "...
stefmikhail's user avatar
9 votes
1 answer
14k views

How can I launch Finder in a specific directory, from Automator or AppleScript?

I'm trying to assign a global keyboard shortcut that will launch a new window of Finder, in a specific directory. I can write a script that'll open a new Finder, but not sure how to make it open in a ...
Daniel Magliola's user avatar
9 votes
4 answers
14k views

Switch between Google Chrome Tabs using AppleScript

I was hoping that the following code would do the job, but no cigar: --Only the window is brought into focus tell application "Google Chrome" activate tab 1 of window 1 end tell
Orion751's user avatar
  • 334
9 votes
3 answers
15k views

Mac OS: How can I launch the iTerm terminal, with a specific profile, from Automator or AppleScript?

I'm trying to assign a global keyboard shortcut that will launch a new window of iTerm, with a specific profile. (I managed to do this to launch a new Chrome window with Automator and AppleScript, but ...
Daniel Magliola's user avatar
9 votes
1 answer
10k views

Automated Interaction with Google Chrome

All right SU, I have a fun nut to crack. I have 8 screens set up in a line, all hooked into one beefy G5 running Snow Leopard (yes, 4 graphics cards; about 15,000 pixels wide!). I am setting up a ...
slifty's user avatar
  • 1,569
9 votes
2 answers
702 views

Prettier text dialogs in OS X scripts

I'm getting pretty sick of these default AppleScript and cocoaDialog dialogs: I'd like to replace them with something closer to this: Has anyone made a shell executable like cocoaDialog with a ...
Lri's user avatar
  • 41.4k
8 votes
1 answer
22k views

How to zip multiple files into separate archives?

I admit this question was asked here before: Like Zip into separate files where the person who asked didn't specify the OS he used and received no answers. I need to separate a huge directory into ...
patrick's user avatar
  • 1,010
8 votes
7 answers
36k views

Open new terminal tab and execute script

I need to merge two osascript scripts, so that with one command I can open a new terminal tab and execute a script like echo hello into that new tab. This one opens a new terminal tab. osascript -e '...
ThomasReggi's user avatar
8 votes
5 answers
19k views

Toggle "ask for password after screensaver/sleep" or the delay in 10.7 using terminal

There's an option in the preference panel to change the time the mac is able to be in sleep/screensaver before requiring a password to be unlocked again. I'm using OS X Lion 10.7. Is there any way ...
desbo's user avatar
  • 81
8 votes
1 answer
8k views

Applescript to connect to bluetooth device

I'm trying to create an applescript to allow me to connect to a bluetooth device by it's Bluetooth ID. So far, i've managed to get an applescript to turn on bluetooth if it's off. Here's the code: ...
mhorgan's user avatar
  • 181
8 votes
1 answer
4k views

Folder actions on OS X observing all subfolders

I have a folder that I would like to add a folder action to. The action works great when the file is added to the top level. But when a file is added to and sub-folders, the action is not enabled. Is ...
biased_estimator's user avatar
7 votes
3 answers
9k views

How do I automatically print only part of a PDF page in OS X?

I frequently have to crop out the top half of a PDF (it's a shipping label) and only print that on A4 paper, instead of the whole label. I can do this very easily with Adobe Acrobat Pro, by opening ...
slhck's user avatar
  • 228k
7 votes
2 answers
5k views

What is the best way to make Calculate SHA1 as a context menu option in Mac OS X?

In order to calculate the SHA1 checksum of a downloaded file, I could type /usr/bin/openssl sha1 in Terminal and then drag there the file which I want check. To make it simpler, one could enable a ...
Andy's user avatar
  • 1,614
7 votes
1 answer
8k views

Get the media buttons on my bluetooth headset working with Spotify on OS X

I just bought a Parrot Zik, which is a pair of bluetooth headphones with volume control, play/pause and next-prev buttons. (Or gestures, as they come with the Zik). The phones work beautifully with ...
Pelle's user avatar
  • 213
6 votes
4 answers
4k views

How to update Mac OS X Mavericks desktop background from a script

How can I update Mac OS X Mavericks desktop background from a script? Update Mac OS X desktop background from a script worked up to OS X 10.8, but doesn't work anymore. The desktop defaults to the ...
crane's user avatar
  • 61
6 votes
2 answers
1k views

How do I make Mail.app quit after iCal sends an alert?

iCal uses a built in script file to email reminders through Mail.app. It works great, but I don't use Mail.app for my main email account, just for sending calendar notifications. So, Mail.app opens ...
user avatar
6 votes
2 answers
6k views

Open "About This Mac" from Terminal?

This probably seems totally useless to most, but i've got a specific need to open the "About This Mac" dialog from within Terminal. Any idea if its possible? I suppose AppleScript might be the way to ...
realdannys's user avatar
6 votes
3 answers
6k views

Logout user script

I am trying to create a script in ARD that will let me logout a user. Now I have a script which does start the logout, but I want it to execute instead of waiting 60 seconds. The script currently is:...
Baconlove's user avatar
6 votes
1 answer
1k views

Mail.app: Showing remote images automatically for specific senders

In a similar way to what gmail allows, I'd like to get specific senders' remote images to be auto-loaded. One option that I came across is using a rule and an applescript: https://discussions.apple....
GJ.'s user avatar
  • 9,843
6 votes
1 answer
5k views

How can I run a script whenever I plug in an external monitor? [duplicate]

Possible Duplicate: Reset Mac OS X Windows Position after de-attaching external monitor I use my laptop at work, where I have a second monitor, and at home, where I don't. When I plug in the ...
Jay Levitt's user avatar
6 votes
3 answers
7k views

AppleScript to paste clipboard into current application

I thought this would be simple... I want an AppleScript that launches Plain Clip and then pastes the clipboard into the current document where the cursor is. My script launches Plain Clip (a format-...
Zade's user avatar
  • 161
6 votes
2 answers
6k views

Creating "save as" functionality to .eml file in AppleScript

I'm new to AppleScript and trying to figure out how to save a Mail.app message as an .eml message. Ideally, I would like it to act similar to the Mail menu bar actions, in which it saves the message ...
unieater's user avatar
5 votes
5 answers
7k views

Apple Mail: Flag message from keyboard

One of the flags in Apple Mail can be applied to a message using Command-Shift-L. Is there a way to apply any other flag? I renamed one of the colors to TODO, and I set up a keyboard shortcut for ...
hibbelig's user avatar
  • 185
5 votes
4 answers
11k views

Quotes within quotes applescript

I am doing an applescript that is supposed to set an command with quotes an variable. This is the code so far: set myString to "This is a "quoted" text." But an error occurs because applescript ...
DevRandom's user avatar
  • 385
5 votes
2 answers
3k views

How to update Preview.app from the command line without losing focus on Mac OS X?

I want to update Preview.app in the background from the command line without losing focus of my current window. I know that I can use the following to open/update the view of a file, but then I lose ...
snies's user avatar
  • 504
5 votes
1 answer
18k views

How can I automate mouse movement in OS X via AppleScript or a shell script?

Just recently I got into an FPS game and I've wanted to challenge myself to make an anti-recoil script for a while. An anti-recoil script would essentially move the mouse based on a set of ...
Elegant.Scripting's user avatar
5 votes
3 answers
4k views

Get a list of all files and their attributes on OS X

What is the best and fastest way to get a list of every file on OS X including hidden and system files along with their attributes? I'm not afraid of the terminal or scripts, but if there is a ...
Michael Prescott's user avatar
5 votes
1 answer
3k views

Determine Mac's screen state using AppleScript

Is there a way to determine what state the Mac's screen is in? I'd like to have a script that checks if the screen is in a non-active state; so either the screen saver is running or the display is ...
user47883's user avatar
5 votes
2 answers
2k views

Mac screenshot of a specific window without using the mouse/click

I've been researching for a day or two but can't find a method to take a screenshot of a specific window (possibly the only window) open at a specific time using an Apple script. Currently I have the ...
user3033's user avatar
  • 293
5 votes
1 answer
892 views

Responding to Growl notifications with Applescript

I'm looking to write some Applescript which is run in response to Growl events. e.g. email arrives from a given user which effects some change on my Nabaztag. I can find plenty on the internet ...
jamesh's user avatar
  • 549
4 votes
5 answers
8k views

Applescript to lock the screen

I need a little Applescript to lock the screen, the same behaviour I get when I click the Keychain icon in the menu bar and choose "Lock screen". I found a way to activate the screensaver, but it's ...
Davide Gualano's user avatar
4 votes
2 answers
11k views

How do I run an Automator action, shell script or AppleScript on startup in OS X?

I know you can run applications on startup on a Mac, but can you run an Automator action, a Service, a shell script, or an AppleScript on startup instead? I also know you can save all of these as an ...
gadgetmo's user avatar
  • 786
4 votes
4 answers
11k views

Automatic PDF renaming based on title

I have thousands of scientific PDFs that i need to rename, many do not have metadata. I would like to be able to create an automator action that could open a folder then open each PDF, copy the title ...
Ron's user avatar
  • 41
4 votes
4 answers
6k views

How to open a new Firefox window with Terminal

I am running Firefox v10.0.1 with OS X Lion v10.7.3 From the Apple dock, you can right-click on Firefox icon and choose NEW and a new Firefox window will open. From terminal, I have tried open -...
jsherk's user avatar
  • 617

1
2 3 4 5
8