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
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
13 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
18 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
64 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
59 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
54 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
37 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, ...
1
vote
0answers
22 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.)
0
votes
1answer
54 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,...
3
votes
1answer
31 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
votes
0answers
34 views

applescript curl problem [duplicate]

could somebody help me please? i'm new to shell script and i know a little bit of applescript. however, i found how to get body html as string with a simple cURL like this one: set strCurl to (do ...
1
vote
0answers
20 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 ...
0
votes
0answers
24 views

Folder Action on Dropbox Runs More Than Once [closed]

I have an apple script than runs on a Dropbox folder. On a non Dropbox folder it works fine but when I move it to the Dropbox folder it runs more than once. It’s just a simple watching script that ...
2
votes
1answer
61 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
35 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
485 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 ...
-2
votes
0answers
31 views

AppleScript - can't find menu item (error -1719)

Quite new to applescript but looking to increase some of the efficiency of my work's department by eliminating multiple clicks from simple processes into one hotkey. I have an applescript that needs ...
0
votes
0answers
16 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 ...
2
votes
3answers
782 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 ...
2
votes
1answer
30 views

How to interact with a Numbers sheet via AppleScript?

This question is related to: SUMIFS with comparisons to relative cells where I'm trying to figure out a way to do what I want using AppleScript. I've been searching the Web to find a way to set ...
1
vote
1answer
82 views

Open url in new tab and paste the copied text

I'm new to AppleScript. I want to use AppleScript with Sci-hub page. In my scenario, I highlight DOI address -> AppleScript will open "Sci-hub.tw" page in new tab on Safari -> paste DOI address to ...
0
votes
2answers
49 views

Disable Thunderbolt ports in macOS Mojave to mitigate the Thunderclap vulnerabilities

Due to the Thunderclap vulnerabilities we need to disable all Thunderbolt interfaces (except the DisplayPort signal). We are using Late 2015 iMac running macOS Mojave 10.14.5. Currently there is a ...
1
vote
1answer
76 views

Auto Facetime call using Applescript, without confirm

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 ...
6
votes
1answer
3k views

Make a FaceTime call using AppleScript

Is it possible to initiate a FaceTime call with "+1 (###) ###-####" when I execute an AppleScript? Does FaceTime support AppleScript and how can I automate the start of a call?
2
votes
1answer
1k views

AppleScript Help: Wait for Safari Page to load

I am trying to create a script to open the URL csbsju.instructure.com in Safari, wait for the page to load all the way, click the login button, and then double check if the URL is correct (there's a ...
2
votes
1answer
255 views

How to stop the launch agent from repeatedly launching a given AppleScript

I'm trying to create a launch agent, which launches an AppleScript whenever a mouse is connected. Similar to these two questions: LaunchEvents key unrecognized in launchd plist (detecting USB device) ...
0
votes
0answers
21 views

How to make AppleScript ignore escape characters in string to make a Note

I have a python script that takes a user's input and inserts it into the name and body parameter of the make new note apple script. The problem is that any escape or special characters get interpreted ...
3
votes
4answers
4k 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 ...
3
votes
1answer
45 views

How to copy URL with page title from Safari to Pages

In earlier versions of Safari and Pages drag&drop of an URL from Safari to Pages resulted in a link with the page title as the text, and the URL as a link "behind" it. It still works that way in ...
1
vote
1answer
51 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/...
0
votes
0answers
41 views

How to force Safari to open links clicked in other apps in a “public” window

I wrote an AppleScript (saved as an app) awhile back that opens a new Safari Private window to a web-app site that requires a private window in order to have multiple windows to that site open and not ...
0
votes
1answer
32 views

Keyboard shortcut for a service stopped working

I have made a custom keyboard shortcut for Finder that runs a script that copies the full file path to the clipboard. The shortcut is Control + Alt + Command + C. It has always worked, but today it ...
2
votes
1answer
49 views

Is it possible to query the current user's Apple ID from the command line?

Is it possible to query the current user's Apple ID from the command line? I want to create an AppleScript (run-only) app that will run only for a specific user (or at least for a user signed in with ...
6
votes
1answer
9k views

Set size of window to exact pixels, and place via x, y coordinates

I would like to create a tool that allows you to set windows to exact sizes on the pixel scale to be able to have more precise screen divisions. For example, if I had four Terminal windows (and I ...
0
votes
2answers
40 views

How do I get Automator to move a folder to Appname.app/Contents/etc

I'm trying to create an Automator Quick Action to move a selected folder into the Resources folder of an app, accessed by clicking Show package contents in the Applications folder. There doesn't seem ...
-1
votes
1answer
55 views

How to script file for a Mac with several Terminal commands

I have few Terminal commands which i'm using so frequently,So i though to automate it to reduce the effort of copy-pasting the commands one by one in terminal and time. I created a .command file for ...
2
votes
1answer
32 views

Automator and/or AppleScript to automatically Command-F2 to enter Target Display Mode

I'm trying to use Automator with AppleScript to automatically hit Command + F2 to enter Target Display Mode. The script runs but I just get a beep/tone with no action. I don't know if there's an error ...
1
vote
1answer
37 views

MacBook Pro: Can't change the screen brightness

On my MacBook Pro 2012, I can't change the screen brightness. When I click on the brightness keyboard controls, nothing happens. Under System Preferences → Displays, the Brightness slider is missing: ...
1
vote
2answers
53 views

Script that checks for apps with open window asks 'Where is Electron" in Electron apps

I have a script that prints the bundle ids for all apps with open windows. When an Electron app is open (for example VSCode) the script asks "Where is Electron" and it shows all apps in the ...
0
votes
0answers
32 views

Distribute bash script 'silently' to multiple macos machines

We want to deploy a script 'silently' across all mac machines in organization. We have created a bash script that will run using launchd agent. We need to deploy the launchd agent and script on all ...
0
votes
1answer
21 views

error with automator applescript “do shell script” call (file not found) yet command line with same command works

I have a simple automator app that runs a simple script. It uses ssh to open a file on the local machine, MachineA, with an app on the remote machine, MachineB, and logs the ssh call. on run {input, ...
2
votes
1answer
94 views

Automatically open a terminal window and run a command, robustly

I am looking for a way to automatically open a new window of Terminal.app and run a command in it. I used to do this with AppleScript, in a way similar to this: tell application "Terminal" do ...
0
votes
1answer
23 views

AppleScript for Excel to select/copy all cells?

Applescript can tell Excel to select a specific range of cells, e.g. select (range "A1:B20") and you can copy cells: copy (range "A1:B20") However, how can you tell Excel to select all the cells ...
0
votes
0answers
14 views

how to open file type with app on remote machine via apple script app as default app for file type

I would like to set the default file association for a file type (PDF) to an Apple Script app. The Apple Script app will open the file type on a remote machine (using remote Apple events) with a ...
0
votes
2answers
620 views

AppleScript to set clock

I need to set the Mac clock to a specific date and time, to perform some testing. I'm new to AppleScript. Is it possible to write a double-clickable script to set the clock?( By “double-clickable”, ...
1
vote
1answer
29 views

How to make the items in a variable a single item

Lets say I have a variable Q set to {"a", "b", "c"} how can I make it so that AppleScript takes the items of Q and turns it into a single item so that Q is now set to {"abc"}?
2
votes
0answers
26 views

AppleScript to clean spam in Messages

I get a lot of spam in my iMessage, such gamble, sex etc. On my iPhone, it can be filtered into a separate column. But on my Mac, there is no way to filter messages from unknown senders, which is ...
0
votes
1answer
46 views

Prevent Terminal from overwriting preferences on exit

When a user loads my C++ program, I want Terminal to look a certain way. I solved this by wrapping my program in an AppleScript .app which overwrites ~/Library/Preferences/com.apple.Terminal.plist (...
1
vote
1answer
32 views

Dictation workflows don't activate keypress

I'm unable to get Dictation to run the keypress portion of a workflow. I've tried recording a keystroke in Automator, and manually writing an AppleScript (with both key code and keystroke commands); ...