Questions tagged [applescript]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
36 views

Refreshing Finder window view after sorting files

I have a simple script: tell application "Finder" activate set sort column of list view options of Finder window 1 to size column end tell It works, but the problem is that the window is ...
1
vote
0answers
37 views

How to automatically attach folder actions to all added subfolders recursively?

TL;DR How do you make a folder action that attaches folder actions to added subfolders? Is that even possible? My end goal is to convert gps/location-based reminders of specific locations (e.g. home/...
0
votes
1answer
41 views

Batch Reformat Date in Filenames

I am in need of a solution that will allow me to batch reformat/rename the date appended at the end of a filename and then move the date to the beginning of the filename. I'm adopting the ISO 8601 ...
1
vote
1answer
259 views

Get values from Numbers.app into AppleScript's variables

I have a .numbers file in following format: Product Quantity Price Apple 5 3 Banana 7 2 Orange 3 4 I need to get three variables with new-line separated values, e.g. ...
1
vote
1answer
71 views

Determine com.apple.Finder AppleShowAllFiles status using command line?

Is there a way that I can grab the status of com.apple.Finder AppleShowAllFiles in command line? I switch between AppleShowAllFiles yes & no frequently, I want to write a .command file to check ...
0
votes
0answers
17 views

Hide System Preferences icon from dock during AppleScript execution

I have an AppleScript scheduled to run every several minutes with launchd. The script makes some adjustments in System Preferences. However, whenever it runs, the System Preferences icon appears on ...
-1
votes
0answers
81 views

Automator Workflow or Apple Script to move files

I've got a MS Excel Macro enable file that reformats a csv file to a particular format and writes a new file to a folder in /use/library/group containers. It has to write it here because of the ...
-1
votes
0answers
72 views

Applescript Powerpoint to create a new presentation from selected slides

I'm having a hard time believing this isn't a command directly in Powerpoint, seeing as the one thing I hear more than anything is "can you send me just that slide?". But MS isn't exactly known for ...
1
vote
1answer
43 views

What is the difference between `on` and `to` in AppleScript handler declaration

What is the difference between on and to in AppleScript handler declaration? When to use one or the other? For example the following handlers do the same: on demo1() return 1 end demo1 to demo2()...
-1
votes
0answers
64 views

How to pass a record or a list to an AppleScript handler in VBA AppleScriptTask?

is it possible to pass a record or a list to an AppleScript handler in VBA AppleScriptTask? I have a handler which moves a given file or folder from a source to a destination: on moveFSObject for ...
0
votes
1answer
73 views

Running AppleScript without activating the window

I have a python script to read from Messages database and forward some specific new messages to specific contacts. It works but the AppleScript below to send message is making Messages.app appear. I ...
1
vote
1answer
95 views

Click check buttons via keyboard or script

I'm using Final Cut 7 under El Capitan, and I need to check the following buttons (in fact just the Audio Tracks, but both would be nice) using the keyboard, or maybe a scripted method. I have ...
1
vote
0answers
89 views

Change keyboard layout automatically when external keyboard connected

I recently purchased an external keyboard (non-apple) that is used at home and also dragged along with me from time to time, and I've noticed a need. My Mac is in English, as well as its physical ...
1
vote
1answer
93 views

How to remove a large number of unused keywords from Apple Photos app?

My Photo library has evolved over many years, starting out as an iPhoto library, then being merged with an Aperture library, then becoming a Photos library. Over the course of the last 20 or so years ...
0
votes
0answers
101 views

AppleScript with list selection and Cancel button suppressed or disabled

Is there any way to suppress/disable the Cancel button in a list selection dialog - in other words, force a response? Here's what I came up with (I'm forcing a response by displaying an error message ...
0
votes
2answers
246 views

Trying to click a button in safari

I'm trying to click a button in a webpage with AppleScript, but it only seem to work 1/10 times. I copied this code, to clickID(theId) --creates a function that we can use over and over again instead ...
2
votes
1answer
228 views

Applescript to mute Discord

Edit: My initial question does not appear to have a solution. Instead I used an alternate method. Scroll down to see the alternate method. I'm looking for a solution to mute my mic in Discord that I ...
2
votes
1answer
197 views

AppleScript checking if folder exists causes “AppleEvent handler failed” error -10000

AppleScript on macOS Mojave and can't work out why this script gives the expected "TRUE" on the first folder, but instead of "FALSE" on the second folder it aborts with the error message: [error "...
0
votes
0answers
33 views

AppleScript: Can I 'get' highlighted text from Mail.app?

I'm trying to make a script that takes selected text in Mail.app, gets it into the script and does some processing to it. I don't want to have a GUI script that emulates command-C to copy the text ...
0
votes
0answers
263 views

Use AppleScript to search for message by subject

Does Applescript provide a mechanism for me to search for a message by subject; or do I have to write a loop and examine every message "by hand". The code below generates this error: Mail got an ...
1
vote
1answer
102 views

How to iterate over Reminders using AppleScript

I'm trying to write an AppleScript that simply iterates over uncompleted Reminders and displays the name. The code below generates this error: Reminders got an error: Can’t make name of reminder (...
0
votes
1answer
88 views

Move mail message back to inbox of Exchange account

Is there a special syntax for using AppleScript to move a message from a folder back into the inbox of an Exchange account? I have Apple Mail configured with three accounts, two Gmail accounts and an ...
1
vote
1answer
75 views

How to batch add folders to Folder Actions

I actively manage a directory of folders that contain images that are organised by modification dates. Due to this, I had made a quick action that used an applescript and bash to help me ensure that ...
2
votes
1answer
265 views

Automator: `command not found` (Python script for command line) [duplicate]

I am trying to create an Automator application, which allows me to convert Python script files .py files to Jupyter Notebook files .ipynb using Python script for command line jupytext. However, the ...
2
votes
1answer
39 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
95 views

Changing AppleScript-created date-based folder structure

I have an AppleScript that has been written and it works as such, but I need to change the way it creates the folder structure. The script does the following: Folder is selected which contains files (...
1
vote
1answer
64 views

Automator to open random file on Windows share

I have created through automator the ability to locally open a random file in a specified folder with subfolders. I cannot figure out how to do this on a networked Windows share. I have: Get ...
1
vote
1answer
291 views

Why is an AppleScript to modify Calendar event attributes so slow?

I'm trying to write a fairly simple AppleScript to automate the process of having Calendar events repeat in bulk. Specifically, I want every event on a given calendar within a given time span to have ...
1
vote
0answers
52 views

AppleScript grab value from safari with repeat / add in list

I need to grab data from a safari, There is a random number of : document.getElementsByClassName('sortable DataSummary')[1] this work fine : tell application "Safari" set mzRawData to do ...
1
vote
1answer
546 views

AppleScript to perform actions to text in new TextEdit document

I need to make an AppleScript that would create a new TextEdit file, type any random text, then a table would pop up and give you two options to choose font of that text, then same with colour, save ...
1
vote
2answers
330 views

Launchd running an Applescript every two hours

I have written a small applescript that I would like to run automatically every 2 hours. I have thus written the following launchd daemon (probably it is an agent): <?xml version="1.0" encoding="...
3
votes
1answer
134 views

Applescript : generate a new list based on existing list

my script is generating a list (random number of items) and for each item I like to add a colour. I can do it manually : > set myList to {{"demo", "#5cdf64"}, {"icloud.com", "#FFFF00"}, {"more &...
2
votes
1answer
244 views

Apple Script: Can’t get date of “2018-12-12 10:00 AM”

Script Purpose The script below uses an App called Pashua to display a custom dialog box that returns multiple inputs. These inputs are then used to create a new Calendar event. The Issue The ...
1
vote
2answers
108 views

Can AppleScript search deeply for the largest file contained below a folder?

I need to make an AppleScript that would find the biggest file in selected directory (even if its inside another folder) and show full path on screen. This is what I have so far, but it doesn't work:...
2
votes
2answers
91 views

Applescript: Help with idle and hiding from finder?

I'm trying to get my script that works to do 2 things: run in the background every 60 seconds, and disappear from the finder and the dock. Original: tell application "System Events" set ...
3
votes
1answer
259 views

In AppleScript, how to open a URL location that contains a hash (#)?

I have a workflow written in Alfred that when opening a URL location in AppleScript, the URL will be urlencoded() which effectively breaks: open location "https://example.com/#hello" & ...
2
votes
1answer
468 views

Applescript: save all open tabs in Chrome to PDF

I would like to make an AppleScript that saves all of the open tabs in the front window in Google Chrome to a PDF. Here is my working MWE so far: tell application "Google Chrome" set allTabs to ...
0
votes
1answer
89 views

AppleScript click on Safari <th> link

Based on this HTML tag, how can I click on View from TrustedMachines? I know how to do it from document.getElementById or name but not sure how to do it this cases <td> <a data-auto-...
0
votes
1answer
62 views

AppleScript to rename Safari Tab

There is an option in Keyboard Maestro to rename any tab on safari with the name you want I'm trying to do the same using AppleScript but is this even possible? I have nothing so far, I'm guessing ...
1
vote
1answer
136 views

Applescript to set non focus tab in safari

I made a script to find an tab based on it's URL and set a new URL (the tab is not focused) tell application "Safari" set topWindows to every window whose name is not "" set numWindows to the ...
0
votes
1answer
199 views

applescript : add clipboard content to list

Can I create a list from the clipboard? Let's say my clipboard is `name email phone and any random number of text Can the words be separated and added in a list? Also the item can be either text ...
0
votes
0answers
36 views

Automatically export new emails to folder?

The manual process: New email arrives in inbox X (Apple Mail) Drag-n-drop to Finder folder Y Delete email in inbox X How can this be done automatically using AppleScript/Automator?
2
votes
1answer
254 views

What is the difference between HFS path and alias path?

This was brought up in a comment from another question/answer and I was curious what is the difference between an HFS path and an alias path. My understanding they were the same.
2
votes
2answers
115 views

osascript -e command for displaying a text in status bar?

Doc has reference to how to display a notification alert but not sure if there is an option to display a message in status bar that can be updated like a price ticker.
0
votes
2answers
262 views

AppleScript shell script

How can I run a shell script on multiple different computers with the same code? If I have it run from /users/'my name'/desktop/etc. then it won't work when I use it on a different computer, ...
1
vote
1answer
168 views

Creating an app with applescript

I'm trying to make an app that when opened will play an audio file that is contained in the app, but i have no idea how to do it. I know this is really vague and I apologize but any help would be ...
2
votes
3answers
95 views

Scripted vector drawing app (à la Satimage Smile)

I've used Satimage's Smile app to make vector diagrams (for technical illustrations, laser-cutting patterns, etc) via AppleScript augmented with drawing commands. It's like the opposite of PaintCode, ...
2
votes
2answers
106 views

AppleScript issues with Terminal commands

I want to run this command in Terminal via AppleScript but Script Editor doesn't like the dollar sign. It says: Syntax Error: Expected end of line but found unknown token. How can I enter this command ...
2
votes
0answers
63 views

highlighting text in safari

I need to highlight every instance of some keywords in Safari. I have this script which work : set myList to {"demo", "demo1"} try tell application "Safari" do JavaScript "document....
2
votes
2answers
327 views

Automator: Is it possible to resize an image to a maximum file size?

I have been looking around for an Automator method, whereby an image file is to be resized (reduced height and width) to a specific file size (in bytes), or a near lower-bound proximity of that file ...