Questions tagged [applescript]

AppleScript is a proprietary programming language in macOS to control and exchange data with applications.

325 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
11
votes
0answers
356 views

Set “Load remote content in messages” per sender?

In the Mail setting (under Viewing) tab, there is a option Load remote content in messages which I unchecked, so for each email that contains remote content, I need to click the Load remote content ...
8
votes
0answers
168 views

Save 'Look up & data detectors' history?

A system gesture I use often when reading is to force press on a word which will pull up a definition and/or wikipedia page of the selected word (referred to as 'Look up & data detectors' in ...
5
votes
0answers
827 views

Yosemite Mail “Load Remote Content” from senders in my contacts

I would like Mail on Yosemite to load remote content from senders in my contacts and not for everyone else. I have remote content disabled now and I have pieced together an AppleScript to click the ...
5
votes
0answers
2k views

AppleScript to read all notifications in the Notification Center OSX 10.10 Yosemite

It seems like the following AppleScript is no longer working in the latest version of the OS X 10.10 (Yosemite): on run tell application "System Events" tell process "Notification Center" ...
5
votes
0answers
997 views

Is it possible to compose Mac OS Mail in an external editor?

For Thunderbird there is the External Editor extension a very very classical piece of software that, when called via a shortcut, pops up your external editor (emacs in my case) and let's you edit your ...
5
votes
1answer
381 views

Any way to write the Terminal scrollback history?

I would like to open a new tab in Terminal with custom scrollback history. The primary use-case is to "fork" an existing tab such that both tabs contain the same scrollback history, but more generally ...
4
votes
0answers
442 views

How to use AppleScript to make Siri shortcuts?

Is there a way for me to configure my MacBook with AppleScript so that Siri will tell me my schedule for the day and other relevant information I want to know? I would like to be able to write ...
3
votes
0answers
58 views

AppleScript to Choose Files from Folder Automatically

Newbie question. I've created an Applescript that looks at the selected Folder name, copies the last term of the Folder name, and appends that to the beginning of the File Name of the files inside the ...
3
votes
0answers
66 views

Using AppleScript to delete an event still existing in Calendar?

I'm trying to write an AppleScript that clears a calendar (an iCloud one) of all of its events. I have the following: tell application "Calendar" tell calendar "Test calendar" set ...
3
votes
0answers
320 views

Change keyboard layout automatically when external keyboard connected

I recently purchased an external keyboard (non-apple) that is used at home and also dragged along with me from time to time, and I've noticed a need. My Mac is in English, as well as its physical ...
3
votes
0answers
377 views

Bash script detect received iMessage along with its contents?

I've been doing some searching around online for an answer to this question and can't seem to find one. My aim is to run a bash script which waits for the arrival of an iMessage from a specific ...
3
votes
0answers
1k views

Click a button on dialog window using AppleScript on Microsoft Excel

When I open the .ods file in microsoft excel I would like to on the "Alert" dialog box click "Yes" with the apple script. I try like this, but not work :( set theWorkbookFile to choose file with ...
3
votes
0answers
863 views

AppleScript and Numbers: Copying from one spreadsheet to another?

I'm new to AppleScript, and I'm trying to find a way to use it to copy a value from one Numbers spreadsheet and paste it into another file. The situation is that I've been using Numbers to run a ...
3
votes
0answers
301 views

Applescript - Reminders - Unbearably Slow

I wanted to write a script to "push" reminders back by an hour. I came up with this: tell application "Reminders" launch set c to current date set newtime to c + 3600 set the remind ...
3
votes
0answers
9k views

How to get rid of the “Grant File Access” dialog in Word 2016+AppleScript when inserting a picture

We use AppleScript to create MS Word documents, which also included pictures. This works fine with Word 2011, but I run into problems with Word 2016. When opening files with Word 2016 via ...
3
votes
0answers
412 views

Executing “Copy Dropbox Link” with a script

I want to create a script that executes the command from the contextual (control-click) menu, "Copy Dropbox Link". How can I access this command with Applescript (or any other Mac scripting service)? ...
3
votes
0answers
117 views

Close Dock and top bar

Is there a way to keep the application Dock closed. Every time I do: killall dock It closes for a bit then automatically reopens. I want to be able to make an AppleScript program that keeps it ...
3
votes
0answers
209 views

Is there a tool or scripting approach to change the arrangement of displays?

I move my monitors around a bit during the day. Specifically I rotate them or move my laptop to different positions. Each time I have to open up System Preferences > Displays > Arrangement and make ...
3
votes
0answers
2k views

Set iMessage sender in applescript for a new message

Applescript allows you to send messages via iMessage and the command line, ie) https://stackoverflow.com/questions/11812184/how-to-send-an-imessage-text-with-applescript-only-in-provided-service Is ...
3
votes
0answers
539 views

Detecting typing in Messeges app using applescript?

In the new Messages app, which replaced iChat, you can see when another person is typing: And i've been scripting around the messages app and was wondering if there was any way to detect when the ...
3
votes
0answers
361 views

Applescript vs. Spaces in Lion (10.7)

In Snow Leopard (10.6), I had an applescript that toggled iTunes between "maximised on Space 2" and "mini-player on all spaces": set app_identifier to do shell script "echo 'com.apple.iTunes' | /usr/...
3
votes
1answer
160 views

Is there a way for AppleScript to detect when a Desktop is switched?

When I switch desktops, I want to have a way to remind me of the purpose of that desktop. I'm thinking of using AppleScript to detect when I switch desktops, and show a pop up of sorts. Desktops / ...
3
votes
1answer
3k views

How can I permanently force Xerox secure printing?

My clients are printing direct to a network printer (no print server). Xerox have confirmed that the Secure Print Only option is only available in Windows, so I am looking at editing .plists, ...
2
votes
0answers
34 views

How can I run an executable as sudo by double clicking in Finder?

I just wanted to see if anyone more experienced with MacOS (primarily develop on Windows) can help me with a small issue I'm currently trying to resolve. Based on the comments I just want to add some ...
2
votes
0answers
71 views

Open Safari Passwords pane with AppleScript or Shell script

I'm trying to find a way to open the Safari Passwords pane without opening Safari - similar to how Siri opens it when you ask "Show me my passwords" on macOS. Any ideas? I'm thinking some kind of URL ...
2
votes
0answers
50 views

Trigger application “first open” via CLI?

Briefly: I would like to open an application for the first time from the command line, and have it act like it was opened in the Finder for the first time. In more detail: If you download an ...
2
votes
0answers
28 views

Opening terminal from command line, starting bash and got to the same location where the original terminal was

For example, I have a terminal (running /bin/bash) opened at a certain folder. Now what I want is when I type trm on the terminal, it will open another terminal at the same location where the first ...
2
votes
0answers
53 views

Default Volume Slider in Quicktime Movie Recording

Is there any way to change the default volume for a Quicktime movie recording? If always defaults to 0 (muted) when starting a new movie recording. I understand that this is done in order to prevent ...
2
votes
0answers
65 views

AppleScript to clean spam in Messages

I get a lot of spam in my iMessage, such gamble, sex etc. On my iPhone, it can be filtered into a separate column. But on my Mac, there is no way to filter messages from unknown senders, which is ...
2
votes
0answers
41 views

Refactoring Inelegant AppleScript to Use Recursion

I've written an AppleScript to iterate through an app's menu choices, doing something with each item (e.g., get its keyboard shortcut). It works, though (being AppleScript) it's very slow, but I'm ...
2
votes
0answers
45 views

Is there any way to create an iTunes smart playlist with a user defined text field as the condition?

I'm using iTunes 12.8 with Yate by 2manyrobots (https://2manyrobots.com/yate/) to manage metadata for a library of approx 50k AIFF tracks. Yate has the ability to retrieve data from Discogs and ...
2
votes
0answers
110 views

How to log the search history in Mac Dictionary when using the pop-up dictionary mode

how to log the search history in mac dictionary The answer to this post provides an AppleScript to record the words that have been looked up by actually opening the Dictionary app (using an assigned ...
2
votes
0answers
39 views

How can I make this script faster?

Below is a script intended to press the up arrow key every time a pixel of #535353 is encountered at 555,888. This is intended to create a bot for the Chrome dino game. However, for some reason the ...
2
votes
0answers
59 views

Programmatic (AppleScript) access to notification centre history

I have followed this thread, which addresses active notifications which appear on the desktop: How do I clear All OS X notifications with 1 click?. These solutions offer programatic approaches to ...
2
votes
0answers
77 views

highlighting text in safari

I need to highlight every instance of some keywords in Safari. I have this script which work : set myList to {"demo", "demo1"} try tell application "Safari" do JavaScript "document....
2
votes
0answers
31 views

To move Mac App to a second screen when it launches at the main screen/space initially?

I hope to use a apple script to move the Microsoft Remote Desktop App (MacOS version) to a second screen, center it(, and click a remote config) when it's been lunched and shown in the main screen ...
2
votes
0answers
167 views

How do I employ AppleScript in Python?

I made a program to generate contracts in bulk based on data from an .xlsx file. I originally made it for PCs, and now I'm trying to create a mac version. Everything seems to be running smoothly, but ...
2
votes
0answers
506 views

loginwindow high CPU usage

I have simple zsh script which executes the following code at a regular interval. spotify_track=`osascript -e 'tell application "Spotify" to name of current track as string'`; This is causes ...
2
votes
0answers
84 views

Invoking AppleScript from Mail Rule

While working on an AppleScript to save message attachments from a mail rule I believe I have come across what appears to be a limitation. It seems that if you invoke an AppleScript from a mail rule ...
2
votes
0answers
890 views

“Cannot open” when saving combined videos in QuickTime Player

I have several hundred videos that are each divided into ten 2-minute segments, so I am running an AppleScript to combine these with QuickTime Player 10.4. The way it works is by pasting all the parts ...
2
votes
0answers
255 views

AppleScript app can't display notifications as alerts (and workaround questions)

According to AppleScript documentation, I can create a notification with buttons by setting it to use alerts instead of banners in Notification Center preferences. But when I save an AppleScript as an ...
2
votes
0answers
1k views

Applescript click by position

I'm trying to click on a button using YX coordinate, it's work with some app, but I have one app with two windows which give me an issue. here is my original code tell application "System Events" ...
2
votes
0answers
129 views

Applescript that efficiently listens for changes to the clipboard?

I'd like to do something whenever clipboard content changes. I have a solution working now where I get the clipboard value and store it, then I start an infinite loop where I look up the clipboard ...
2
votes
0answers
306 views

Is there any alternative to the now-missing “AppleScript handler” option in Messages that allows playing custom sounds depending on sender?

In the Messages app, starting with the MacOS 10.13.4 upgrade Apple has removed the "AppleScript handler" option, which I had formerly used to play custom notification sounds when new messages were ...
2
votes
0answers
372 views

Display long text with applescript, preferably with a scrollbar

How can applescript display a long text that does not fit on the screen? I am looking for command similar to "display dialog", yet where I would be able to read the whole text. "display dialog" ...
2
votes
0answers
450 views

Applescript to turn on mirroring and set resolution to Scaled + 1440 x 900 when external display is connected

When I connect an external display I need a script to automatically: 1. Check if external monitor is connected by detecting the "Attachment" tab exists. 2. Activate the "Attachment" Tab to focus. 3. ...
2
votes
0answers
61 views

Anybody have a clever idea to create a system wide override to force text editing shortcuts?

macOS defaults to a handful of convenient text editing shortcuts such as: ^e moving the cursor to the end of lin ^k deleting all characters after the cursor until the end of the line ^a moving the ...
2
votes
0answers
313 views

How do I create an Automator-based “Replace Text” Service that works with sandboxing?

I want to create a Service using Automator on macOS 10.12.6. I selected: Service receives selected rich text in any application Input is entire selection ☑️ Output replaces selected text I then ...
2
votes
0answers
69 views

Run an App with different folder as “~/Library”

I'm trying to set up the Minecraft game so that I can launch it from and run it onto a USB flash drive (portable game and savefiles without additional config to play on each Mac). This is normal ...
2
votes
0answers
248 views

Running an AppleScript on a remote computer using ssh

How would I execute an AppleScript that is saved on my computer on a remote computer?

1 2 3 4 5 7