Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
220 votes
17 answers
112k views

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 ...
elhombre's user avatar
  • 2,899
135 votes
8 answers
146k views

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? ...
JShoe's user avatar
  • 3,348
88 votes
10 answers
158k views

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's user avatar
  • 881
62 votes
2 answers
80k views

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 "...
topskip's user avatar
  • 17k
58 votes
7 answers
73k views

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 ...
gimboland's user avatar
  • 2,096
58 votes
15 answers
162k views

Sending commands and strings to Terminal.app with Applescript

I want to do something like this: tell application "Terminal" activate do script "ssh [email protected]" -- // write user's password -- // write some linux commands to remote server end tell ...
Petruza's user avatar
  • 12.1k
50 votes
9 answers
19k views

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 ...
user avatar
46 votes
1 answer
62k views

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

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,...
Nick Sweeting's user avatar
45 votes
8 answers
12k views

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. ...
simon.d's user avatar
  • 2,491
45 votes
12 answers
109k views

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's user avatar
42 votes
1 answer
62k views

How to add launch parameter to Google Chrome on Mac? [closed]

I wanna run Chrome on Mac with the parameter --enable-speech-input. Can anyone tell me the steps to do this and the steps to undo this? (If one day I wanna run Chrome without the launch parameter)
weilou's user avatar
  • 4,507
38 votes
7 answers
39k views

Is there a quick and easy way to dump the contents of a MacOS X keychain?

I'm looking for a way to dump (export) the contents of an OS X keychain into a file that I can easily process elsewhere, such as tab-delimited plaintext or something of the sort. The Keychain Access ...
Niels Heidenreich's user avatar
33 votes
3 answers
23k views

AppleScript Editor record doesn't work

I have opened the AppleScript Editor and pressed Record button. Then I run TextEdit, create a file and put some text there. When I click the Stop button in AppleScript Editor, nothing was recorded, ...
never_had_a_name's user avatar
31 votes
6 answers
39k views

Programmatically launch Terminal.app with a specified command (and custom colors)

I can launch an xterm from the command line (or a program, via a system call) like so: /usr/X11/bin/xterm -fg SkyBlue -bg black -e myscript That will launch an xterm with blue text and a black ...
dreeves's user avatar
  • 26.8k
30 votes
4 answers
29k views

"is not allowed for assistive access" error when running AppleScript from Java

I have a Jenkins config that executes Java tests for OS X app using Maven. And when I'm trying to run some AppleScript that requires assistive access for it, different errors appear. So I've tried to ...
Kirill Aleksandrov's user avatar
27 votes
3 answers
14k views

OSX: check if the screen is locked

Is there any way to check if screen is locked in shell or applescript? Not just check if screensaver is running, but screen is locked by energy saver settings or by pressing ⌃⇧⏏ (shift+control+eject). ...
LevB's user avatar
  • 2,336
27 votes
15 answers
20k views

Applescript fails with error (-600) when launched over ssh on Mavericks

I've tried searching for this, and have seen others with similar problems but don't seem to have found an answer anywhere.... I have an AppleScript that I am trying to run over ssh so that I can ...
John Martin's user avatar
  • 1,502
26 votes
6 answers
8k views

Getting RTF data out of Mac OS X pasteboard (clipboard)

According to the man page for pbpaste, -Prefer {txt | rtf | ps} tells pbpaste what type of data to look for in the pasteboard first. As stated above, pbpaste normally ...
Carl's user avatar
  • 263
25 votes
1 answer
4k views

Manipulate OS X windows with script

Ok, so I'm trying to make my setup super simple by creating a script that I can run in the morning that will launch all the applications that I use in the day and lay them out across my 'spaces' how I ...
George Green's user avatar
  • 4,865
22 votes
1 answer
26k views

Applescript: on clicking Menu Bar item via gui script

I'm trying to make an applescript for an application called F.lux that clicks the menu item "Disable for an Hour" as indicated in the screenshot below: The element path is indicated in the ...
Black Milk's user avatar
21 votes
5 answers
15k views

is there a way to eject all external hard drives from the command line? (OS X)

Is there a way to eject all the mounted hard drive volumes on an OS X computer from the command line? Applescript is OK if I can wrap that in a shell script.
dan's user avatar
  • 45k
21 votes
2 answers
26k views

concatenate a string and a variable into a string in applescript

I have to write an Applescript to automount a folder depending on the user. Applescript Editor throws this error. A end of line can’t go after this identifier. Here the portion of the script that ...
jeremyjjbrown's user avatar
20 votes
2 answers
4k views

How can I programmatically add a space to mission control?

I want to create a new space (and also be able to delete it later), without having to go through the standard misson control gui. Is there any way to do this programmatically? Either via terminal ...
Dag Stuan's user avatar
  • 201
19 votes
9 answers
30k views

How do I embed an AppleScript 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 ...
dbmikus's user avatar
  • 5,228
19 votes
6 answers
21k views

Determine OS X keyboard layout ("input source") in the terminal/a script?

I would like to determine the OS X keyboard layout (or "input source" as OS X calls it) from the terminal so that I can show it in places like the tmux status bar. So I want to know if the current ...
Henrik N's user avatar
  • 16.1k
19 votes
3 answers
44k views

Applescript - Bring window to foreground

I have an application with several windows opened at the same time. I'd like to bring a specific window to foreground (I know its title). At the moment I'm using a combination of keys to achieve this ...
Giorgio's user avatar
  • 1,603
19 votes
6 answers
12k views

Change OSX keyboard layout("input source") programmatically via terminal or AppleScript?

I am currently switching input sources by running a GUI AppleScript through Alfred, and the GUI script can sometime take up to 1s to complete the change. It gets quite annoying at times. I have come ...
maxhungry's user avatar
  • 1,902
19 votes
4 answers
13k views

run applescript on 2x-click

OK, this feels like an idiot question, but I'm stuck - I don't know the first thing about AppleScript. I have a .scpt file and I want to double-click it and just have it run, but instead every time I ...
scottru's user avatar
  • 5,320
19 votes
3 answers
11k views

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 ...
Olivier Verdier's user avatar
19 votes
2 answers
6k views

How to start new conversation in iMessage using AppleScript?

So I'm working on creating an applescript which essentially automates sending an imessage. What I have working now is: on run {msg, phoneNum} tell application "Messages" set serviceID to ...
kvel's user avatar
  • 497
18 votes
3 answers
13k views

Calling AppleScript from Python without using osascript or appscript?

Is there any way to execute (and obtain the results of) AppleScript code from python without using the osascript command-line utility or appscript (which I don't really want to use (I think?) because ...
gimboland's user avatar
  • 2,096
18 votes
1 answer
12k views

How to write Applescript to press Escape key?

I am writing an apple-script. In which I need to write code which means to hit escape button. I'm not getting how to do it. Can any one help?
Buyer Pro's user avatar
  • 207
18 votes
6 answers
10k views

How to programmatically generate a PDF from any document on OSX?

I'm working on a project for OSX where the user can pick a collection of documents (from any application) which I need to generate PDF's from. The standard Macintosh Print dialog has a PDF button ...
Denis Hennessy's user avatar
17 votes
4 answers
22k views

MacOSX: get foremost window title

I am using this code to get the window title: tell application "System Events" set frontApp to name of first application process whose frontmost is true end tell tell application frontApp ...
Albert's user avatar
  • 67.2k
17 votes
6 answers
12k views

How do I create a Macintosh Finder Alias From the Command Line?

I am trying to create a Finder Alias from the command line or from a Python program. I have searched the web[1][2][3] and found this bit of applescript: $ osascript -e 'tell application "Finder" to ...
vy32's user avatar
  • 29.2k
17 votes
5 answers
9k views

Un-minimizing an app with Applescript

I'm trying to write a script to un-minimize an app that was previously minimized to dock. Problem is, I can't find the relevant property. I've tried miniaturized and collapsed but neither the window ...
rickythefox's user avatar
  • 6,791
17 votes
2 answers
5k views

How can I programmatically 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 ...
Gavin Brock's user avatar
  • 5,077
16 votes
4 answers
7k views

Avoiding AppleScript through Ruby: rb-appscript or rubyosa?

Hello fellow Mac rubyists and AppleScript haters, For those of you that have experience with both rubyosa and rb-appscript, I'd like the hear the pros and cons of each, which one you decided to stick ...
kch's user avatar
  • 78.9k
16 votes
8 answers
16k views

Applescript get list of running apps?

Applescript newbie question again :) I am trying to create a small applescript that will allow me to select multiple items from a list of currently running applications and then quit those selected ...
user2555399's user avatar
16 votes
1 answer
950 views

AppleEvents: Send port for process has no send right

I'm seeing this in my Mac OS X Yosemite Console: AppleEvents: Send port for process has no send right, port=( port:30743/0x7817 rcv:1,send:0,d:0 limit:5) (findOrCreate()/AEMachUtils.cp #526) ...
Arius Kahn's user avatar
15 votes
6 answers
7k views

Apple Script : How can I copy html content to the clipboard?

I know how to copy plain text to the clipboard: oascript -e 'set the clipboard to "plain text"' But the question is how can I copy html contents to the clipboard? For example, how can I copy the ...
K J's user avatar
  • 4,683
15 votes
4 answers
19k views

How to change the desktop folder from "Desktop - Local" to a different folder on mac? [closed]

The files that are displayed on the desktop come from the folder /Users/USER/Desktop I am wondering if there is any way to be able to change that so the files that are displayed on the desktop come ...
Piotr Irving's user avatar
15 votes
3 answers
24k views

Set position of window with AppleScript

I'm trying to set the position of the Messages.app chat window using AppleScript. tell application "System Events" set position of window 1 of application "Messages" to {100, 100} end tell With ...
DrummerB's user avatar
  • 40.1k
15 votes
1 answer
24k views

Scripting Office Outlook 2016 on Mac [closed]

I'd like to automate Outlook 2016 on Mac. The task I'd like to automate is basically the following: search inbox for mails from the previous week having a specific pattern in the title prepare a new ...
Sylvain's user avatar
  • 161
15 votes
2 answers
5k views

Redirected to applescript editor on clicking apple notification

I am using osascript -e 'display notification "Lorem ipsum dolor sit amet" with title "Title"' to display notifications in Mac. However, on clicking the notification, I am getting redirected to the ...
Pradeep Vairamani's user avatar
14 votes
5 answers
18k views

Quit All Applications using Applescript?

How would I quit all running user applications using Applescript?
Brock Woolf's user avatar
  • 47.1k
13 votes
3 answers
20k views

Adding a script to MacOS finder contextual menu

I want to add an option to the finder context menu that calls hg add %1 with %1 being the full path of the selected file in finder. Of course there are more useful cases I can think of, to add to the ...
Petruza's user avatar
  • 12.1k
13 votes
3 answers
21k views

Applescript to "paste" clipboard

I am working on an Applescript to paste what was last copied to any current field. It is to be used with VoiceOver and the key code way (only way I know how) does not work all of the time. tell ...
Elias's user avatar
  • 237
13 votes
1 answer
48k views

Quit an application using AppleScript

Whenever I try to quit an application using AppleScript I get the following error An error of type -9874 has occurred. The AppleScript command which I am using is tell application "app_name" ...
user475685's user avatar
  • 8,259
13 votes
4 answers
18k views

Bring a window to front in applescript

This is probably a total newbie question but here it is. I am making a pure applescript application. It activates another app and then types. The problem is that when it activates the app, it doesn't ...
Chase's user avatar
  • 463

1
2 3 4 5
52