Questions tagged [applescript]
AppleScript is the Mac OS scripting language.
394
questions
4
votes
2
answers
5k
views
OS X control volume with keyboard
I'd like these keybindings:
Cmd + PageUp = volumeUp
Cmd + PageDown = volumeDown
I followed these instructions:
Creating a AppleScript script worked fine, but it is impossible to set Cmd + PageUp ...
0
votes
2
answers
8k
views
Applescript to close box by hitting ok automatically
I need to create a script that automatically closes a popup box that opens approximately every 55 - 65 seconds. Once the box opens, you merely hit OK (within the box) and it closes.
I created an ...
1
vote
2
answers
4k
views
LaunchAgent plist to keep an app running and hiden
I'm using the following script
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist ...
1
vote
0
answers
31
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 ...
8
votes
7
answers
36k
views
Open new terminal tab and execute script
I need to merge two osascript scripts, so that with one command I can open a new terminal tab and execute a script like echo hello into that new tab.
This one opens a new terminal tab.
osascript -e '...
2
votes
0
answers
106
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 ...
0
votes
1
answer
3k
views
Replace all illegal characters from folders, subfolders, and files in my Dropbox folder
Our office uses dropbox on Macs to organize our design projects. For several years, many of these files and folders were being saved with characters that are illegal on Windows OS. We have some ...
2
votes
1
answer
4k
views
How do You Open the Contents of a Folder with AppleScript?
I am currently using this UNIX shell command in my script file:
do shell script "open ~/Dropbox/Media/VisionBoard/*"
Is there another way to do it and if so would it be any better or different? I'm ...
0
votes
0
answers
134
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 &...
0
votes
0
answers
24
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 ...
4
votes
4
answers
11k
views
Automatic PDF renaming based on title
I have thousands of scientific PDFs that i need to rename, many do not have metadata. I would like to be able to create an automator action that could open a folder then open each PDF, copy the title ...
1
vote
2
answers
5k
views
Mouse movement vertical axis inversion? (Mac OS X)
I would like to either run an AppleScript or use a Terminal command to invert the y-axis for mouse movement in OSX— and no, not like http://d.pr/w9z7 (/joke). Any ideas? I thought about checking for ...
1
vote
1
answer
180
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 ...
4
votes
4
answers
6k
views
How to open a new Firefox window with Terminal
I am running Firefox v10.0.1 with OS X Lion v10.7.3
From the Apple dock, you can right-click on Firefox icon and choose NEW and a new Firefox window will open.
From terminal, I have tried
open -...
0
votes
0
answers
11
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
2
answers
3k
views
Inserting Keynote slides into a Pages document
I have a number of training documents which are formed from a word processor file and a slideshow. I'd like to be able to keep them together, ideally by inserting the slides from Keynote into Pages. ...
19
votes
4
answers
21k
views
How do I set up an AppleScript to open a new iTerm2 tab and change the directory?
In OS X, how do I set up an AppleScript to
open a new iTerm2 tab
change to a directory
clear the console
echo the current directory
I had something like this before for regular Terminal, but I can'...
0
votes
1
answer
227
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
87
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
97
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 ...
2
votes
2
answers
406
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 ...
1
vote
0
answers
74
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 ...
2
votes
3
answers
2k
views
Is it possible to grab and store the returned window id of a terminal opened through applescript or bash?
I have been working on this "dashboard" to help control my localhost server environment. It has been scripted in bin/bash for reference. I recently discovered I can use the bin command "osascript" to ...
2
votes
1
answer
531
views
How to open iTerm2 version 3 in Forklift
I am looking for a solution which can open iTerm2 version 3 as the default terminal. For iTerm2 version 2 there were multiple AppleScripts on the internet which worked well for opening the current ...
1
vote
1
answer
177
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
190
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
166
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 ...
1
vote
2
answers
2k
views
Open Terminal with predefined tabs
Is there any way to open Terminal with predefined tabs?
I have 5 most common paths that I usually use and I want Terminal to open with these paths opened in different Tabs.
I guess this should be ...
1
vote
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}"....
24
votes
7
answers
15k
views
Programmatically set the color of a tab in iTerm2?
My daily workflow includes me
Launching iTerm2
Creating 3 tabs
Setting one tab each to red, orange and yellow
Changing to a specific path in each tab
I would like to script this process; shell, ...
11
votes
6
answers
11k
views
How do you duplicate current open Finder view in new tab (Mavericks)?
In a thread on this forum there is an interesting solution on how to open a duplicate of an already open Finder window with the help of an AppleScript:
How do you duplicate current open Finder view?
...
8
votes
1
answer
8k
views
Applescript to connect to bluetooth device
I'm trying to create an applescript to allow me to connect to a bluetooth device by it's Bluetooth ID.
So far, i've managed to get an applescript to turn on bluetooth if it's off. Here's the code:
...
0
votes
0
answers
56
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 ...
1
vote
1
answer
3k
views
AppleScript + Quicktime: Start and stop a movie recording and export it to disk
Attempting to start a screen recording, wait a few seconds, stop the recording and export saved recording to disk.
Versions
AppleScript 2.2.4
QuickTime: 10.2
AppleScript
set filePath to "" & (...
0
votes
0
answers
31
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
100
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 ...
5
votes
2
answers
2k
views
Mac screenshot of a specific window without using the mouse/click
I've been researching for a day or two but can't find a method to take a screenshot of a specific window (possibly the only window) open at a specific time using an Apple script.
Currently I have the ...
2
votes
1
answer
615
views
Different Wallpaper if two monitors are attached
I am working on my MacBook Pro. In the office I have 1 27" Monitor attached to it, at home I tend to work without an second monitor. For that setup I want to change the wallpaper if no 2nd monitor is ...
1
vote
0
answers
67
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 ...
1
vote
2
answers
634
views
How do I click on "Call Using iPhone" using Accessibility Inspector's Hierarchy?
Here's the AppleScript code:
set phone_num to "1111111111"-- (put your own number here)
tell me to activate
display dialog "" buttons {"FaceTime", "Call", "Cancel"} default button 2 with icon path to ...
0
votes
1
answer
1k
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
2
answers
995
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 ...
21
votes
5
answers
38k
views
Execute AppleScript without opening the editor
Every time I want to run an AppleScript the editor pops up.
Is there a way to run it directly?
0
votes
0
answers
123
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)....
17
votes
9
answers
16k
views
MacOS X: How to have a handy "Open this folder in iTerm" shortcut?
I think the title states exactly what I want to do. I want a shortcut or even a button within Finder which fires up a new iTerm Tab and changes the location to the location I've open in Finder. Some ...
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 ...
4
votes
5
answers
8k
views
Applescript to lock the screen
I need a little Applescript to lock the screen, the same behaviour I get when I click the Keychain icon in the menu bar and choose "Lock screen".
I found a way to activate the screensaver, but it's ...
0
votes
2
answers
361
views
How can I display the remaining time of a Spotify song on my Touch Bar?
Currently, I'm using BetterTouchTool (BTT) to automate tasks.
I was wanting to make a script that would display the time a song has left (in MM: SS format) as a label on my Touch Bar.
Here's what I ...
3
votes
1
answer
514
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), ...
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 ...