Questions tagged [applescript]

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

Filter by
Sorted by
Tagged with
-2
votes
0answers
24 views

Need a code for conditional logic in Mac Automator [closed]

I don't know coding. I sometimes face errors while running my automator workflow. My workflow includes clicks on a webpage. Sometimes it does not detect the button on the webpage properly and show ...
0
votes
0answers
14 views

Use AppleScript to move (not copy) GMail message in Apple Mail

How do I get AppleScript to appear to move (but not copy) a Gmail message in Apple Mail? If I use move theMessage to targetFolder the message appears in both folders. (More precisely, the message ...
0
votes
1answer
27 views

Applescript to find and add specific contacts to a group

I tried to re-jig the applescript from these two answers, but no dice. It seems to work if you're creating contacts at the same time, but not when finding existing contacts. tell application "...
0
votes
1answer
12 views

which certificate/identifiers/profilers should be used for python script to be distributed as a pyinstaller build/bundle outside the app store?

My program works as follows In a while loop, it checks for the active window change - AppKit library used from AppKit import NSWorkspace active_window = (NSWorkspace.sharedWorkspace()....
0
votes
0answers
16 views

Script to export all photos and album from Photos on Mac while keeping metadatas

My initial goal was to import "From my Mac" albums to my iPhone and keep them synced. It seems that an album created outside iOS is read only. And if I make a copy of it on my iPhone, it won'...
1
vote
1answer
23 views

Getting AppleScript function to pass string correctly

Someone please help me here and show me how to get this to work. I've checked examples on returning values from functions with this AppleScript, but something I am missing here. I'm trying to get the ...
0
votes
0answers
11 views

Can I temporarily disable keyboard entries on the lock screen?

I'd like to create an apple script that sends the computer to the lock screen and disables the keyboard for 60 seconds. This is what I have so far Lock the keyboard entries with KeyboardCleanTool Go ...
1
vote
1answer
21 views

How do I detect if headphones are connected (via the jack) in bash?

I have a script, and I want it to behave differently if headphones are connected. How can I get this information? I tried using SwitchAudioSource, but its output is the same, whether or not the ...
0
votes
1answer
27 views

How do I activate Mouse Keys with an apple script or the command line?

I have set up mouse keys to activate when clicking option five times. Unfortunately, it appears that I cannot activate mouse keys with this script repeat 5 times tell application "System ...
1
vote
1answer
46 views

How to lock a Mac lock screen without using keystrokes in the script?

I'd like to go to the Mac lock screen with a command line script. Many of the existing answers suggest something like osascript -e 'tell application "Finder" to sleep', but my computer does ...
0
votes
1answer
41 views

Simple AppleScript script terminates early

I have an AppleScript script for Music that processes the selected tracks and modifies the track name. Basically, it works. If I select one item, it works without fail. If I select multiple items, it ...
0
votes
2answers
39 views

Selecting a dropdown menu in Safari

I need to create an Applescript to open a certain website and export it as PDF using the menu "Save as PDF…" under the File menu. Then, I need to save that PDF on a certain location on my ...
0
votes
1answer
38 views

Applescript to output UTC Datetime at cursor without SystemEvents

It would be enormously helpful if I could bind a script that outputs the current UTC timestamp to keybindings and have the output magically appear at my cursor in whichever application I was using. ...
0
votes
1answer
30 views

Can AppleScript create an Open File Alert?

macOS Mojave 10.14.6 I would like to be able to programmatically create repeating calendar events that open a given file when run. I'm using AppleScript within Automator. Creating the repeating ...
1
vote
1answer
25 views

Miniaturise all windows with AppleScript

tell application "System Events" set mywindows to windows of (processes where background only is false) repeat with theItem in windows of (processes where background only is false) ...
0
votes
1answer
42 views

how to create a repeating event in Automator?

I would like to programmatically create a repeating event. I'm using Automator and it seems that Automator can't do this, plus I want to pass variables provided by the user into the event creation ...
1
vote
1answer
44 views

Is there a MacOS automation that can detect pixels on screen?

I need to automate some keyboard and mouses actions depending on what is shown on the screen. But because the applications don't have applescript hooks, there is no way to know of certain events ...
0
votes
1answer
44 views

Can an Automator workflow generate an Application?

I'm building a "Wizard" of sorts that uses Automator and some Appliescript, and at the end I would like it to generate an "Automator Application" that does things when launched, ...
0
votes
2answers
35 views

Calling AppleScript routine using osascript

Given the following AppleScript code on myHandler() display dialog ("I'm your Handler!") end myHandler How do I call myHandler from osascript (using Terminal), plain without parameters, ...
2
votes
0answers
48 views
+200

Automate the repositioning and refreshing of menu bar icons?

Background When menu bar items are rearranged manually using Cmd+drag, macOS writes a new "preferred position" preference to each app that is showing a menu bar icon. (This preference helps, ...
1
vote
1answer
30 views

How can I specify a drive in Applescript without the drive name?

I had a main system drive on my iMac named "Macintosh HD" and wrote my scripts to reference files on that drive. For instance, to get to my library directory, I had "Macintosh HD:Users:...
0
votes
0answers
15 views

How do I organize screenshot based on window in Mac?

I tried to write a custom service in Mac with Automator to organize screenshots based on the window that is screenshot-ed. For example, if I use dictionary app in Mac in a full screen mode, and do ...
1
vote
1answer
50 views

How do I run apple script on a particular instance of Firefox?

I have three instances of Firefox called - Firefox Firefox 2 Firefox 3 They all live in the Applications folder and the difference is that they have different Firefox profiles and cookies. I'd like ...
0
votes
1answer
46 views

Reliable shortcut for non-ASCII text insertion

I occasionally use text strings such as ¯\_(ツ)_/¯ Unfortunately, I don't have a ¯ or a ツ on my keyboard, so using such strings can be a bit of a pain, usually involving a web search and copy and paste....
0
votes
1answer
25 views

How do I record changes to a cell in Numbers via AppleScript?

I'm very new to AppleScript so bear with me. What I am trying to achieve is for every time I run the script, the current value of a cell is copied into a cell, one column to the right of when I last ...
1
vote
1answer
120 views

Add exif creation time with correct timezone (TZD) to filename

Hi i have a problem renaming a lot of photo and images files. I use a shellscript in automator to rename them by EXIF date and time. But the time is given by UTC and im living in europe with +0100 in ...
1
vote
1answer
27 views

AppleScript: Clicking a button in a dmg file

I am trying to figure out what code will send 2 clicks to open a file in an opened .dmg file using AppleScript in Script Editor. I did create the .dmg file I've been searching for ways to create a ...
0
votes
0answers
16 views

Knowledge Request- Automatically Log Out of Google Services Script

TL;DR- is there a way to set Gmail to automatically log itself out? I am in the process of distancing myself from Google's services, and while it is inevitable that one will always interact with ...
1
vote
0answers
39 views

How to convert pdf file to tiff, then tiff to pdf with automator?

I have a lot of pdf files with different type of data in it: text, images, stamps etc. And I need to convert them to look like it's a scanned pdf, i.e. bitmap pdf. I need the same file with the same ...
0
votes
0answers
25 views

How to change text in Xcode document via AppleScript

I'm currently working on an AppleScript to invoke ClangFormat while in Xcode 11.5. Here's the work-in-progress: set fpath to "" set selRange to {} tell application "Xcode" try ...
1
vote
0answers
27 views

How to display Notification from a LaunchDaemon process?

I have a LaunchDaemon process that needs to run as root user. The process internally calls osascript to display some notifications. Notifications display fine when the process is run manually without ...
0
votes
1answer
20 views

In Applescript, how can I correctly obtain values for a process window that is the not the front window?

I currently have an Applescript that takes values from Google Chrome, but it only works if Chrome is the front window. In the case Chrome is behind another window, it no longer works: tell application ...
1
vote
0answers
33 views

I have an automator script that runs a curl request, how can I retrieve and display the progress in the menu bar?

On Automator, I created a service item that uploads a file by executing a BASH script that uses a cURL request. The Applescript code looks like: on run {input, parameters} set pathtofile to (the ...
1
vote
1answer
38 views

How to make Automator service that enters highlighted text into Chrome address bar?

I'm trying to make an Automator Quick Action that will show up in the right click menu under Services that will take the highlighted text and put it in a new tab in Chrome. Looking at various other ...
0
votes
0answers
14 views

Mail.app - compare two mailboxes?

I try to transfer 50 000 mails from an IMAP account A to another IMAP account B using Mail.app but it constantly fails during the process (that takes a day or so). There is a message-id-based ...
0
votes
1answer
49 views

Catalina: How to add System Events to System Preferences > Security & Privacy > Privacy > Automation?

The problem In a script I'm using AppleScript to reload the browser when a change happens. I start this in the builtin terminal of my IDE, WebStorm. Since MacOS Catalina this yields the following ...
1
vote
1answer
63 views

How to use Applescript to open a printer app and select items within?

I have absolutely no knowledge or experience in using Applescript or Automator. I'm hoping by using either to create an app (or script) that will print a test page off my printer automatically. I know ...
0
votes
1answer
24 views

Clear recent file list in AppleScript?

I created an AppleScript for cleaning the clipboard which had this command: tell application "System Events" to set the clipboard to "" How would I create an AppleScript that did ...
1
vote
1answer
27 views

How make BBEdit Color Scheme follow system dark mode setting

BBEdit has an awesome setting to make the application appearance match the selected editor color scheme – so when selected, if you select a dark color scheme in Preferences, it puts the app's chrome ...
0
votes
0answers
38 views

How to use voice recognition with Apple Script

can someone help. tell application "SpeechRecognitionServer" set theResponse to listen for {"open (said application)", "who are you"} with prompt "Hello... I am ...
0
votes
1answer
22 views

Input validation, expect error on null input

I expect the code to display an error and then ask the question again when the user enters no text set tname to "" repeat while tname is equal to "" set tname to text returned ...
1
vote
2answers
44 views

I set my startup disk to Macintosh HD. But after opening it, the name becomes “/”

Using the System Preference -> Startup Disk I set my startup disk to Macintosh HD. When I open it the name at the top of its window is "/". When I open the startup disk using Applescript ...
0
votes
0answers
73 views

com.automator.runner.xpc is not allowed to send keystrokes

I have two MacBooks. Both run the same MacOS version. I installed the same Automator script in both. But on the older MacBook I get: The action “Run AppleScript” encountered an error: “System Events ...
0
votes
0answers
12 views

Batch command to lock multiple files using Box Drive

My company uses Box.com and Box Drive to host collaborative files. Box gives the ability to lock files so multiple people can't work on them at the same time. With Box Drive I can right click ...
1
vote
1answer
35 views

Get text of most recent notification with applescript

I would like to be able to grab the text of the most recent notification and pass it into an applescript variable. How can I do that? Edit: here's what I have so far: on run tell application "...
0
votes
1answer
34 views

Using Applescript to append user input to existing note in Notes App

I've been using this little utility to save out random thoughts through the day to a text file. I want to append the user input to an existing note in the notes APP, but can't figure out getting ...
0
votes
0answers
14 views

Can I trigger an Apple Script event before my Google Calendar event ends?

I'd like to receive a notification whenever a meeting is within ten minutes of ending. I use Google Calendar, but I'm open to syncing my Google Calendar to Mac Calendar. Can I set a Growl ...
0
votes
1answer
44 views

Portable UI Applescript for choosing any menu item through any hierarchy of sub-menus

At the bottom of this page Apple explains how to use UI scripting to automate selecting menu items. There are two hardcoded examples that I'm drawing on in an effort to write a generic library script ...
0
votes
1answer
45 views

Use Google speech to text instead of Apple's

Google currently has much higher quality speech transcription. You can try it easily by going to doc.new and pressing Cmd-Shift-S and talking. Compare to using the built in system from Apple (pressing ...
1
vote
1answer
44 views

Automator Help: take Fixed-Position Screenshot, click “Next Page” and Repeat (that's it!)

I don't know code which is really embarrassing for simple tasks like this one. All I'm trying to do is to make a Quick Action in Automator for this: take a screenshot based on two fixed points click ...

1
2 3 4 5
55