8,873 questions
0
votes
1
answer
104
views
"<Application> is not allowed assistive access" on AppleScript application, despite enabled setting
I wrote an AppleScript that automates selection of my wireless soundbar (AirPlay) as the sound output:
tell application "System Events"
tell process "Control Center"
...
1
vote
1
answer
58
views
Python AppleScript module fails: AttributeError: 'str' object has no attribute '_unpackresult'
I have been using the AppleScript module in Python for some time now, but its latest version is refusing to work on any but the most trivial code. This is the Python script:
#!/opt/local/bin/python3
...
1
vote
1
answer
48
views
Cannot set track details in macOS Music with AppleScript
I record music at home and regularly need to add tracks created with GarageBand to Music. This requires me to manually set the artist, album, genre, year, & artwork so I'm trying to write an ...
0
votes
0
answers
75
views
"Paste" menu item is disabled when run app via applescript with administrator privileges
When running the application through apple scripts with administrator rights, the menu item "Paste" is disabled on any input fields. For example
do shell script "/Applications/Safari....
1
vote
0
answers
240
views
AppleScript Issue with current track in Apple Music
I have upgraded to macOS 26 and got this strange error with AppleScript: current track doesn't work any more for streaming content, it works only for downloaded songs in user's library.
tell ...
0
votes
2
answers
128
views
Import a folder in Photos while making albums with subfolders
Thanks to codez on GitHub who provided an Apple script to import a folder in Photos making proper Albums of all subfolders.
Nevertheless it’s not maintained anymore and the script have few bugs I can’...
1
vote
1
answer
104
views
Improve Speed of AppleScript that Opens Multiple Folders in Multiple Tabs in new Finder Window?
I have a series of subfolders with a parent folder called "Inventory" within a internal hard drive.
Each subfolder name consists of a number, a hyphen and some text, such as:
"329 - ...
0
votes
0
answers
45
views
Equality between objects in Applescript and JXA (trying to find the current slide in Keynote)
I am trying to find what is the selected slide in the active Keynote presentation via scripting. Just using the slide number does not work, because it's -1 on ANY hidden slide.
Things work ok in ...
1
vote
2
answers
179
views
Find bluetooth connected devices battery level through Apple Script
I'm making a swift app that shows the battery level of all connected bluetooth devices.
I've got three devices connected: Mysz(name surname), Magic Keyboard (name), i12; where Mysz is just Magic Mouse....
0
votes
1
answer
58
views
Applescript error: Can’t get file (test.csv)
I have the following AppleScript that checks whether the file test.csv exists on the desktop. When I run the code, the following message appears: Script Error: Can’t get file ‘Macintosh HD:Users:adam:...
0
votes
0
answers
57
views
How can I open a Mail Attachment on macOS 15.5 Sequoia?
I am looking for a script to open the (pdf) attachment of a (new) eMail using Mail 16.0.
I tried this AppleScript and hoped it would open the attachment, but nothing happens:
tell application "...
0
votes
0
answers
24
views
Inaccurate row column counts returned to AppleScript by Numbers spreadsheets when Category grouping is used
I have a Numbers spreadsheet that I group according to the data of a couple of
columns. For example I group according to the year included in a Date Purchased column well as an Account column. When ...
-1
votes
1
answer
82
views
How can AppleScript send a keystroke to a window deep within a group hierarchy?
I've written a number of AppleScript programs over the years to send keystrokes to various applications. It is usually as simple as:
tell application "TextEdit" to activate
delay 0.5
tell ...
0
votes
1
answer
108
views
Process a .gcode/txt file to extract data into a .csv file with Applescript
Here's what I'd like to do: Process a .gcode file to extract certain data and then create a .csv file containing all this data.
For your information, this .gcode file is used on a 3D printer or laser/...
0
votes
2
answers
65
views
Copy and rename a file with AppleScript without changing its extension
This applescript allows me to extract the text I'm interested in from a .gcode file but actually creates a copy of the file before modifying the original file. I would like to save the file without ...
0
votes
0
answers
83
views
How can I set a variable in a Mac OS Automator app or quick action
I have limited experience with applescripting and the automator app, but have been able to cobble things together before that generally do what I need after a bunch of trial and error.
I'm helping ...
0
votes
3
answers
90
views
Select all lines starting with ";" with Applescript
I'm trying to create an applescript that would allow me to clean up a .gcode file by removing all lines that don't begin with a semicolon ";"
Here's a small example of the gcode file:
; ...
0
votes
0
answers
50
views
Apple script looping gives invalid index
I have an fairly simple apple script. I get some random number of windows so I loop through all the windows to find the window I am looking for, then do some stuff on the window. The first three ...
0
votes
1
answer
155
views
How to create a note with a checklist in Notes on macOS from script
I am trying to create AppleScript that will generate note in Notes with a checklist. I found a bunch of examples like this:
tell application "Notes"
activate
set newNote to make new ...
0
votes
1
answer
104
views
How do I enter a date in Applescript in order to create a calendar event?
Trying to script new calendar events for use with Raycast (which is limited in that it can't add 0 duration or all day events, can't add alarms.)
The following code results in
error "Calendar ...
0
votes
2
answers
97
views
AppleScript - open Screenshot app and start recording screen (Mac mini M4)
I need to record the screen using the Screenshot application. This script launches the Screenshot app, but it does not start recording:
tell application "Screenshot"
activate
end tell
...
0
votes
1
answer
63
views
AppleScript - open Screenshots app (Mac mini M4)
I need to open the Screenshots application using AppleScript. I have an Apple Mac mini M4.
My code does nothing. No error.
tell application "System Events"
keystroke "5" using {...
0
votes
1
answer
70
views
How to add a folder to an existing folder (mailbox) in Apple Mail with Applescript?
I'm trying to compile a script that add a new subfolder to an existing subfolder in Apple Mail.
It's important the script can specify the account ("Events"), as I have many, and it should ...
1
vote
1
answer
150
views
Apple script failing after 15.4 update
After a bit of frustrating effort I finally got a simple AppleScript to work with help here. Now that Sequoia has been updated this script fails again. Different reason but it's failing. This is ...
2
votes
1
answer
126
views
Applescript shut down issues
I'll apologize upfront for posting another dang question/problem with an AppleScript shut down app. I must have read 1,000 threads relating to this topic.
Sequoia 15.3.2
2025 Apple M4 pro
I've pared ...
0
votes
1
answer
92
views
Adding multiple images and text to Pages via Applescript
I need to automate adding multiple images with title text to an Apple Pages document. My assumption is that I need to use AppleScript to do this.
So far I've tried things like the following:
tell ...
0
votes
1
answer
41
views
JQ not recognized by AppleScript
I have a daily journal I create in Devonthink3, and as part of the note creation, I add that day's weather and the forecast. I ran this fine for about 90 days, but had to wipe the computer and reload ...
1
vote
1
answer
70
views
AppleScript - Deleting selected files and folders whose filename contain a certain string
we work with template files (generally psds), all saved together in folders, that have a generic name.
We copy them and remove the ones not needed for the project, and mass rename the generic string, ...
0
votes
1
answer
133
views
Embedding AppleScript in Bash Script
I have a working AppleScript for pinning a given app the dock:
set theAppPath to "/Applications/Adobe Acrobat Reader.app"
try
set theShellScript to "defaults write com.apple.dock ...
0
votes
1
answer
45
views
Identifying OSA button push with bash
I am trying to determine which button was pushed in an OSA generated dialog using bash conditionals. However, no matter which button is pushed, the restart command always runs. Any thoughts?
#!/bin/sh
...
0
votes
0
answers
21
views
How to delete a mac music library iCloud track from the library using apple script
I have a mac music library consisting of local MP3s and iCloud tracks, which are online only or saved encrypted as an M4a file (if I chose to keep the locally). I want to delete any given iCloud track ...
1
vote
1
answer
68
views
Fetching contact's birthday in Apple Script
I am trying to fetch the birthday of a contact in the contacts list, on Mac.
tell application "Contacts"
set firstContact to first person
set contactName to name of firstContact
...
0
votes
1
answer
75
views
Applescript - targeting a menu with numeric ID
I'm a noob at Applescript, but managed to get the first half of this script to just display the menu. The image is a mouse hover to display the UI Browser result. The syntax for clicking on a menu ...
0
votes
1
answer
55
views
Generating new mail message with specified sender leaves wrong BCC recipient
I try to automate composing a mail with specified "to:" address, sender account and content including an attachment. I found the following AppleScript snippet I use from within a Bash script:...
0
votes
0
answers
69
views
Why is my AppleScript not working as intended in Hammerspoon?
This is my literal first time coding anything in AppleScript / Hammerspoon.
So I want to make an AutoClicker to stress test my website. The website is simple enough; it has a button for me click, ...
0
votes
0
answers
39
views
Detect stream in Firefox
I try to detect if a stream is active in Firefox by Applescript or bash. But I can't see any way to do that. I need to know from Firefox if any video or audio stream is present.
I tried Applescript:
...
1
vote
2
answers
101
views
Can an AppleScript dictionary be created programmatically?
I was looking at the Apple Foundation scripting API. I got fascinated by NSScriptSuiteRegistry and the other parts of of the dictionary sub-API. The description even says that the functions that read ...
1
vote
1
answer
49
views
Export all .pages files from one folder to pdf in another folder
Here is my script
set docsFolder to choose folder with prompt "Select the folder containing Pages documents:"
set pdfFolder to choose folder with prompt "Select the folder to save PDFs:&...
-1
votes
1
answer
118
views
AppleScript and Numbers - adding rows
In numbers I have columns with data like this:
I want to iterate through cells and for ex. if value of cell in row 6 is not equal to value of. cell in row 5 then add an empty row above the row 6 (...
1
vote
0
answers
203
views
what does error number -1721 mean in apple script?
**I'm working on this script to send messages to all the phone numbers from a csv
that's how I formatted the csv **
Phone Number,Message
+16478xxxxx,Hi this is a test text me back if you have ...
0
votes
1
answer
95
views
Populate Cc field using AppleScript
Following syntax generates email message in apple mail addressed "To" a recipient. Requesting guidance on how to populate the Cc field with 3 additional email addresses. Thanks.
tell ...
0
votes
1
answer
64
views
Return Capitalized String But Ignore Specified List of Common Words (a, and the, etc.) - AppleScript, Python Via Shell Script
This Applescript capitalizes multiple listing title textfield within GarageSale.
The program's built-in menu requires you to manually select one at a time and use the menu selection Edit > ...
0
votes
0
answers
21
views
Applescript to send SMS
I use an application named “EventScripts” that will monitor my bluetooth signal and trigger an applescript when the bluetooth signal is lost. I’ve written a short script that locks my computer when ...
0
votes
1
answer
52
views
Automating replacing fonts in keynote using python. I am stuck and frustrated at this point
I have tried replaceing all the fonts in keynote using Format/fonts/replace font. But automating it using python. My code is working until opening the replace font dialogue box but after that it can't ...
0
votes
0
answers
41
views
Hot folder on file add copy to folder on shared drive with AppleScript
I am trying to write a script I can attach to any folder that when I copy or save an item into it, it will make a copy into a separate folder. Both of these folders exist on a NAS. This script seems ...
0
votes
0
answers
59
views
applescript - processing Chrome windows
I've written an AppleScript containing 2 parts:
part1 cycles through all Chrome windows and sets the given name - this works as expected
part 2 wraps tries to do a similar thing but processes windows ...
0
votes
0
answers
110
views
Automate clicking a button in iOS Simulator using AppleScript from Mac OS
I have problems accessing the specific button element to perform a click. When I view the Hierarchy using Accessibility Inspector, I see the following
Simulator (application) [SimulatorApp]
iPhone ...
1
vote
1
answer
94
views
AppleScript Replace All HTML Character Codes in HTML String with Characters
I am converting html text to plain text and need to replace the HTML character codes with the actual characters the code represent.
The following sample code does that for two character codes, but ...
0
votes
0
answers
78
views
Can't access UI "section" in AppleScript
I'm trying to make an automation that adds people to a FaceTime call. I tried using Accessibility Inspector to find where the + button is in the UI.
I'm don't know much AppleScript, so I just copied ...
0
votes
1
answer
130
views
How do I interact with the macOS share sheet?
I'm trying to make some AppleScript code that creates a FaceTime link and copies it the the clipboard.
I've gotten it to click the create link button, but I can't figure out how to click the "...