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
0answers
18 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 (...
0
votes
1answer
50 views

AppleScript quicktime to record iPhone screen

I am looking for a an Apple Script to tell Quicktime Player to start a new recording of the attached iPhone (so record an app doing its thing) and with the specified audio input. Is this even ...
1
vote
1answer
38 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 ...
3
votes
2answers
70 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 ...
0
votes
0answers
16 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 ...
1
vote
1answer
42 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
1answer
28 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 ...
8
votes
4answers
13k views

Script to raise a single window to the front

In a script I'm trying to find the Terminal.app window containing a specific tty device and raise that window to the top. Here's what I have in Applescript so far: tell application "System Events" ...
0
votes
0answers
22 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
7k views

Have Automator parse down folders and list all filenames without their extension

Automator newbee question here. I've searched around and just can't find what I need (nor fully grasp how things work :-( ). I would like to have Automator parse thru a given folder, which is ...
0
votes
1answer
26 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} ...
1
vote
2answers
23 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:"...
3
votes
1answer
445 views

Can AppleScript be able to click the menu extra of a 3rd-party app?

Many 3rd-party apps have small menu icons at the top-right corner of the menu bar such as Evernote, iStat, Parallels Desktop and so on. I tried to write some AppleScripts to click those menu icons, ...
3
votes
6answers
165 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 ...
1
vote
1answer
39 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 "...
6
votes
2answers
12k views

Can Applescript be used to automate a screen recording session on OS X?

I need to accomplish the following tasks from a script: Initiate a screen recording (with system audio). After a set delay, stop the recording. Save out to a file. Close the recording. I've tried a ...
0
votes
1answer
25 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
votes
2answers
24 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 ...
2
votes
2answers
61 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 ...
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
45 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 ...
17
votes
2answers
9k 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
33 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 ...
1
vote
0answers
37 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 ...
3
votes
2answers
78 views

Open a new MacVim window with AppleScript

I can open a new iTerm window like this: tell application "iTerm" create window with default profile end tell How do I do the same but with MacVim?
301
votes
12answers
170k views

How can I trigger a Notification Center notification from an AppleScript or shell script?

I'd love to be able to take advantage of 10.8's Notification Center features in AppleScripts and shell scripts I write. Is there a built-in command or a third-party library I can use from either an ...
5
votes
4answers
180 views

How to start an application when a specific disk is mounted

I store all my music on an external drive. I have iTunes set to start when I login. However, iTunes always starts before my encrypted drive has mounted, and so iTunes complains it can't find its ...
1
vote
1answer
39 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
3answers
108 views

Node Program Runs in Terminal, but Not As a “do shell script” AppleScript

I have a call (“mercury-parser” via Yarn, using the full path to the call) that converts Web pages to lines of structured text (the page used in the call describes the service): /Users/me/.yarn/bin/...
1
vote
1answer
38 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, ...
3
votes
2answers
31 views

Homebrew uninstalling fails

I am trying to uninstall a cask using homebrew, but each time it fails due to (I believe) AppleScript failing to run. I believe this issue stems from my multiuser setup (I am a non admin). Error: ...
0
votes
0answers
45 views

Applescript how to choose file for all files or list of extensions

I have a cross platform project and need to do it in GoLang, but I do not have Mac. Could you provide correct syntax to the following? 1.Choose file for all file type? choose file with multiple ...
1
vote
1answer
54 views

How to paste files using Applescript (or bash)?

I want to paste a file copied by Finder in the terminal. Sth like pbpaste but for binaries. (pbpaste itself just returns the basename of the copied file.)
4
votes
1answer
8k views

How to open a shell script in a new Terminal window and run it with administrator privileges

I need to programmatically open a shell script in a Terminal window and run it with administrator privileges. I'm using osascript as it displays a convenient prompt for an admin login/password. I'm ...
1
vote
3answers
1k views

Applescript run code at specific time

I tried different way to run a script on a specific schedule / time, I found Lingon quite handy, I also try using calendar but the result was very bad. I wrote this : repeat set myDate to date ...
0
votes
1answer
32 views

AppleScript get filename from URL and apply Decode URL

I've got the following AppleScript that displays a notification once a download has been added: set yourpath to (the clipboard) as POSIX file set a to do shell script "basename " & quoted form of ...
0
votes
1answer
24 views

iphone 6 super duper hard [duplicate]

Why is my iphone 6 english in languange but on apple app store it is chinese?
2
votes
2answers
71 views

Can I use AppleScript to delete files on NAS listed in a file?

I am cleaning up my iTunes folders. I realized that there are more than 3k of files which are actually not in iTunes. I identified them and I have all of them inside a text file called "untitled.txt" ...
1
vote
1answer
78 views

Adding a line break to a shell output in AppleScript

I've got a script working but not the way I want. Here's the script return do shell script "BLUETOOTH_DEFAULTS=$(defaults read /Library/Preferences/com.apple.Bluetooth); SYSTEM_PROFILER=$(...
0
votes
1answer
69 views

Automate URL Redirection in Mac OS Automator

I would like some assistance to write an AppleScript to automatically redirect amazon.com to smile.amazon.com. I tend to always forget to use smile. With this automator I will never forget to. ...
0
votes
0answers
46 views

Getting Syntax Error “Can’t get every text item.” while creating new Service on Mac

I am getting the following syntax error while creating new Service on Mac while using below script, I have attached screenshot as well: "Can’t get every text item." on searchReplace(theText, ...
0
votes
1answer
63 views

applescript CURL with authentication fails

QUESTION: i need a working method to be used in applescript to get the right source of the page, WITHOUT loading the page. sample link: https://www.idealista.it/immobile/16679597/ result: wrong html,...
4
votes
1answer
48 views

PowerPoint Macro for Mac - load pictures like “Insert Photo Album”

PowerPoint on the Mac doesn't have the Insert Photo Album functionality which allows you to select images and new PPT created with one image on each slide. I have an old macro that does this on ...
1
vote
0answers
32 views

Default Volume Slider in Quicktime Movie Recording

Is there any way to change the default volume for a Quicktime movie recording? If always defaults to 0 (muted) when starting a new movie recording. I understand that this is done in order to prevent ...
2
votes
1answer
64 views

Sort files by spreadsheet

I have a folder than contains over 1000 text files. The text files are supposed to be organised in folders. I have a spreadsheet which states which text file goes in which folder: Is there any way I ...
1
vote
1answer
40 views

How can I stop AppleScript from converting variables like “\087” into their octal form when passing through bash?

I have a program I'm using to write xml with variables, and it passes through AppleScript and bash to form the final xml. However, one of my variables usually begins with "024", "054", or other three ...
10
votes
6answers
13k views

Using AppleScript to lock screen

I need an applescript which locks my Mac in the same way pressing shift+ctrl+eject would. I tried two different approaches, but both failed. The first one was to search the internet for a script, ...
5
votes
3answers
530 views

Prepend folder names to file name and flatten file structure

I have a bunch of folders with various names, for example 2013-02 Snow and birds PICT0001.jpg PICT0002.jpg 2013-06 Bicycle trip edited_panorama.jpg From phone DCIM0001.jpg ...
0
votes
0answers
18 views

macbook pro starts up when asleep and not connected to power

I occasionally open up the bag I use to carry my macbook pro (running Mohave) and find the fan is running and the computer is hot. This is usually after a red eye. When I try to log into the ...
3
votes
3answers
815 views

AppleScript: How to add currently-playing Apple Music song to a playlist?

I've got a little AppleScript in Alfred that marks the currently-playing song as "Loved", it looks like this: tell application "iTunes" set loved of current track to true end tell This script ...