Questions tagged [applescript]
AppleScript is a proprietary programming language in macOS to control and exchange data with applications.
3,347
questions
0
votes
0
answers
10
views
Using SummarizeService from Shortcuts
I’d like to build a Shortcut that runs the MacOS Summarize service on some text input.
It looks like there’s no built-in support for summarizing text in Shortcut so I’m curious if I can make a ...
1
vote
1
answer
87
views
How to write backslash in Apple script
I want to do this from the shell with an Apple Script:
/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/MacOS/join -o output inpath1 inpath2
However I don't know how to write backslash ...
2
votes
2
answers
40
views
How can I write an AppleScript to automatically unhide the dock and menu bar when my M1 MacBook Pro is connected to an external display?
I have an M1 MacBook Pro and I often connect it to an external display. I would like to automatically unhide the dock and menu bar when my MacBook Pro is connected to the external display, and hide ...
1
vote
1
answer
79
views
AppleScript to move file to /Library
I need to run a simple command like this:
do shell script "sudo cp -r /Users/me/file.plugin /Library/My-Plug-Ins" with administrator privileges
However I get "operation not permitted&...
0
votes
1
answer
26
views
Unable to load a workflow as a service using launchctl in macOS
I am trying to load a workflow as a service using launchctl on macOS (Ventura 13.2.1), but I am encountering an error message. The workflow is located at /Users/rohan/Library/Services/open-bluetooth-...
0
votes
0
answers
46
views
Apple script behaves differently on Monterey and Ventura
I ran following script on Monterey (12.4) and Ventura (13.2.1) in Terminal :
osascript -e 'tell application "System Events"
keystroke "echo hi"
end tell'
On Monterey, I get ...
0
votes
0
answers
15
views
Announce the sender of a new message in Mail
I am trying to create a simple AppleScript that I can use with rules to announce the incoming sender of a message. I want it to say their name and not their email address as well. This is what I have ...
0
votes
2
answers
37
views
Shell script application bundle prompts for Rosetta installation
I exported the following line of AppleScript code into an macOS application via the "Script Editor":
do shell script "open '/Applications/Google Chrome.app' --args --proxy-server=...
0
votes
0
answers
22
views
Ventura, automatically close all "Disk Not Ejected Property" notifications?
On macOS 12.x I was using a script to automatically close massive number of Disk Not Ejected Properly notifications that show up the next morning if I inadvertently leave my computer running with one ...
-1
votes
0
answers
23
views
To grab a page from Pages document and convert it to PDF of image
I have never worked with AppleScript before. I need to create a script that will take a Pages document, convert each page to PDF (or some lossless image format) and then set this PDF or image as a ...
0
votes
0
answers
53
views
What can be done to make programs startup faster?
I bought a new MacBook Air with an M1 chip.
When I launch programs, they don't launch immediately. First, the icon bounces for a few seconds, and only after that, I can see the program window.
I found ...
1
vote
1
answer
67
views
In AppleScript, how can I make a dialog box with a custom icon?
In AppleScript, how can you make a dialog box with a custom icon in the app bundle?
I'd like it to be in the Contents/Resources directory, and named "GenericNetworkIcon.icns".
Thank you.
0
votes
0
answers
9
views
Folder Watchdog for Shortcuts to Ingest Images?
I'm using a command to dump regular screenshots of a website to a folder. Now I like to run a Shortcut whenever a new image file is added to the folder. Basically the shortcut will run OCR on the ...
0
votes
1
answer
46
views
How to sort files with similar filenames into discrete folders?
I borrowed the code below from this thread: How to sort files with similar filenames into discrete folders? (AppleScript)
But I would like to take it a step further for situations like this:
FROM:
...
0
votes
1
answer
26
views
Mac Mail - Set signature by sending address
I use macOS's Mail app and have iCloud+. I have two mail addresses - my usual iCloud address and another through a custom domain that I own, that maps back to the iCloud account (something which is ...
0
votes
0
answers
10
views
AppleScript that changes shortcuts
Can I write an AppleScript that changes the shortcut for a Mac command, e.g., Move focus to next window? Through the GUI, it's under System Settings -> Keyboard -> Keyboard Shortcuts... -> ...
1
vote
0
answers
14
views
JXA (AppleScript) disabled other key on system.keystroke
I trigger CMD+C to get the content highlighted to the clipboard.
My problem is that if the user does another key simultaneously, it breaks all the flow.
Do you know any solution (like blocking other ...
1
vote
0
answers
26
views
Creating Automator Quick Action to Extract (and Move) Media Files From Subfolders to New Folder (in Parent Directory)
I have an audio recording device that puts all files from any given capture into its own folder. (This includes all channels of the recording plus a metadata document.)
Typically, I navigate to the ...
0
votes
0
answers
31
views
AppleScript no longer works in Big Sur
When I used macOS Mojave I always used this AppleScript automatized with Keyboard Maestro, to auto close the boring system message Disk Not Ejected Properly. It always worked fine with Mojave. Now ...
1
vote
1
answer
51
views
How to Implement a Dictionary Look Up Script on Mac and Save to History Log: Need Help with Syntax Errors
After several times of having my MacBook shutdown and losing the several tabs I had opened of the words I looked up, I've started to look for a solution.
I'm currently trying to implement a script ...
1
vote
0
answers
31
views
AppleScript - replace substring in image names right after exporting them with Pixelmator and overwriting old images
After opening and editing images with Pixelmator pro I use this script:
tell application "Pixelmator Pro"
set exportLocation to choose folder with prompt "Please select where you'd ...
1
vote
2
answers
99
views
Help with osascript Command to Hide Login Item on MacOS Ventura
I'm attempting to use the following command in Terminal on MacOS 13.2.1 to add WebDrive.app to my login items hidden (or even just minimized) on MacOS, since there appears to be no way to do it with ...
1
vote
1
answer
57
views
How to run AppleScript from Keynote?
Within Keynote and using AppleScript, I’m trying to emulate a macro used in a Windows PowerPoint file by a colleague. The macro is executed by clicking on a customized button. So, I wonder if the same ...
1
vote
0
answers
38
views
Creating a PDF File from some specific data in HTML Tags in a website in Safari
I have the following task that I need to automate as much as possible:
Grab Page Source from currently open site in Safari. This is a site whose HTML structure is fixed, but specific data (such as ...
1
vote
0
answers
24
views
MacMail rules don't work for follow up messages
I am trying to archive emails where the last message contains a keyword.
I am not able to do this with Rules in MacMail as it seems it only cares about the first message in the inbox. How can archive ...
2
votes
1
answer
59
views
Script to run Apple Inbox Rules
Note: I am not asking how to create a rule which runs an Applescript. I want to go the other way around: run a script that will apply existing rules to all the messages in the inbox. That is, simulate
...
1
vote
2
answers
235
views
Enabling HDR on macOS ventura using an apple script
I have a macbook M1 Max 2021, 1tb, 64gb ram, with mac os 13.1 ventura and my HDR always randomly turns off when my computer wakes up from sleep. My monitors are dell s3422dwg and dell s2721dgf.
My ...
0
votes
0
answers
20
views
AppleScript: adding an attachment to Notes.app
I scan physical mail into Notes.app for archiving. I use the Notes app on my iPhone to do this. Works great, except that the name of the attachment is derived from the content scanned in and 100% of ...
0
votes
1
answer
149
views
How can I change Display Refresh Rate with Apple Script on Ventura?
I want to change the Refresh Rate between 60Hz and ProMotion(120Hz) with Apple Script on Ventura.
System Settings have changed on Ventura and I couldn't find anything about how to write proper Apple ...
0
votes
0
answers
93
views
Error "System Settings got an error: AppleEvent handler failed." number -10000 on Apple Script
How can I resolve this code? Since I got ghost touch on my touch bar, I want to make an automation to uncheck the "Show Control Strip" and change "Touch Bar Shows" to Quick Actions....
2
votes
0
answers
26
views
Automating Zoom.us app with applescript
I'm helping disabled person to adapt Zoom application for their special needs.
The problem is that zoom exposes only raise hand reaction via Option + y keyboard shortcut.
My goal is to let this person ...
0
votes
0
answers
43
views
Running .pkg installer fails through Script Editor, but works in Terminal
I'm trying to use Script Editor to create a clickable app that downloads a script, runs the script (which uninstalls a piece of software that isn't working properly), downloads a new .pkg installer, ...
0
votes
0
answers
16
views
A script that opens .py types in values required
First a bit of backstory, when I do python assignments I had to manually add inventory items again and again which was painful so I wrote a shell script which would start my python program and enter ...
0
votes
1
answer
51
views
(AppleScript) How to adjust Apple Music's application volume?
I'd like to write a Shortcut ("Fade out Apple Music") that slowly reduces the Apple Music volume over the course of ~5 seconds.
I don't see a Shortcut option for getting/setting Apple Music'...
0
votes
0
answers
12
views
How to manage all the virtual desktops (spaces) with AppleScript
I wrote a piece of Applescript that changes the wallpaper on macOS. I usually have multiple virtual desktops (spaces) and I'd like to manage all of them. While it seems to be easy to control physical ...
1
vote
1
answer
80
views
"do shell script" fails with complaint about "env" and "No such file or directory" but the path for the command is correct
Background: texdoc is a command installed by the LaTeX distribution MacTeX and which texdoc in the Terminal gives "/Library/TeX/texbin/texdoc".
In the Terminal, texdoc --version gives:
...
0
votes
0
answers
36
views
How to update system preference in background
I'm using the below code to update the modifier keys to my requirement.
Is there a way to update this in the background without the user's notice?
tell application "System Preferences"
...
0
votes
0
answers
144
views
Terminal command to enable / disable Stage Manager in the new System Settings in macOS Ventura
I am trying to write an automation using either Bash or AppleScript, to enable / disable Stage Manager, and this looks quite difficult to achieve.
I cannot find much documentation around since in ...
1
vote
1
answer
23
views
How to get a count of *non-minimized* windows in the current Space?
I can get a count of Firefox windows in the current Space, including any minimized windows (from any Space - what odd semantics) using something like this:
tell application "System Events"
...
0
votes
0
answers
21
views
While having 'When switching to an application, switch to…' enabled, disable it temporarily (or for a particular application)
This question is effectively a generalized form of Open new terminal window in current space, regardless of other open terminals in other spaces.
Also similar is AppleScript: Open a new window in ...
0
votes
0
answers
25
views
Is there a way to programatically detect Universal Control monitors and arrange displays?
I've been trying to find a way to programatically detect and script Universal Control.
(Some background: imagine you have two Macs—call them A and B—both hooked up to external displays over USB-C to ...
0
votes
0
answers
127
views
Is it possible to remap mouse buttons without any third-party software?
I have a (Logitech MX Master 3S) mouse that I use with my company provided Mac, but I can't install any third party software to configure its buttons, at all, per security policy. Is there a way I can ...
0
votes
0
answers
12
views
How do I set up a keystroke to change the background color of an Apple Mail inbox listing
I'm using Apple Mail. I'm also running an extension (MailSuite) which I use to set up keystroke commands. Mailsuite Act-On has a command which I can activate with an Act-On keystroke, to change the ...
0
votes
1
answer
86
views
osascript gets "System Events got an error: osascript is not allowed assistive access. (-1728)"
I have a modest (~250 lines) python3 script using tkinter and subprocesses.
The python script launches a macOS app using the "run" subprocess.
Python defined functions then query the system ...
0
votes
0
answers
31
views
Convert list of Apple Music links to an Apple Music playlist
I have a text document with a list of Apple Music links for songs, all with this format:
https://music.apple.com/us/album/1650841512?i=1650841513
Is there an easy way to create a playlist with all of ...
0
votes
0
answers
64
views
AppleScript error/no result when clicking FaceTime Accept button in Notification Center
Background:
I want to automatically answer incoming FaceTime calls on a dedicated Mac without user interaction. Since the hidden FaceTime defaults write com.Apple.FaceTime AutoAcceptInvites (a boolean)...
0
votes
0
answers
23
views
Image recognition search in Mac Finder with pre-trained ML Model
I have trained a Core ML Model (.mlmodel) using Create ML.
Now I want to use it to perform image recognition search in Mac Finder
For example, if my ML Model already contains a few classes like apple, ...
2
votes
1
answer
82
views
Why can't I use Automator to correctly target UI elements in System Preferences? [ventura]
I'm trying to use Automator to record an action on the system preferences, in the accessibility display pane. I want to change the value of the slider for the color filter intensity.
I use automator ...
1
vote
0
answers
36
views
AppleScript : use variable to call safari tab
how can I refer to a safari tab using a variable ?
this code find the tab I want across all safari windows and tabs
set winmatchlist to {}
set tabmatchlist to {}
set tabnamematchlist to {}
tell ...
2
votes
1
answer
152
views
Applescript to bring a Terminal window to front
I have a shell script which runs a long-running processes in a Terminal window.
I leave it running and work on other Terminal windows.
I'd like to be notified when the shell script finishes, by ...