Questions tagged [applescript]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
14 views

Help with an AppleScript - click a menu item which has a name which changes

I'd like to make F5 be equivalent to clicking on the mail icon in the taskbar, and F6 equivalent to clicking minimise on the mail app main window (or the 'hide' action). Is there a way to achieve ...
0
votes
0answers
13 views

HTML button not being clicked with applescript

So I have a script that uploads a video to tiktok and then presses the post button. I am trying to automate this process. I have automated up to pressing the post button. For some reason, I cannot get ...
0
votes
0answers
10 views

How to run an AppleScript when Mac starts charging in “AC Power”?

I have an AppleScript that has to run when my Mac switches to AC Power and it has to run at regular intervals till it switches back to Battery Power. I have a sample plist file. <?xml version="...
-1
votes
0answers
25 views

How to authorize a “Deadman Switch” script to run, without running it?

2018 MBP running Mojave. I'm trying to create a "Deadman Switch" script, that emails and texts a particular person when run, that something may have happened to me and passing on certain ...
-1
votes
0answers
8 views

AppleScript : issue with JS in document 1

I have multiple safari window/tab, so I created a script to find the windows I need to work with, I though that would save my issue : findmywin() on findmywin() tell application &...
0
votes
1answer
23 views

How to make an Apple Script use its local directory?

I am trying to bundle a .jar executable into an application using the solution provided here: How to create a .app folder from an executable .jar?. I deduced that main.script inside Contents -> ...
0
votes
0answers
16 views

Data from a graph [closed]

I'm using AppleScript and I would like to know if there is a way to get values of a "graph"? The website is https://www.investing.com/currencies/eur-usd-chart??from=gyagbbb3 The values I'm ...
0
votes
1answer
35 views

How can I limit the number of results returned by an expensive filter expression in AppleScript?

In my Apple Notes automation on macOS Big Sur, I’d like to load any 5 notes whose name contains a substring. For example, if I know that I actually have 5 notes that match the query, I can write ...
0
votes
0answers
14 views

Apple script for toggling display mirroring [closed]

Could someone help me with an apple script to toggle Display Mirroring on/off?
0
votes
0answers
19 views

AppleScript // Retrieve data from a website to be stored in Numbers [closed]

I am writing to you because I am very (very) new to the use of AppleScript and its "programming". After many hours of unsuccessful research I would really like some help. I’ll explain you my ...
0
votes
0answers
26 views

Big Sur 11.1: AppleScript to Automatically Change Wi-Fi Networks

So, like a user reported here on Stack Exchange, the built-in "networksetup" command in terminal is pretty unreliable at times. It's slow, and I've found for some reason dot1x never actually ...
1
vote
2answers
22 views

Notification when Apple compressor is done

I'm using the Apple compressor app from the command line to generate movies from sequences of images. This works fine, but the relevant command line command just exits before the job is done (while ...
0
votes
2answers
54 views

Applescript to find word in text file

Mac, How do you use applescript to find a word in a text file and if there is that word then it will do something, but if there isn't then it will do something else?
0
votes
0answers
29 views

Is it possible to skip an Automator action conditionally?

I have an automator application/workflow that takes a bunch of input from the user and spits out an application that performs some specific functions when run, based on that input. Basically I've ...
0
votes
1answer
15 views

Forward multiple emails?

I am using an online email parser. This selects specific text from an email and transfers it to an Excel spreadsheet which I shall use in CRM. I use Apple Mail and have 7000 emails in an account that ...
0
votes
1answer
41 views

Need help adjusting AppleScript automation for converting .pages to .docx?

How do I adjust this script to allow me to choose files not in a 'pages only' folder, and instead multiple "free" files? Keyword here is 'single'. I'm by no means a coding expert but I've ...
0
votes
0answers
28 views

How to run Applescript via bash from JAMF?

this apple script code works fine from the Script Editor app: tell application "Finder" to delete ((POSIX file "/Applications/Symantec Solutions/Symantec Endpoint Protection.app") ...
0
votes
0answers
33 views

New Outlook for Mac (v16.44) & Applescript

I am trying to migrate a number of AppleScripts to the new Outlook for Mac. A basic task is to retrieve selected messages. I have been using for years set msgSet to selection .. but this does not work ...
1
vote
1answer
38 views

How to automate Voice Control to manipulate the currently selected text?

Because I have limited use of my hands, I use Voice Control to dictate most of my text. (I'm using it to speak this question.) Voice Control offers the ability to add custom commands, including those ...
1
vote
0answers
39 views

Multiple Desktops/Spaces: Assign specific application windows to a specific Space programmatically?

I have seen existing questions (Assign Application Windows to Different Spaces/Desktops, Spaces in Mavericks: apps do not remember their space, How to have certain *windows* start in different spaces ...
2
votes
0answers
22 views

AppleScript Photos export quality

In AppleScript, I can export photos from Apple Photos. There are two options: using originals, which discards all modifications I've made not using originals, which exports them at 100% quality. The ...
2
votes
2answers
60 views

How do I pinpoint where the error is in Applescript?

Whenever I got an error from osascript, it looks like this: 698:699: syntax error: Expected end of line, etc. but found identifier. (-2741) How can I figure out where this error is (a general approach)...
1
vote
0answers
19 views

Auto-Clicker, with start / stop hot keys

I'm trying to recreate an AutoHotkey script that I use on my Windows machine. Here's a parsed down version of my AutoHotkey script and what it's meant to do: Set X to 1 If shift+G is pressed, set X ...
0
votes
1answer
63 views

How do I Employ CJK's AppleScript “makeASDate” Handler Without Error?

I am attempting to employ the makeASDate handler shared by user CJK (which I lifted from his answer at Apple Script: Can’t get date of "2018-12-12 10:00 AM") in order to set up some calendar ...
1
vote
1answer
18 views

Empty output when using some shell commands via AppleScript's “do shell script”

AppleScript allows you to run shell commands with do shell script. It's easy to assign a variable to an output of such command. set theResult to do shell script "echo everything" >> ...
0
votes
0answers
13 views

Pause and resume audio/video of application that registers with “Now Playing” widget

Often the pause key (middle key) of my headphone does not pause applications. I wonder if there is a command or applescript to pause and resume media playback for all GUI applications that shows their ...
0
votes
1answer
42 views

Service only application

I want to build a simple service that will allow me to keep any app window always on top or always on the same screen, when switching desktops. Is there a way to build a global MacOS service-only ...
4
votes
4answers
734 views

Applescript - Code to solve the Daily Telegraph 'Safe Cracker' puzzle

I don't know if anyone is going to be interested in this (or if it the correct place to post it!). I spent a couple of hours trying to write a Script that would solve the 'Safe Cracker' puzzle from ...
1
vote
1answer
32 views

How to use Applescript to type in a application?

I'm trying to type in another application using Applescript, and it keeps giving me this error: Can't get keystroke of "string". This is my code. on run {} tell application "My ...
0
votes
1answer
37 views

How can I get the width or height of the dock in Mac OS X so I can resize a window properly?

I want to write a code to resize a window by setting its bounds, and I need to consider where the dock is positioned and the size of the dock. I can get the dock's position and its size, but the ...
0
votes
0answers
39 views

Naming and switching windows

Let's say I want to dynamically assign an open window a number (or an alias) to be able to activate it quickly later. For example, say that I manually activate a Chrome Window that contains several ...
0
votes
1answer
33 views

Use the Finder to act on a path, via JXA

For a specific example, here’s how to change the name of a specific file via the Finder, in AppleScript: tell application "Finder" to set name of (POSIX file "/some/file/path" as ...
0
votes
1answer
47 views

Detect whether clipboard item is image data using AppleScript

This started because I wanted to be able to paste screenshots or pictures copied from Safari into Finder folders. Here are the steps to get to where I am: Install pngpaste using brew install pngpaste....
3
votes
1answer
71 views

This short AppleScript using weekday is not working as expected

set currentDay to weekday of (get current date) if currentDay = "Monday" or currentDay = "Tuesday" or currentDay = "Wednesday" then set earlymorningDisc to 1 else if ...
-1
votes
1answer
42 views

Click checkbox only when blank

I use: tell document 1 of application "Safari" do JavaScript "document.getElementsByClassName('classname')[0].click();" end tell to click on a checkbox, but would it be ...
0
votes
1answer
33 views

How to execute pre-defined JavaScript function in AppleScript and pass data to JavaScript

In my AppleScript, I want to pass a list of keys to a website's client-side, then query the data on the backend, and get the response and re-render the client-side. All of these should happen in the ...
1
vote
0answers
22 views

Use AppleScript to display a system notification with embeded image expanded?

The notification system in BigSur is capable of showing a notification with an image which is already expanded, i.e you don't have to click the little down arrow to show the image embedded in the ...
0
votes
1answer
27 views

Stop Dictionary Pop-Up Window

< 3.5 GHz, 6-Core Mac Pro (2013 MacPro6,1) with 16GB RAM and D700 GPUs, running macOS 10.14.6 > Greetings, folks! After reinstalling MacOS 10.14.6, whenever I type cmd-control-d, a window pops ...
0
votes
0answers
20 views

Add osascript SystemEvents to Automation

BigSur 11.0.1 (20B50) Trying to run osascript from Alfred. It uses keystrokes. Get error : execution error: System Events got an error: osascript is not allowed to send keystrokes. (1002) As far as I ...
1
vote
2answers
64 views

Connecting AirPlay displays with a keystroke

I have an Apple TV in the living room. I have a Mac mini in my office. I have a wireless keyboard and mouse that can easily reach between the two locations, but am not willing to walk between them to ...
0
votes
0answers
132 views

macOS AppleScript no longer working with image insert into Microsoft Word Document in Big Sur

I have been running this script to insert an image into a Word document table cell. It had been working well until I upgraded macOS to Big Sur. When I run the script, I now get the following error: ...
0
votes
0answers
33 views

How to create an automator workflow/application to delete jpeg when raw exist

I have approx 1 terabyte of Canon CR2 images in 40 sub-folders, some with matching jpeg and some just jpeg. I want to delete all jpegs that have a matching corresponding raw .cr2 file. I would like to ...
1
vote
1answer
71 views

Script to change System Preference function key settings no longer working in Big Sur OS11

I have a simple script that I've used for years to toggle the function key (fn) off and on. The checkbox is located at System Preferences > Keyboard > Keyboard Tab > 3rd checkbox down. ...
1
vote
1answer
44 views

Write cron script to open and exit application

I'm trying to write a script that opens a brand new instance of safari, displays a webpage for 10 minutes, then quits safari. I think I can follow this Stack Exchange to do steps 1 & 2 of my goal. ...
0
votes
1answer
30 views

How to automatically mount network share when iPhone backup screen is opened in Finder?

I would like to trigger a script that mounts a drive when I open the iPhone's device page in Finder (like shown here). Currently, I have the iPhone backups in an APFS volume, which is inside a ...
0
votes
0answers
34 views

Duplicate rows in Numbers with Applescript

I have a template with 20 rows of data. I am trying to figure out how to select these rows and then duplicate them a varying amount of times depending on user input. When I do this manually, I have to ...
0
votes
1answer
66 views

How to toggle dark mode on and invert colors using Automator

I am using Automator for the first time and I wonder if it possible to create a quick action to toggle dark mode on and invert colors using a shortcut.
0
votes
0answers
24 views

Batch Trim Videos With QuickTime and AppleScript

I have a very large number of videos of which I would like to systematically trim the first X seconds (some videos it is 6 and in some others it is 8, but they are in separate folders). I found this ...
0
votes
1answer
35 views

Using automator or script to turn on wifi in case of ethernet cable failure, and vice versa?

For the moment, I have slightly faulty thunderbolt port on my 2013 mac book pro that I use to connect to the internet. My wifi works fine, but I prefer the increase in speed with the direct line. My ...
0
votes
1answer
64 views

How to create a script with Automator to watermark each PDF in a folder with a different watermark?

I am trying to create a script to watermark a group a PDF files in a folder, each PDF has to have a unique watermark. All the PDFs are in one folder, all the watermarks are in .png located in another ...

1
2 3 4 5
57