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
0answers
27 views

How to simulate keystroke in a GUI application programmatically?

On Windows I use AutoHotKey, I can create a GUI window that can be "Always On Top", I can create different Tabs that contain buttons with names that will send keystrokes/macros to a particular ...
0
votes
0answers
12 views

Use javascript in Safari using AppleScript

I have a javascript that I use in my bookmark which take action on the current Safari tab : javascript:q=prompt(%22ORDER%20NUMBERS%22,%22%22);q=q.toUpperCase();allOrders=q;allOrders=allOrders....
0
votes
1answer
43 views

Catalina: backup iOS devices programatically

Before Catalina, I used to be able to use a simple AppleScript to open iTunes and select the menubar to back up connected iPhone/iPad; In Catalina, this function is moved to Finder and so far I haven'...
3
votes
3answers
49 views

AppleScript is unable to get a date as string

Be warned, I am a very new to AppleScript and most programming in general. The basic purpose of the script I've been working on is to read information from Excel files and put it into a FileMaker Pro ...
0
votes
1answer
31 views

Apple Script: 'activate' an application in fullscreen

Im trying to run tell application "X" to activate on an application that is running in fullscreen, but its not working. Any ideas on how I can work around this and give focus to a running app in ...
0
votes
1answer
37 views

Applescript and SpeechRecognitionServer: reading in a file as “listen for”

In place of the list in tell app "SpeechRecognitionServer to set theQueryList to listen for {"list item 1", "list item 2"...} I'd like to read in a text file that contains the list. Something like ...
1
vote
0answers
18 views

AppleScript to fast forward YouTube videos

I'm trying to use AppleScript to fast forward YouTube videos by 10 seconds in Chrome, but the following code doesn't work; I get missing value as output, instead. What I am doing wrong? tell ...
0
votes
2answers
43 views

How to iterate items of the window with dynamic title

I am trying to get all rows from a table of the application. set ProcName to "AppName" tell application ProcName to activate tell application "System Events" tell process ProcName tell ...
2
votes
1answer
55 views

An automator service that opens a file with the same name but different extension of the selected item

My movie collection has this setup: a folder "Movies/Covers" with the images of the covers (jpg files) a folder "Movies/Videos" with the corresponding video files (mostly mp4 files) The files in ...
1
vote
1answer
17 views

AppleScript exit if no action

I would like my script to stop automatically unless I press a button. display dialog "Continue" with icon caution buttons {"Exit", "Continue"} default button 1 giving up after 2 if the button ...
2
votes
1answer
46 views

How can I select all files of a type in a non-Finder, application window?

The Applescript below looks at the front open finder window, finds the file type of a file that is selected, and then highlights all files of that file type. I.e., if a finder window has a mix of .jpg,...
2
votes
3answers
105 views

Finder go to Clipboard

I’d like to create an Apple script that will use a text path in clipboard and open a new Finder window and go to that path
2
votes
1answer
54 views

Permanently grant right to control another app to Apple Script App

I am using an AppleScript app (i.e., an AppleScript exported to an OS X app) to copy the message ID of an e-mail currently selected in Mail.app to the clipboard. Whenever I run the AppleScript app, I ...
0
votes
0answers
12 views

Create shortcut (or script) for swapping workspaces between monitors

This question is similar to this one but not exactly the same. I have a big primary monitor (Display 1) and a smaller secondary one (Display 2). Frequently I manually swap whatever workspace is on ...
2
votes
0answers
28 views

Opening terminal from command line, starting bash and got to the same location where the original terminal was

For example, I have a terminal (running /bin/bash) opened at a certain folder. Now what I want is when I type trm on the terminal, it will open another terminal at the same location where the first ...
0
votes
0answers
55 views

Combining two scripts

I'm using two different scripts which work fine separately but would like to merge the two into one script. Any help is welcomed. (please see scripts below) SCRIPT 1 strips the file name to the ...
1
vote
0answers
21 views

AppleScript and Mail: Weird selection behaviour?

I) Intro In AppleScript, when - for example - I do tell application "Mail" set mselection to selection as list tell application "System Events" tell application "Mail" ...
1
vote
0answers
60 views

AppleScript and Mail: Read out Mailbox of Message and select first read message in Inbox

I) Intro I'd like to read out the mailbox a message (of Apple Mail) is currently in. To read out a message's id one can use: tell application "Mail" set m1 to message 1 of inbox return id ...
2
votes
1answer
35 views

How to switch user quickly, on Mojave?

There are two users enabled and used at the same time. Usually I need to click via mouse the username in the top bar, choose the username2, type in the password. Am wondering if there's a quicker way....
1
vote
1answer
22 views

How to add a Service to Accessibility permissions

I have a Quick Action which I wrote in Automator (it runs an AppleScript). It is launching from a keyboard shortcut correctly (using this). However, when I try to give it permissions in System ...
2
votes
1answer
47 views

How to export Calibre books into Apple's Books.app?

How can I export Calibre books into the macOS Books.app? I mainly care about PDFs at this point, but of course it would be nice if other formats could also be exported into Books.app. I like that ...
0
votes
0answers
21 views

How do I send a kAEGetURL event to a process using AppleScript?

Got this far: tell application "System Events" tell process 123 ... end tell end tell Not sure what to put in ....
3
votes
2answers
51 views

Menu bar finder scripts always missing

I've added several automator applications to the scripts editor folder and I'd like them to be available at all times in the menu bar dropdown menu. However they're only available in the Finder ...
2
votes
3answers
125 views

find a folder nested in a folder

I need to find a folder nested in a folder. example: /Volumes/"4T Virtual Machines"/outerfolder/innerfolder mac $ pwd /Volumes/4T Virtual Machines mac $ ls -lR outerfolder/ total 0 -rw-r--r-- 1 ...
2
votes
1answer
41 views

Applescripting Numbers to save, close and quit in an App instead of the Script Editor

After using Applescript to add a new row with data to a Numbers document, I'm trying to save and close the document and then quit Numbers. Using the script below to save, close and quit Numbers works ...
1
vote
2answers
28 views

How to allow someone to turn off my device

the purpose of my question , I need someone to remotely turn off my device because I wont be in front of my Laptop I succeeded in giving him a terminal command to shutdown my PC osascript -e '...
0
votes
0answers
40 views

AppleScript - Changing message status field of selected mail in Outlook

Is there anyway to change MessageStatus column of outlook mail item? Outlook grid view provides different fields for mail item. One field is message status which indicates message is read/unread or ...
0
votes
1answer
32 views

How to select a tab in iTerm2 via AppleScript

I am quite a startet with iTerm2 and AppleScript, and can not find a way to let one of my 3 opened tabs get selected via an AppleScript. I have no problem to create a new tab and to select it, but I ...
0
votes
0answers
24 views

AppleScript Error sh: /Users/joco/bin/open_file_in_idea: Operation not permitted

I try to execute an one line AppleScript inside OmniGraffle. But I get the following error: AppleScript Error sh: /Users/joco/bin/open_file_in_idea: Operationnot permitted I also attached ...
0
votes
2answers
55 views

How can I execute AppleScript from Textedit?

I have the following AppleScript code in a Textedit file: set the clipboard to (do shell script "date +%d/%m/%y") tell application "System Events" keystroke tab using command down keystroke "...
0
votes
0answers
40 views

Applescript to set environment variable before opening terminal

I have the following Applescript in a workflow assigned to a service hotkey that opens a terminal in a given Finder window: tell application "Finder" set myWin to window 1 set thePath to (...
1
vote
1answer
57 views

Lock Screen using terminal? Osascript is preventing keystrokes

I want to lock my Mac's screen remotely. I don't want to sleep my Mac. Only the screen. I don't want to require a password every time I put my monitor to sleep (system prefs/require password). And ...
0
votes
0answers
23 views

osa script to get user input with if condition

I want to run osa script to run in self-service application. first this line needs to be displayed: osascript 'tell app "System Events" to display dialog "Save and close all your files and ...
3
votes
2answers
95 views

How to write a text in Terminal using AppleScript?

How can I insert a text into Terminal.app using AppleScript? I don't mean to execute it (press Enter). Only to insert it. My current script almost works: tell application "Terminal" activate ...
1
vote
1answer
49 views

Running FFmpeg in Automator/AppleScript

I have written an apple script previously to automate a task I do in my work many times. With Apple updating to Catalina I will lose the use of Quicktime 7 (which is part of my Image sequencing ...
0
votes
0answers
30 views

Applescript service which utilises “on idle”?

I have been trying to run a script on a recurring basis via an apple service. Most answers I have seen have been are for 'stay-open' apps - whilst this possibly works as a solution and I have glanced ...
1
vote
2answers
27 views

How to Break up a Long Element List into multiple lines of code (Applescript)

In applescript, how do I make this a multi-line/easy-to-read property list? set props to {target:"Safari", slideNo:2, propsUrl:"https://docs.google.com/presentation/d/slideId/preview", rewardsUrl:"...
0
votes
1answer
35 views

Give assistive access to a single applescript

I have this script: #!/usr/bin/env osascript activate application "SystemUIServer" tell application "System Events" tell process "SystemUIServer" to keystroke "q" using {command down, control down} ...
0
votes
1answer
31 views

Applescript: Waiting till AFTER QuickTime Movie Recording Window is Active

I'm trying to resize a Quicktime Movie Recording Window--only after it's active. Is this possible? The below script does work––if I hardcode the delay time. Any help is appreciated. Thanks do ...
1
vote
1answer
42 views

Setting arrangement of new Finder Window via AppleScript

I want to create a new Finder Window, and change the default arrangement from "None" to "arrange by name". Here is my code that does everything except the arrange by name part: tell application "...
3
votes
6answers
202 views

Is it possible to script what applications should open certain file extensions?

I have a new Macbook Pro and I'm reminded that my development environment isn't tailored to what I setup on my previous Macbook. I was curious if it's possible to create a script in either AppleScript ...
0
votes
0answers
11 views

Applescript automating setting Security Config in Outlook365

I am attempting to automate setting up laptops. So far I've managed to script adding a new account with the correct parameters. Next is to select the SSL certificates that have been installed on the ...
1
vote
0answers
53 views

Apple Script with Terminal Commands

I'm trying to create an application that would automate a couple of Terminal commands. I need the application to open once I drop a file on top of it, run the commands, and close. The sequence of ...
-1
votes
2answers
30 views

Unminimize window Apple script not working when upgrading from El capitan to Mojave

I have an Apple script that I found somewhere that unminimizes windows. It worked on El Capitan but now it doesn't in Mojave. I assume there was a change of syntax but I know nothing about apple ...
0
votes
1answer
30 views

Automatically download software update over a specific network

I want my mac to automatically download updates for me only if I am connected to a specific WiFi network. Is this possible with a script? If so, how?
1
vote
0answers
40 views

Applescript to set terminal window to specific size

I found this question Is it possible to define the width/height of a Terminal window with this command: osascript -e \'tell application "Terminal" to do script and tried setting my ...
0
votes
1answer
38 views

AppleScript to connect Magic Mouse on iMac

I'd like to write an AppleScript that will connect my Magic Mouse 2. Basically, in words, I'd like a script that will show up in "Services" that opens system preferences, goes to Bluetooth, finds the ...
2
votes
2answers
79 views

OS X - build a bash function to send notifications via osascript / Applescript

Hoping some one can point out what I am doing wrong. After looking through several threads, plus lots of experimentation, it feels like something simple is wrong. The threads I read include How can I ...
1
vote
1answer
59 views

Help with AppleScript to automate Numbers Cell Formatting

I do several mundane repetitive tasks using Numbers App on a Mac, and wish I could just automate the same with the help of AppleScript. I got Numbers Spreadsheet with several tables, on the selected ...
1
vote
1answer
51 views

How do I stop an AppleScript script that is stuck in an endless loop without restarting my Mac?

I stupidly ran an AppleScript script on my Mac running macOS Mojave and the script is running in an endless loop. I thought something obvious like pressing the Esc key would end the program. However, ...