Questions tagged [applescript]
AppleScript is the Mac OS scripting language.
395
questions
0
votes
1
answer
31
views
How to execute three terminal scripts in three new tabs from Applescript?
I have the following apple script top execute three commands in different terminals. Is it possible to (1) combine this script to make it more efficient and (2) open in different terminal tabs instead ...
0
votes
0
answers
7
views
MacOS Mail called from applescript flashes window, how to mitigate
I have an applescript which mails to recepeints set in a file, with the body in another file. When I start the message to be sent flashes in a window on the screen.
How can I make the execution '...
0
votes
1
answer
93
views
How do I make an applescript that waits for an application to start then quits the application?
I want to make an applescript that when started, will wait for an application to open then quit out of that application.
Here is my code:
repeat until application "Steam" is running
...
0
votes
0
answers
48
views
Applescript to extract XML tag value from a folder of files to a text file
I'm looking into a way to extract the values of a XML tag from a lot of file in a folder with subfolder... and save the tag value and the filename in a text file...
The value tag I need is from ...
0
votes
0
answers
32
views
How to get mic/camera permissions to persist for an AppleScript application?
I have an AppleScript app that's running a shell command that requires mic and camera permissions. Every time I run it, I again see the OS dialog "App would like to access the microphone/camera.&...
0
votes
0
answers
56
views
How to automatically move a window to secondary display on MacOS?
At the end of recorded Zoom calls, a transcoding window appears for a long time, floating above all other Windows. Quite a nuisance.
I'm looking for some automated solution, eg an AppleScript that ...
0
votes
0
answers
17
views
AppleScript Not Finding file
No matter what I have tried it continues to say "missing!". I have tried really simple solutions and I always get a path which in Terminal will exist but my applescript can't see?
tell ...
1
vote
2
answers
147
views
How to handle triple-nested quotes in Zsh? [duplicate]
I've been setting an alias that running Apple Script on Terminal. As below:
alias playda="osascript -e 'tell application "QuickTime Player"
activate
set thisFile to open POSIX ...
0
votes
0
answers
188
views
Neovim cannot find various executables when launched through an applescript
I am using MacOS Monterey and am attempting to create a means through which I can double-click a program file in Finder and have it open in neovim. To do this, I need to launch nvim through an ...
1
vote
0
answers
47
views
Applescript cannot find file that exists
Big picture, I am trying to create an applescript that allows me to open files in neovim from Finder. Though I have found several resources for doing this, none work exactly as-is, so I have to do ...
0
votes
0
answers
76
views
The action “Run AppleScript” encountered an error: “sh: ./temp.csv: Read-only file system
Here's my Automator job:
The most relevant lines would seem to be:
do shell script "awk -v timestamp='" & timestampText & "' 'BEGIN {OFS=\",\"} {print timestamp,$0}' &...
0
votes
0
answers
81
views
Is there a way to programmatically open a NEW built-in terminal in VSCode on Mac?
Assuming VSCode is already open, does anyone know of a way to programmatically open a new terminal in the currently focused VSCode window, either from an AppleScript or some other way?
1
vote
1
answer
103
views
AppleScript pass shell output list to "choose from list"?
I'm writing a simple AppleScript to use in an Automator app that asks a user to select from a list of available Backblaze B2 buckets, with the goal of passing that selection into the shell script that ...
0
votes
0
answers
126
views
Running shell script with find command returns double slashes in file paths
I have cobbled together an Applescript that returns a list of the full posix filenames of all of the files in a directory (and all subdirectories). It runs the 'find' command in a shell script. The ...
0
votes
0
answers
96
views
Show desktop in Applescript - help required
I'm looking for some help with the below please. I want to create a script to replicate windows' 'show desktop'. It's not working, can someone please help?
I'd then like to save it in my dock so I can ...
0
votes
0
answers
21
views
How can I keep the cursor focus on terminal when start a GUI binary file in terminal
There has a GUI program binary file. I start in terminal like path/to/binaryfile some args. then it will generate a GUI window in frontend and my cursor in this window. I want to keep the cursor ...
0
votes
0
answers
27
views
MacOs - Show notifications summary when do not disturb mode is disabled
The problem
I suffer from Slack and e-mail notification distractions at work. Currently, I have the "do not disturb" mode enabled for 8 hours a day, which covers my work time. It work's ...
-1
votes
1
answer
94
views
How to easily manage unique values for a column in Excel/Google sheets?
This feature is very common in web application but I could not find a similar solution in Excel.
I manually enter metadata for different publication. One column is the publisher.
I want to have a drop ...
1
vote
0
answers
48
views
iTunes Smart Playlist... comparing values across playlists?
I'm not entirely sure this is possible at present, though I am tantalizingly close! Maybe with "nested" criteria for the smart playlist...?
I'm a keen editor / remixer of tracks. Every time ...
0
votes
1
answer
940
views
How can I app launcher with argument "--without-update" in Mac OS, Please?
Don't work:
#!/bin/sh
/Applications/Rambox.app --without-update
Result:
error "Can’t make missing value into type real."
$ /Applications/Rambox.app --without-update
Result:
error "Can’t ...
0
votes
0
answers
99
views
How to operate Packages and Inno Setup by script?
I am new in scripting. And I would like to automate my deploying process. And now I am trying to write script which will compile and build installator file by OSX Packages (and for Windows Inno Setup)....
1
vote
1
answer
2k
views
How do I emulate "play/pause" button keystroke in Applescript (Big Sur)
I am running Big Sur and using Apple USB keyboard with arrow keys and numpad, and have function keys F1, F2, F3,... F19
The key (F19) is located on the top right corner. I am interested in assigning ...
3
votes
1
answer
310
views
Is it possible to virtually dim the brightness of a single window/app?
So that apps with dark mode are unaffected but apps without darkmode can be virtually dimmed. I have apps that virtually dim the screen (I think they just apply a dark color filter/tint onto screen), ...
1
vote
1
answer
617
views
can you set keyboard shortcut to toggle a System Preferences setting on mac
I very frequently have to go into System Preferences to toggle a trackpad setting or change the display color settings inside accessibility. I can't seem to find a way to be able to do these through ...
-2
votes
1
answer
510
views
Can't figure out how to get results of an AppleScript to print to a text file
The code below works. It returns the list variable in the results tab of the script editor. I want to write that to a text file.
set A to text
set B to text
set C to text
set D to text
set E to text
...
0
votes
1
answer
504
views
Block application/trigger applescript on app open
Is there a way to run a simple tell application quit, when a specific application is opened.
For example, if I open spotify, is there away to trigger a script to quit the app.
Thanks!
1
vote
1
answer
481
views
Stable way to transfer mails between GMail account? Thunderbird fails
I want to transfer ≈ 500 mails between two GMail accounts, from A to B. The mails are quite big, on average 5 MB or so. They span 10 years and I have split them into separate mailboxes (labels) by ...
1
vote
2
answers
4k
views
How can I batch convert a directory of subfolders from FLAC to ALAC?
Right now I'm converting each folder in Terminal manually using the following command,
for i in *.flac; do echo $i; ffmpeg -i "$i" -y -v 0 -vcodec copy -acodec alac "${i%.flac}"....
0
votes
2
answers
770
views
How to delete Safari cache using AppleScript?
I searched this forum and I can only find how to delete history! Yet, I am interested on how to delete cache from the "Develop" menu. I do not wish to "reset" Safari neither!
I am ...
1
vote
1
answer
45
views
Add a directory of multiple files to iTunes library with Terminal?
Based on this post How can I add a file to iTunes, from the command line, without playing the file which works I want to add multiple files not one.
I tried with adding a loop and a find:
for f in ./*....
0
votes
0
answers
176
views
How do I disable the option + space full screen slideshow shortcut?
I want this shortcut to run an apple script to open a new iTerm window.
I can't when I use the shortcut in Keyboard > Shortcuts > Services it does not register, and I think it's because it's ...
1
vote
1
answer
1k
views
Can AppleScript detect if a text entry field is active/focused within an active application?
I have a number of shortcuts that I am using via QuicKeys and AppleScript to perform various functions in a focused application. Certain shortcuts, such as individual alphanumeric keys and the ...
0
votes
0
answers
49
views
How do I sort folders by comment in Mac using AppleScripts?
I have folders in this order:
content
forms
gallery
header
misc
navigation
slider
title
I want to sort them this way:
navigation
header
content
title
gallery
slider
forms
misc
I have seen ...
1
vote
0
answers
156
views
AppleScript Quick Action Services Shortcut issue - MacOS Catalina
Running on: MacOS Catalina 10.15.5
I made a Quick Action in Automator and it works just fine. In fact, I've been using it for a few years. The code in the action itself is not the problem, nor is it ...
0
votes
1
answer
382
views
Correct syntax for finder path in Applescript
I'm in the process of modifying an Applescript script in Catalina. The script has this line:
set p2d to path to desktop as text
How do I change "desktop" to "/Users/[username]/[...
1
vote
2
answers
1k
views
AppleScript use Safari window ID to create new tabs
I have an AppleScript that creates a new Safari document, then opens multiple URLs in that window using a repeat loop. I would like the script to continue using the same window even if it's not the ...
0
votes
1
answer
150
views
Automator/Terminal/Apple Script: Fetch data from macos console app
I want to use automator or terminal to fetch data from the mac console app.
In particular:
If you search for "sleepwake" in the console app › tab "Mac Analytics Data", you get the ...
1
vote
2
answers
1k
views
How to use AppleScript to run any app as root?
I write some AppleScript to run "Turbo Boost Switcher" as admin and save it as appication so i can launch it with root access without typing password. also add my moded script it into login ...
1
vote
0
answers
681
views
How do I switch spaces without using `keystroke` with Apple Script?
I'd like to run an apple script that follows these steps-
Make a web browser full screen
Open another application which disables my keyboard
Return to the web browser
When I make the web browser ...
0
votes
1
answer
95
views
Can I de-activate my keyboard with apple script?
I'd like to run an apple script that will temporarily disable my keyboard from registering keystrokes.
My goal is to make it so that my computer is logged in, but unable to type anything.
I'm ...
0
votes
1
answer
307
views
AppleScript to enable/disable something during Remote Desktop usage - SOLVED
I've tried to make this script/app work myself, but can't figure it out. Basically, I am trying to enable/disable the functionality of SensibleSideButtons (SSB) based on whether or not I am actively ...
0
votes
1
answer
212
views
I accidentally corrupted a plist file belonging to the speech synthesis server, how do I fix it?
I was trying to write an AppleScript that would recognize the language of a selected text, and then set the speech synthesis voice accordingly and then let my Mac speak the text out loud.
This is how ...
0
votes
1
answer
4k
views
Hotkey to change Mic volume on Mac OS X?
I'm wondering if there is a way – perhaps via Applescript – to assign a keyboard shortcut to raise the volume of the microphone by 10 e.g., and then the other way: another keyboard shortcut to lower ...
1
vote
2
answers
364
views
Applescript won't move onto next instruction without ending shellscript?
I'm a new user to Applescript and programming in general.
I'm trying to create a script that will 1) load a Renpy project through the terminal and 2) then move the resulting project window to a ...
-1
votes
1
answer
195
views
How to create system notifications for Macbook Prof / MacOS
For Ubuntu it's easy to create a desktop notification:
https://askubuntu.com/questions/187022/how-can-i-send-a-custom-desktop-notification
it looks like:
$ notify-send "Hello world!"
on MacOS, I am ...
3
votes
2
answers
6k
views
How do I target and close a specific Terminal window in AppleScript?
Background
Given the below terminal script, I want to modify the osascript so that instead of targeting the front window I am targeting the specific window that is opened from the AppleScript.
...
3
votes
2
answers
2k
views
How to get the pid of a opened Terminal window in MacOS?
Background
I want to obtain the pid of a specific Terminal window.
ps -A | grep -w Terminal.app | grep -v grep | awk '{print $1}'
However, the above grabs the pid of the entire application and not ...
0
votes
1
answer
1k
views
How to close a Terminal window using bash and AppleScript without using SystemEvents?
Background
I am trying to create a script that when executed, opens a new Terminal.app window executes the desired commands and closes the window when complete.
One solution was to use SystemEvents ...
0
votes
1
answer
422
views
toggle iCloud preferences from terminal or applescript
I'm looking for a script to toggle iCloud preferences in system preferences.
I need to automatically uncheck all the voices (Photos, Mail, Contacts, etc) leaving only iCloud Drive and Find My Mac.
...
0
votes
1
answer
433
views
Applescript: How to open a random file from a specified volume? (.dmg location)
Ok so if I want to open a random file from a folder on my Mac, I can use the following script succesfully:
tell application "Finder"
open some file of (folder ("Users:chris:Desktop:photoAlbum")...