Skip to main content

Questions tagged [applescript]

AppleScript is the Mac OS scripting language.

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

How to allow macOS application to run as root with preserving the user environment?

How to allow macOS application to run as root with preserving the user environment? Or ideally run the app as it is launched from terminal as sudo. I have macOS application with GUI, MyApp.app and I ...
Martin's user avatar
  • 1
1 vote
1 answer
71 views

Use Vim to edit Applescript file

Is it possible to use Vim to work on applescript files rather than the default Automator or Script Editor program? I searched the webs and couldn't find the same question or an answer anywhere. I ...
Jimmy Long's user avatar
2 votes
0 answers
205 views

How to quick record system audio in background on macOS?

On macOS Monterey I want to achieve what can be done on Windows with ShareX: record system audio with a global hotkey and have the audio file automatically copied to the clipboard – all in the ...
user0145's user avatar
0 votes
1 answer
207 views

Running App as root using Apple Script?

I am trying to use an Apple Script to run an application as root without asking for password all the time. I used this Apple Script code: do shell script "/Applications/MyApp.app" user name &...
Codename K's user avatar
0 votes
0 answers
29 views

Trying to use Applescript variable in curl command inside do shell script for phone calls

i have no clue at all but i'm quite desperated... i try to use the follow apple skript establishing a call on my snom desktop phone. when i put the link directly in the browser it works fine. but ...
Sascha's user avatar
  • 1
1 vote
1 answer
313 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 ...
Brigadeiro's user avatar
0 votes
0 answers
12 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 '...
Rob's user avatar
  • 1
0 votes
1 answer
289 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 ...
rabin's user avatar
  • 1
0 votes
0 answers
100 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 ...
Carloudidlidou's user avatar
0 votes
0 answers
108 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 ...
GJ.'s user avatar
  • 9,903
2 votes
2 answers
563 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 ...
11100100's user avatar
1 vote
0 answers
78 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 ...
Catyre's user avatar
  • 11
1 vote
1 answer
190 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 ...
DasKraut's user avatar
0 votes
0 answers
252 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 ...
chrisnhamp's user avatar
0 votes
0 answers
190 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 ...
Will Hamon's user avatar
0 votes
0 answers
60 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 ...
raphael's user avatar
0 votes
0 answers
34 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 ...
p7adams's user avatar
  • 101
-1 votes
1 answer
101 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 ...
Hanan Cohen's user avatar
1 vote
0 answers
74 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 ...
neff's user avatar
  • 11
0 votes
1 answer
2k 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 ...
Nikolay's user avatar
0 votes
0 answers
139 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)....
pajczur's user avatar
  • 101
1 vote
1 answer
3k 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 ...
Ahmad Al-Mutawa's user avatar
3 votes
1 answer
579 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), ...
Larvus Koji's user avatar
2 votes
1 answer
1k 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 ...
Larvus Koji's user avatar
-2 votes
1 answer
599 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 ...
TOKI's user avatar
  • 1
0 votes
1 answer
658 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!
James's user avatar
  • 3
1 vote
1 answer
772 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 ...
d-b's user avatar
  • 1
2 votes
2 answers
5k 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}"....
Anthony0076's user avatar
0 votes
2 answers
1k 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 ...
captaincustard's user avatar
1 vote
1 answer
56 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 ./*....
Watzaum's user avatar
  • 11
0 votes
0 answers
229 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 ...
BlkPengu's user avatar
  • 140
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 ...
MikMak's user avatar
  • 2,107
0 votes
0 answers
57 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 ...
Abu Sayeed Mondal's user avatar
1 vote
0 answers
200 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 ...
postsoundmixer's user avatar
0 votes
1 answer
430 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]/[...
gebseng's user avatar
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 ...
John's user avatar
  • 415
0 votes
1 answer
173 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 ...
User123456789's user avatar
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 ...
Bumbie03's user avatar
1 vote
0 answers
848 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 ...
Cauder's user avatar
  • 754
0 votes
1 answer
143 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 ...
Cauder's user avatar
  • 754
0 votes
1 answer
398 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 ...
MikMak's user avatar
  • 2,107
0 votes
1 answer
271 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 ...
Evert's user avatar
  • 131
1 vote
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 ...
Solmyr87's user avatar
1 vote
2 answers
455 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 ...
Emerfin's user avatar
  • 19
-1 votes
1 answer
642 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 ...
Alexander Mills's user avatar
3 votes
2 answers
7k 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. ...
Nicholas Adamou's user avatar
3 votes
2 answers
3k 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 ...
Nicholas Adamou's user avatar
0 votes
1 answer
2k 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 ...
Nicholas Adamou's user avatar
0 votes
1 answer
552 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. ...
liuk's user avatar
  • 1
0 votes
1 answer
477 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")...
iglooooooo's user avatar

1
2 3 4 5
8