Questions tagged [applescript]

AppleScript is an end user scripting language that has been available in Mac computers since System 7 Pro (7.1.1). It allows for automation of system tasks, communication between processes, and creation of workflows, amongst other functions.

AppleScript is a inter-application scripting language, designed to control and exchange data between scriptable applications. Users can use AppleScript to combine the functionality of multiple scriptable Mac applications to form a new application to meet their special need or demand without "reinventing the wheel".

Resources

8740 questions
215
votes
17 answers

How to make the hardware beep sound in Mac OS X 10.6

I just want that Mac OS X 10.6 does a hardware beep sound like in open suse and other distributions. I tried following approaches Terminal -> beep = -bash: beep: command not found Terminal -> say beep = voice speaks out beep (Not a Hardware beep but…
elhombre
  • 2,839
  • 7
  • 28
  • 28
127
votes
8 answers

How do I make a Mac Terminal pop-up/alert? Applescript?

I want to be able to have my program display an alert, notice, whatever that displays my custom text. How is this done? Also, is it possible to make one with several buttons that sets a variable? Similar to batch's: echo msgbox""
JShoe
  • 3,186
  • 9
  • 38
  • 61
84
votes
10 answers

Open an .html file with default browser using Bash on Mac

So, this is what I need : Let's say I have an index.html file. How do I tell the terminal to open it using the default browser? (Using AppleScript, BASH,...?)
DorBB
  • 841
  • 1
  • 6
  • 4
66
votes
8 answers

How to log objects to a console with AppleScript

I am just trying to log the state of objects throughout the life of my applescript. In other languages, object's toString() methods will render the text equivalent and I can use those. In AppleScript, this does not seem to be the case. convert…
umop
  • 2,122
  • 2
  • 18
  • 22
62
votes
2 answers

AppleScript Editor, write message to the "Result" window

I am using the Mac OS X Apple Script Editor and (while debugging) instead of writing a lot of display dialog statements, I'd like to write the results of some calculation in the window below, called "Result" (I have the German UI here, so the…
topskip
  • 16,207
  • 15
  • 67
  • 99
58
votes
15 answers

Sending commands and strings to Terminal.app with Applescript

I want to do something like this: tell application "Terminal" activate do script "ssh user@server.com" -- // write user's password -- // write some linux commands to remote server end tell For example to log in to the server, enter the…
Petruza
  • 11,744
  • 25
  • 84
  • 136
56
votes
7 answers

How to check in AppleScript if an app is running, without launching it - via osascript utility

Consider the following AppleScript: on is_running(appName) tell application "System Events" to (name of processes) contains appName end is_running set safRunning to is_running("Safari") if safRunning then tell application "Safari" --…
gimboland
  • 1,926
  • 2
  • 19
  • 28
56
votes
6 answers

How do I debug AppleScript?

What tips and tricks do you have for debugging AppleScript? Is there a debugger? If not, what is the best way to insert "prints" to display the value of variables? Is there a way to "pretty print" more complicated data structures?
Daryl Spitzer
  • 143,156
  • 76
  • 154
  • 173
54
votes
9 answers

Can the UI Automation instrument be run from the command line?

Is there a way to open the UIAutomation instrument through the terminal? Will it be possible to write an AppleScript to open Apple's UIAutomation tool and load the application to be tested? Can you please tell me is there any way through scripting…
Vijay
  • 878
  • 1
  • 7
  • 21
50
votes
9 answers

OSX Lion AppleScript : How to get current space # from mission control?

I'm trying to figure out how to get the current space # from mission control. Source would be helpful, but more helpful would be info on how to figure this out myself. I've written a few applescripts, but more often than not it seems like any time…
user578895
50
votes
2 answers

Where is the Run Script and Build Phase in Xcode?

To get Carthage set up, the documentation says that you need to add a Run Script. On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script in which you specify your…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
45
votes
8 answers

Launch Finder window with specific files selected

I'm trying to programmatically launch an OS X Finder window from an Xcode project. I need the window to open to a specific folder and have specific files within that folder automatically selected. This is similar to the "Show in Finder"…
simon.d
  • 2,471
  • 3
  • 33
  • 51
45
votes
1 answer

Is there a command-line interface to list all Bluetooth devices in range on mac?

I want to list all in-range Bluetooth devices, ideally with hostnames, but MAC addresses would be sufficient. I need a command that performs an active scan so I can poll to see if my device is nearby, not one that lists previously paired…
Nick Sweeting
  • 5,364
  • 5
  • 27
  • 37
45
votes
2 answers

Restrict 'Open Quickly's scope to currently open project in Xcode?

CMD+Shift+O ( ⌘⇧O ) brings up the 'Open Quickly' feature of Xcode. Much like CMD+T in Textmate & Sublime Text 2. Its scope of search seems to include system headers outside of my project. Is there a way to restrict this scope to the currently open…
Abhishek Mishra
  • 5,002
  • 8
  • 36
  • 38
44
votes
12 answers

Open URL in new Safari tab with AppleScript

Is it possible to use AppleScript to open a link in a new tab in Safari?
Mark Szymanski
  • 56,590
  • 24
  • 70
  • 87
1
2 3
99 100