Questions tagged [applescript]

AppleScript is the Mac OS scripting language.

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

How to Detect whether if this window open in macos?

I'm using an app in macOS named 'context',in short say it's a window switcher,(do some function like command + tab in system), when I opened this window, after press uparrow or downarrow, and ...
0
votes
0answers
16 views

How to append folder name recursively in Folder Actions - Automator

This might be simple, but I can't figure it out. How can I get this to run on the folder the files are dropped on? I believe I need to edit line 2 to be the folder files get dropped onto. Here is my ...
0
votes
1answer
33 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 ...
0
votes
0answers
16 views

Creating automation script to turn on and off keyboard backlight for macos

i want my keyboard backlight to automatically turn on at 7pm and off at 7am, but i couldn't found any options for that in settings of new macos. so i thought creating a automation script might do the ...
2
votes
1answer
37 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), ...
0
votes
1answer
24 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
1answer
83 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
1answer
26 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!
0
votes
1answer
36 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 ...
0
votes
2answers
79 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
2answers
65 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 ...
0
votes
0answers
12 views

macOS: How to programmatically apply color filters on the screen?

I can apply color filters using macOS settings. I want to do this programmatically. I'm okay with using private APIs (this is for personal use).
0
votes
1answer
18 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
0answers
91 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
1answer
173 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
0answers
37 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
0answers
66 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
1answer
210 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
2answers
301 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
1answer
54 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
2answers
201 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 ...
0
votes
0answers
17 views

How can I tell itunes to default to playing music on my computer?

I have an apple script that plays music and it often stalls out due to this error. Can I tell iTunes to automatically select the computer when my headphones are unavailable?
1
vote
0answers
186 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
1answer
16 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
1answer
123 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
1answer
103 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
1answer
2k 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
2answers
116 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
1answer
23 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
2answers
2k 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. ...
2
votes
2answers
638 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
1answer
190 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
1answer
121 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
1answer
216 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")...
0
votes
1answer
39 views

indesign duplicate filelink and update link

i have indesign file with image inside, how I can duplicate the original image in the desktop and relink to the copy in document? I try this code in script (but he don't duplicate the file): if(...
1
vote
0answers
57 views

How to run an Applescript at shutdown

I am trying to track the occurrences and duration of power outages. I have my computer(Mac High Sierra) powered by a UPS and set to shutdown when there is an outage. I have an applescript that when ...
0
votes
1answer
457 views

Is there a way to enter 'tab', 'function' or 'escape' keys as keyboard shortcuts for voice control Mac OS X?

I am using voice control in Catalina OS beta 5 to map various keyboard shortcuts to custom commands. Most key shortcuts like "command-f" work just fine, but any key shortcut that uses either the 'tab',...
0
votes
1answer
165 views

Automating Image format and size change

I'm a novice, trying to create a Mac OS Automator app or AppleScript that will accept images (PSD, tiff, png, jpeg) when dragged on the app's icon, convert to a different format, and resize them. I ...
0
votes
1answer
65 views

Applescript - Why killall not killing my app

My applescript's app name is "myApp", I'm just wondering why it's not killing my app after the Launch of Tableau. "on run" is working as expected, and killing the host app after launching Tableau, ...
0
votes
1answer
149 views

How to play iTunes music from from a script run from the terminal or AIML pattern?

I want to write a command that launches iTunes and play the first song that is in the playlist or song list. I can launch iTunes from my code but it doesn't start the song automatically. My AIML (...
0
votes
1answer
296 views

How can I detect/remove special characters from this short text file?

This is the contents of a short text file created by an AppleScript written by someone else: Search time: Sunday April 28, 2019 at 07:21:07 Search complete. Nothing found. But, when I use cat I get ...
0
votes
2answers
177 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 ...
0
votes
0answers
161 views

Why doesn't this MacScript return a valuable on Excel

I have the following VBA Script Dim fileName As String fileName = MacScript("choose file name") MsgBox fileName ✅ If I run the AppleScript in Script Editor, and select a pre-existing file, a path is ...
4
votes
1answer
7k views

How can I automate mouse movement in OS X via AppleScript or a shell script?

Just recently I got into an FPS game and I've wanted to challenge myself to make an anti-recoil script for a while. An anti-recoil script would essentially move the mouse based on a set of ...
0
votes
1answer
47 views

Terminal Command to get app switcher information?

The native app switcher orders the apps based on chronological focus. This ordering is useful to me for a script, but I'm not sure where this ordering information is stored. Is there a way to get the ...
1
vote
2answers
1k views

How to open a random file from a specified folder using AppleScript?

Here's the code I have now: tell application "Finder" get some file of (folder (POSIX file "Desktop/musics")) end tell
2
votes
3answers
1k views

OSX Command line Find Duplicate Filenames with different extensions

I've gone through all the similar questions + installed few command line utilities like duff but with no sucess. In my Images directory, I have images with same name but with different extensions (...
2
votes
1answer
648 views

Is there a way to programmatically open VSCode and then open the built-in terminal in VSCode on Mac?

I am trying to automate the process of opening VSCode and then opening its built-in terminal. I know I can open VSCode easily, but I don't know how I can communicate with VSCode once it is opened. Is ...
1
vote
1answer
139 views

AppleScript - filtering selection (Yojimbo)

I'm currently trying to filter a selection with Applescript. This works: tell application "Yojimbo" to set theYojimboSelection to selection but this does not:    tell application "Yojimbo" to set ...
0
votes
1answer
203 views

How to paste in safari with applescript without pasting in the actual applescript file

I recently discovered applescript and i have been eager to make an internet bot with it. I've built my bot with a memory so it doesn't search the same website twice. I want to keep my memory on google ...

1
2 3 4 5
8