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
17 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
19 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
55 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. ...
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
0answers
38 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
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,...
-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 ...
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 ...
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
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 ...
-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
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
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 ...
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 ...
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 ...
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 ...
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/...
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 ...
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 ...
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 ...
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
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 ...
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: ...
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
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 ...
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
64 views

Copy file from Terminal and paste in Mail

I would like to copy a file to the clipboard in terminal (as a reference like Finder does it) and then when writing an email, paste it into Mail as an attachment (CMD + V). I posted an example ...
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); ...
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
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
18 views

How to receive URI requests in applescript

I want to open a link like testApp://test And for that to open the AppleScript that will receive the "test". Is this possible and if so, how would I go about doing it? So far, I made this in the ...
0
votes
0answers
44 views

It is possible to open links with AppleScript?

I want to create an AppleScript that will open once I click a link in a browser. For example, on Mac App Store links, you can click a button that will open the App Store on your computer. How would ...
2
votes
0answers
34 views

Refactoring Inelegant AppleScript to Use Recursion

I've written an AppleScript to iterate through an app's menu choices, doing something with each item (e.g., get its keyboard shortcut). It works, though (being AppleScript) it's very slow, but I'm ...
1
vote
1answer
28 views

Return status of SleepDisabled in Applescript

I'm trying to do an Applescript to enable or not SleepDisabled (using pmset) depending on the state of SleepDisabled. Something like : set SuperSleep to do shell script "return status of ...
1
vote
0answers
29 views

How to execute a PKG file using a custom universal keyboard shortcut?

It may sound strange but I need to run a specific PKG installer whenever I trigger a specific custom keyboard shortcut. On Sierra 12.6 I've assigned a custom keyboard shortcut to sleep/lock-screen the ...
5
votes
1answer
74 views

How to set a variable to all the numbers located in a list?

Lets say I have a variable set to this: set myVar to {"asdf", "qwerty24", "23", "22", "21abc" "20"} How can I set a variable to the numbers in myVar, including those with text inside of the item--...
0
votes
0answers
31 views

Adding hyperlink within message content of new email using AppleScript

I've been searching the internet but am having trouble finding a way to attach a URL hyperlink to a new email using applescript. The most helpful link I've found is from 2008, and I believe the ...
4
votes
2answers
93 views

Toggle caps lock programmatically using applescript

I'm looking to toogle capslock programmatically using applescript. Here is something I tried to make it work. It seems to work for all other keys except capslock. tell application "System Events" ...
0
votes
1answer
20 views

Apple Script Time interval

I used a great script from CJK with no issue , but not sure what happen, recently I noticed some invalid result : startDate = "2019-05-31" (US Format) Then converted to "31-05-2019" MyDate (now) = ...
0
votes
1answer
46 views

Applescript to get MS Word current word count?

Is there an AppleScript command which will grab the word count of the currently open Microsoft Word® document?
0
votes
0answers
18 views

Unable to save applescripts-created email in drafts folder in Outlook version 16

So I've been using applescript with Outlook version 16 to automate some tasks. I want to create an email and then save it in the drafts folder but i've been unsuccessful. I've tried several ...