Questions tagged [applescript]

AppleScript is a proprietary programming language in macOS to control and exchange data with applications.

Filter by
Sorted by
Tagged with
4
votes
3answers
115 views

Automatically Delete Files From Downloads Folder Daily Unless Tagged With “Keep”?

How can I automate the deletion of files from my downloads folder but keep files I've tagged with "Keep"? I've been able to use Automator to delete files daily, but I can't work with tags in ...
1
vote
0answers
19 views

How to automate find and replace in numbers with a predefined list?

How can I automated find and replace in a Numbers file based on a predefined master list? For example, I want to find and replace all: "ABC" to "XYZ" "123" with "...
0
votes
0answers
13 views

Program notifications with the style of Volume and Brightness banner

Using Applescript it is very easy to send Notifications on Mac Clients. With other Libraries you even get more functionalities. But is there a way to program the notifications/alerts such that they ...
0
votes
0answers
19 views

mail.app separate rules for different mail accounts

I have about 10 different mail accounts, connected to mail.app. I want to use separate rules for different accounts. By default, rules apply to all accounts, and if one want any rule to be applies to ...
0
votes
0answers
7 views

Partitioning a List using a List [migrated]

I'm working on a project which requires me to partition a list using a list. I've created a solution which works in some situations, but not every situation. Is anyone able to help me with the logic? ...
0
votes
0answers
43 views

Script that efficiently listens for changes in Do Not Disturb status

Is it possible to create a script (e.g. applescript) that would listen for changes in DND status and do some actions on each change? Most examples describe how to change DND status but not how to ...
0
votes
1answer
45 views

Copy a table in a Microsoft Word document, using AppleScript

I have several hundred MS Word documents containing a single table in each. I need to copy the table, paste into Preview and save as jpeg. I can get Word to find the table, but cannot get the "...
1
vote
1answer
24 views

Is there a way for the host of a Zoom meeting running the Zoom app on a Mac to admit everyone from the waiting room via keyboard not mouse?

If I am the host of a Zoom meeting and people arrive at the meeting late and I want to admit them to the meeting without interrupting the flow of my presentation, is there any way to "Admit all ...
0
votes
0answers
24 views

How to create and send “move folder to trash” AppleScript message to the Finder using C or assembly?

How to create and send "move [folder as FSSpec record] to trash" script to the Finder application using C or (PowerPC or 680x0) assembly language? I did a PBCatSearch (1) and got a dozen of ...
0
votes
1answer
48 views

How to properly (quickly) iterate over Reminders using AppleScript/osascript?

What is the proper, efficient way to iterate over Reminders using AppleScript? The script below works as expected, but takes 18 seconds to iterate over 180 Reminders when run from the command line ...
-1
votes
0answers
27 views

Insert the current date and time (in ISO 8601 format) into focused macOS application? [closed]

I'm trying to find a way to enter the current date and time in ISO 8601 format into any application (i.e. whichever app is focused) e.g. by typing a global keyboard shortcut. I've tried searching for ...
1
vote
2answers
52 views

How to convert AppleScript URL type to string?

In AppleScript, I can cast some variables (e.g., the clipboard), to the built-in URL type: set theURL to the clipboard as URL If my clipboard contains an RTF link to https://temochka.com/, theUrl ...
0
votes
1answer
28 views

Using Automator to save text to a SPECIFIED text file (not a new file)

I know that there's a way to use Automator to save text to a new text file. But I want an Automator application that saves the text from clipboard to a GIVEN text file (by editing it, i.e. adding in ...
0
votes
3answers
76 views

Applescript to find application path from partial app name?

How do I get the path to a running application using part of the app name. (eg. 'Acrobat' in 'Adobe Acrobat Reader DC') This is what I tried but it's incorrect. (Note: Not sure if it changes if ...
-1
votes
0answers
16 views

AppleScript script to Save MS Outlook Attachments with the File Extension Added in the Middle of the File Name (On a Mac Computer)

I would like to save the mail attachment but to also include the file extension string (e.g. PDF) in the middle of the file name, e.g., This_is_my_PDF_document.pdf instead of This_is_my_document.pdf. ...
0
votes
0answers
18 views

How to put a javascript code while setting a string in Applescript

I am trying to execute the code below but I am getting error: set sct to "document.querySelector('input[type=\"file\"]').focus()" set theScript to "tell application \"&...
1
vote
1answer
36 views

Apple Script “Syntax Error”

What is wrong with this piece of Apple Script, It gives the error: Syntax Error Expected end of line, etc. but found application constant or consideration. repeat while true set t to (time of (...
0
votes
1answer
43 views

How to get execution time of an AppleScript?

I have seen some more advanced AppleScript users mention efficiency of their AppleScripts in terms of execution time. Is there an AppleScript method for getting the execution time? I know there is ...
0
votes
1answer
47 views

What is “System Events”?

I mostly see AppleScript scripts that say something should be called in "System Events". What exactly is System Events now? What I definitely know is that there is it an app and that is /...
0
votes
0answers
11 views

Applescript Microsoft Outlook Forwarder

So I'm new at Applescript and am trying to create a script to forward emails sent to a specific recipient in a specific folder in Outlook. It's failing for some reason but doesn't throw any errors so ...
1
vote
1answer
67 views

Filter or Find Finder Items Using Variable

In the Filter Finder Items and Find Finder Items actions, Automator lets you type out criteria for what your looking for like: Folder Name Contains: (Manually Insert Text Here) Here is an example ...
0
votes
0answers
15 views

AppleScripts Help…Close all Open Windows in Evernote

I want to set up automation to close all open windows in Evernote every time the number of open windows exceeds 10. Application: Evernote Test: Windows Open > 10 Action: Close all Open Windows ...
0
votes
0answers
14 views

Login to mac os user account using apple script from Login window

I have a button on my mac login window which is presented using my daemon application. when I click on that button the login should happen using the user account credentials (user name, password) ...
1
vote
1answer
28 views

Hotkey to switch to Google Chrome and go to the omnibox (location bar)

I would like to setup a keyboard shortcut/hotkey that would switch to Google Chrome and go to the omnibox (address bar). I intend to use it invoke various custom search engines. I found a couple of ...
0
votes
1answer
28 views

applescript - do shell output to variable is blank

Hi I'm trying to get the cpuValue but I get "" for the variable. set cpuValue to "" getProcessPercentCPU("Safari") on getProcessPercentCPU(someProcess) set cpuValue ...
0
votes
0answers
24 views

Python script over a file using AppleScript and Automator

I'm trying to run a python script over a file by right clicking it > Services > my service, without opening Terminal. This is my first attempt to do something like this and first time using ...
4
votes
2answers
263 views

Hide the source code for an Automator quick action / service

I have created an Automator quick action. The quick action listens for highlighted text on any application and runs some shell script based on the highlighted text. The quick action can be triggered ...
1
vote
1answer
19 views

AppleScript to add URL to Pi-hole whitelisting

I'm writing a script to easily add sites to my Raspberry Pi's Pi-hole installation. I've got the following: tell application "Terminal" reopen activate do script "ssh pi@192....
0
votes
0answers
37 views

How can I edit and run Apple Script with an editor other than Script Editor?

I've recently been writing more AppleScript, now that Apple has added Javascript support. But how can I edit and run Javascript Automation code in an editor other than the built-in Script Editor? My ...
0
votes
0answers
28 views

Convert text copied from Microsoft Word to Markdown formatting in VS Code

I am trying to find a solution to convert text copied from Microsoft Word on macOS to Markdown syntax when pasting in VS Code. A common use case is converting multilevel bulleted lists. Example of ...
0
votes
0answers
26 views

How to write an Applescript that shuts down a Drobo when a specific application quits

I have dabbled with Applescript in the past, but only in a small way, so need help this time please. I am not even sure this is possible... I have a small server cabinet with 3x Drobo, two Mac Minis ...
0
votes
0answers
26 views

How can I automatically modify the text of any new reply or forward I compose in Mail.app?

I would like to immediately change the text of a new reply or forward in Mail.app. I am most interested, specifically, in removing the quoting from the attribution line on replies, or the "begin ...
0
votes
1answer
26 views

How to toggle between “Portrait” and “Landscape Right” orientation in iOS simulators via AppleScript?

How do I toggle between "Portrait" and "Landscape Right" orientation in the iOS simulators via AppleScript?
0
votes
0answers
20 views

How do I add a custom icon to the macOS menu bar? [duplicate]

I’ve been looking and the only thing I can find is how to add ones that already exist. Say I want to add a picture of the pog face, And when I click it it says ok. Is there any software to help me do ...
0
votes
0answers
30 views

Automatically trigger Automator upon copying to clipboard

Is it possible to trigger workflow for every copying to clipboard? I want to automatically detect URL in clipboard and pass it to shortener service.
0
votes
0answers
23 views

Applescript for Mail.app to transfer mail between IMAP-accounts in a stable way?

I have just spent a few hours with Thunderbird trying to transfer 500 mails from one GMail-account to another and it is completely unreliable (well, it fails reliably). Now I am looking for an ...
1
vote
0answers
45 views

AppleScript in Automator broken in Big Sur

So, I had a pretty simple Automator task that I used from the 'Services' right-click pop-up menu in Finder that copied an image, renamed it, scaled it, then added a border around it. Worked fine for ...
1
vote
2answers
56 views

AppleScript: can I trigger the eyedropper tool upon opening the Mac colour picker?

I'd like to be able to use an eyedropper tool on command. The built-in Mac colour picker is nice, so to that end, I set up a keyboard shortcut using BetterTouchTool to open the colour picker; it does ...
2
votes
0answers
40 views

Any tricks anyone can recommend on how to uniquely identify a window (in any app) after restart?

I have a fun little project I am working on. I am developing an AppleScript that saves and restores windows to their original desktops (a.k.a. "Spaces") after a restart or an app relaunch. ...
0
votes
0answers
28 views

Find and delete duplicate mails in Apple Mail (Big Sur/M1)

How can I find and delete duplicate mails in Apple Mail (on Big Sur/M1)? Ist there a (free) app or a script for that? Problem was discussed here long ago: remove duplicate emails. However, the Araxis ...
0
votes
0answers
21 views

AppleScript: set window_count to count of windows doesn't update

I have some AppleScript that looks like (*this block is nested in a bigger function*) tell application "Safari" set window_count to (windows where visible is true) repeat with ...
2
votes
2answers
280 views

Create macOS script to run a Terminal Command

I want to ultimately create an executable file that will run a terminal command: open -a "Google Chrome" --args --profile-directory="Guest Profile" I want to know what other text ...
1
vote
0answers
29 views

How to stop an AppleScript from repeating itself

I have an AppleScript that addresses issues with out-of-sync Active Directory passwords on macOS. It resets the secure token on a given account by disabling and then re-enabling the token. I run it ...
0
votes
0answers
15 views

Applescript to send autoresponder to specific group members ONCE

Can anyone help me build an autoresponder that resembles the following? Conditions When email is received by senders within a specified group (i.e. those with emails containing "@gmail.com) Send ...
1
vote
0answers
39 views

AppleScript: “Repeat” Loop Only Works With Variable

Very curious as to why this works (the context is an open and activated/frontmost Safari window displaying the "Customize Toolbar" sheet): tell application "System Events" tell ...
0
votes
0answers
32 views

Applescript help to open specific pages from separate PDFs in same or different window, via their URL or UUID?

I use a database app called DEVONthink (DT), which stores PDF files. I could use a hand writing a little script which is already partially written. Its use-case is to activate DT, then bring-to-...
1
vote
1answer
32 views

construct POSIX file with variables

I can construct a file with variables: set filePath to "Macintosh HD:tmp:test.txt" tell application "Finder" delete file filePath end tell However, same thing doesn’t work for ...
1
vote
1answer
38 views

How to always allow any app to do anything / disable Security & Privacy authorization dialogues

Currently on macOS Catalina. I work in sound design and audio development. I use several Automator-scripts and other workflow applications to control various stuff, and for every new project or when I ...
1
vote
2answers
40 views

Clipboard and class issue when running AppleScript “do shell script…”

I have a simple bash command that I have tried to envoke from AppleScript but it makes a strange unicode substitution. Example content of the clipboard: # 6C (d1/s2): F 11-12 100 Fly (1:12.95Y) The ...
1
vote
0answers
31 views

How to open specific apps and arrange them to different desktops automatically?

I'm using my MacBook doing quite different things from time to time. For example, at home, I may want to open file1.xlsx, file2.xlsx with Excel on Desktop 2, while Chrome opened with tags of Google, ...

1
2 3 4 5
58