Questions tagged [applescript]

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

289 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10
votes
0answers
249 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
131 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 ...
6
votes
0answers
988 views

Create Custom Drop Down Menus in the Finder Toolbar

Happy (belated-ish) new year! Hope it's been a great one. Any Dropbox users out there will recognize the drop down menu that one can add to their Finder toolbar. Upon discovering that this existed, ...
5
votes
0answers
809 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
950 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
374 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 ...
3
votes
0answers
37 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 ...
3
votes
0answers
41 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
336 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
291 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
700 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
8k 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
112 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
205 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
521 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
358 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
147 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
26 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
34 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
38 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
64 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
27 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
110 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
231 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
61 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
536 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
233 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
819 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
95 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
345 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
904 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 ...
2
votes
0answers
57 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
278 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
62 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
236 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?
2
votes
0answers
48 views

AppleScript delete file if not used/opended last 365 days

How to write/is it possible to write AppleScript, which will delete files in certain folder, if the file wasn't used/opened for a certain amount of time?
2
votes
0answers
73 views

Can an AppleScript Service discern if selected text is editable?

I have an Automator Service entitled "Calculator" that is comprised of a single "Run AppleScript" action. It takes the selected text and then performs a calculation on this input text. If the ...
2
votes
0answers
254 views

Deleting all files except some from a folder using applescript

I am trying to write an Apple script to delete all the contents of a folder except one file (stage.txt). This is the script I've written: tell application "System Events" if exists folder "~/...
2
votes
0answers
37 views

How to remove items in the “Open dictionary” window of MacOS Script Editor?

There are some items in the dictionary that I can't find in the Window -> Resource Library. Actually they are all one application I created with Automator but for some reason appeared multiple times ...
2
votes
0answers
681 views

Applescript / Javascript : click button with getElementsByClass

Here is the button I would like AppleScript to click : <button class="btn btn-primary" autofocus="" ng-click="ok()" tabindex="0">OK</button> Here is my code : tell application "Google ...
2
votes
0answers
60 views

iMessage Clear History Without Rebooting

If I remove all chat.db files in ~/Library/Messages on my Mac, I have to restart the whole system, otherwise iMessage says "updating database..." without doing anything. I think this is because not ...
2
votes
0answers
109 views

pptx file not opened via Apple Script

I want to write an Apple Script that converts me Microsoft PowerPoint presentations into PDFs. I started with a small version, but strange enough, already that very short stub fails: on run arguments ...
2
votes
0answers
166 views

AppleScript or Safari add-on to highlight text

I have some variable that I would like to highlight in Safari. I was thinking AppleScript, but I can use something else otherwise. I'm using a Chrome plugging which do the same, any idea how to do ...
2
votes
0answers
162 views

How to set up an Applescript to remove attachments in Mail as part of a rule?

I'm on Sierra and have MailActOn in Mail. I want to set up an Outbox mail rule to run an Applescript that effectively will delete all email attachments on the message I am replying to, after ...
2
votes
0answers
28 views

Running a Service in QuickBooks

I have written a script that works on its own or when I run it from Automator. But when I add it as a service to QuickBooks I get and error message: "The action Run AppleScript encountered an error." ...
2
votes
0answers
269 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 ...
2
votes
0answers
243 views

Hot keys forcing Siri to open twice

About 30% of the time when pressing Command + Space for a fraction of a second too long, it causes Siri to close and open again. This delays the process a significant amount that at times its required ...