Questions tagged [applescript]

AppleScript is the Mac OS scripting language.

AppleScript is a Mac OS-only inter-application scripting language designed to control and exchange data between scriptable applications.

From the Apple Developer page:

AppleScript is Apple's powerful and versatile native scripting technology for Mac OS X. With AppleScript, you can control, and communicate among, applications, databases, networks, Web services, and even the operating system itself. You can make your Macintosh applications scriptable so that users can write scripts to automate operations they would rather not do manually, from simple tasks to complex workflows involving multiple applications.

395 questions
36
votes
4 answers

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 my screen, possibly using…
27
votes
6 answers

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 this information to the police, who say it may take…
Dan J
  • 423
25
votes
2 answers

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 /Users/JS_Admin/Desktop" The thing is that I only…
DevRandom
  • 415
24
votes
7 answers

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, applescript, etc. However, I cannot seem to find a…
John Kramlich
  • 365
  • 1
  • 3
  • 6
23
votes
1 answer

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 to a space with open windows for the…
Will
  • 660
22
votes
5 answers

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
  • 4,141
20
votes
4 answers

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 open another Terminal window. Of course, if…
zaf
  • 569
19
votes
4 answers

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't even find the scripting guide for iTerm2.
cwd
  • 18,788
  • 43
  • 123
  • 162
17
votes
9 answers

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 sort of open . in reverse.
Malax
  • 1,105
14
votes
2 answers

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 currently: tell application "Firefox" to…
13
votes
5 answers

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'm staying clear of the philosophies/ethics on…
12
votes
1 answer

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/inverted" scrolling for the trackpad. The setting…
jtnire
  • 287
11
votes
2 answers

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 applescript. When I run this code: set LauncherPath to…
Simon
  • 213
11
votes
6 answers

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? With the new tabbed Finder in OS X 10.9 Mavericks,…
magoo
  • 113
  • 1
  • 1
  • 6
10
votes
2 answers

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 <
1
2 3
26 27