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
45 views

Handling permissions to run a bash script

I'm sending a bash script as a .command file to a friend. This person is not very tech savvy which is why I'm sending it in the first place, the goal is for the .command file to run through the shell ...
1
vote
1answer
67 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 ...
2
votes
0answers
53 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, ...
11
votes
7answers
24k views

AppleScript “delay” command not working since switch to Yosemite

Note: The issue with delay was fixed in OS X 10.11 El Capitan. Ever since I upgraded to Yosemite, Applescripts that use delays have stopped working. How can I fix this? Here's the world's simplest ...
-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
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
0answers
18 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
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
18 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'...
3
votes
1answer
35 views

Use AppleScript to find the currently playing song (and other metadata)

The audio section of the touch bar can automatically detect which app is playing audio, and adds media controls to play/pause, skip, and seek through any audio. As an example, this works for Quicktime,...
6
votes
1answer
2k views

AppleScript to read all notifications in the Notification Center OSX 10.10 Yosemite

It seems like the following AppleScript is no longer working in the latest version of the OS X 10.10 (Yosemite): on run tell application "System Events" tell process "...
4
votes
4answers
5k views

Dim screen brightness of MBP, using AppleScript (and while using a secondary monitor)?

I just got a secondary monitor to use with my MacBook Pro (13" Retina Early-2015). I previously had AppleScripts for dimming and for increasing the brightness of the MBP screen—either to no bars or to ...
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 ...
25
votes
4answers
62k views

How can I remove a portion of from the middle of a movie?

Quicktime Player help: With QuickTime Player you can quickly remove a portion of the beginning or end of a movie or a movie clip to make it shorter or remove unwanted content. I want to remove ...
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
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 ...
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
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
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 ...
4
votes
1answer
3k views

Is there something like macros in Outlook 2016 on Mac?

In Outlook on Windows I have a VBA script that moves one or more messages from Inbox to a folder, attached to a keyboard shortcut that I use to very quickly move hundreds of emails to where I want ...
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
897 views

Auto FaceTime call using AppleScript, without confirmation

I would like to automate a FaceTime call without having to confirm the call in the FaceTime app. Is there a way to do that? EDIT: When I execute the script I get this message in the upper right ...
5
votes
1answer
1k views

Is it possible to compose Mac OS Mail in an external editor?

For Thunderbird there is the External Editor extension a very very classical piece of software that, when called via a shortcut, pops up your external editor (emacs in my case) and let's you edit your ...
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 ...
19
votes
2answers
11k views

How to pause YouTube video via keyboard shortcut or from menu bar?

Is there a piece of software that allows one to pause (& un-pause) a currently playing YouTube video (or, ideally, any online video/audio media), with a keyboard shortcut or a conveniently ...
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
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) ...
2
votes
2answers
758 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 ...
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
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, ...
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, ...
3
votes
1answer
4k views

AppleScript: 'exists' returns true every time

On every exists in AppleScript the result is true. For example: set a to (POSIX path of (((path to home folder from user domain) as text) & "skfhshfkh:" & "hfjhsfhsj:")) if ...
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
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....
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
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 ...
0
votes
1answer
36 views

How to move/hover mouse (not click) over a button on Safari by using Applescript

Can anybody tell me how to write an Applescript that can move or hover mouse over a Button on Safari? I've successfully made an Applescript that can click to the button but I don't know how to make ...
1
vote
1answer
123 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 ...
0
votes
1answer
112 views

Allow ssh-keygen-wrapper to access “System Events” for all users in the same computer

When I run my AppleScript in a remote mode, I get this message in an user where the script runs: “sshd-keygen-wrapper“ wants access to control “System Events“. Allowing control will provide access to ...
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
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
40 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
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 ...
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 ...
17
votes
5answers
35k views

Turn Wifi off/on with a single key?

Is there a way to assign the WiFi on/off function to one of the function keys like F4 that I otherwise never use? I assume Applescript would be required. However I may want to use a BASH script ...

1
2 3 4 5
55