Questions tagged [applescript]

AppleScript is the Mac OS scripting language.

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

How to input number in applescript, keystroke

As the picture shows, I put "01workspace" in the script, but got the "workspace" output. So I got error. So could any one tell me how to make it output correctly with "...
user avatar
  • 1
0 votes
0 answers
37 views

applescript to take screenshot

i have an apple script that takes a screenshot and saves into a folder on the desktop set dFolder to "~/Desktop/Vacation/" do shell script ("mkdir -p " & dFolder) do shell ...
user avatar
0 votes
0 answers
18 views

Faster way to send CMD+number in bash than osascript

I’m currently sending the following command in Bash (on Mac): osascript -e ‘tell application “System Events” to keystroke “$TERMINAL_NUMBER” using {command down} While this does exactly what I want. ...
user avatar
  • 1,354
0 votes
0 answers
15 views

Applescript to receive and translate keystroke

My AppleScript will launch with iTerm2 and be a window management script. It will be a little bit complex, but in essence I want it to translate CMD+<letter> to CMD+<number>. So a minimal ...
user avatar
  • 1,354
0 votes
0 answers
21 views

How can I use a double click on a tiny image in Numbers/Excel to enlarge the photo and then reduce to fit in cell again?

photos are copied into Numbers/Excel created and then resized to fit in cell. I want to be able to double click this "thumb nail" to enlarge the photo and then be able to either have it ...
user avatar
  • 1
0 votes
0 answers
23 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 ...
user avatar
  • 101
-1 votes
2 answers
74 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 ...
user avatar
1 vote
0 answers
22 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 ...
user avatar
  • 11
0 votes
1 answer
87 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 ...
user avatar
0 votes
0 answers
27 views

Starting a workspace in iTerm2 automatically on MacOS

Goal I want to have a command (running a script/hotkey/alfred workflow) to start my work day with a running workspace. I'm having trouble on the running the stack part. the goal is having 3 panes with ...
user avatar
0 votes
0 answers
42 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)....
user avatar
  • 101
1 vote
1 answer
534 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 ...
user avatar
2 votes
1 answer
98 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), ...
user avatar
0 votes
1 answer
143 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 ...
user avatar
-2 votes
1 answer
169 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 ...
user avatar
0 votes
1 answer
142 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!
user avatar
  • 3
1 vote
1 answer
122 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 ...
user avatar
  • 552
1 vote
2 answers
915 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}"....
user avatar
0 votes
2 answers
327 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 ...
user avatar
0 votes
1 answer
26 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 ./*....
user avatar
0 votes
0 answers
105 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 ...
user avatar
  • 140
1 vote
1 answer
479 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 ...
user avatar
  • 1,943
0 votes
0 answers
46 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 ...
user avatar
1 vote
0 answers
81 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 ...
user avatar
0 votes
1 answer
235 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]/[...
user avatar
1 vote
2 answers
580 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 ...
user avatar
  • 355
0 votes
1 answer
88 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 ...
user avatar
1 vote
2 answers
485 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 ...
user avatar
1 vote
0 answers
414 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 ...
user avatar
  • 465
0 votes
1 answer
20 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 ...
user avatar
  • 465
0 votes
1 answer
203 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 ...
user avatar
  • 1,943
0 votes
1 answer
139 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 ...
user avatar
  • 121
0 votes
1 answer
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 ...
user avatar
1 vote
2 answers
160 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 ...
user avatar
  • 19
-1 votes
1 answer
54 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 ...
user avatar
3 votes
2 answers
3k 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. ...
user avatar
3 votes
2 answers
1k 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 ...
user avatar
0 votes
1 answer
633 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 ...
user avatar
0 votes
1 answer
185 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. ...
user avatar
  • 1
0 votes
1 answer
295 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")...
user avatar
0 votes
1 answer
71 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(...
user avatar
1 vote
0 answers
86 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 ...
user avatar
  • 111
0 votes
1 answer
525 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',...
user avatar
  • 111
0 votes
1 answer
236 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 ...
user avatar
0 votes
1 answer
74 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, ...
user avatar
0 votes
1 answer
202 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 (...
user avatar
  • 9
0 votes
1 answer
579 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 ...
user avatar
  • 11
0 votes
2 answers
247 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 ...
user avatar
0 votes
0 answers
184 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 ...
user avatar
5 votes
1 answer
12k 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 ...
user avatar

1
2 3 4 5
8