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

How to create application that allows text or links dropped over its icon?

I'm trying to create an application that allows the user to highlight text and drag it on top of the application icon in order to process it. This is similar to the behavior of TextEdit and Terminal. ...
0
votes
0answers
12 views

How to create an application with applescript that will be able to open a file from finder

I would like to create an application for a command line program I installed with Homebrew. The command's executable is located in /usr/local/bin/ and it accepts files as command line arguments. It's ...
1
vote
1answer
25 views

AppleScript 'choose from list' - I'm having trouble with Multiple Selections

I have a series of AppleScripts which are saved as apps. For simplicity sake let's say the apps are literally named App1, App2, and App3. I've made a simple list that asks the user to make a selection,...
0
votes
0answers
26 views

How do I shutdown a remote Mac using AppleScript if a 'user' is connected? I need to override Shutdown confirmation

I have a bash script that shuts down a headless Mac in my office without needing to sudo… ssh headless@XXX.XXX.XXX.XXX osascript <<EOF tell application "System Events" to shut down EOF The ...
0
votes
1answer
45 views

Automator/AppleScript: move folders to a location based on their name

I'm very new to scripting and Automator but I am trying to figure out a way to have folders automatically moved to a desired location based on the beginning and ending of their names. for example: If ...
2
votes
1answer
42 views

AppleScript 'choose from list'. How can I run a different command if multiple sections are chosen?

I have an AppleScript which manages my home made After Effects render farm. The farm is made up of three render machines. The script asks the user to make a selection of what machine(s) they want to ...
1
vote
0answers
29 views

File » Revert to Previous: Where are versions stored?

Over time you learn some tricks on your Macbook. TextEdit has this really neat feature, where it takes care of autosave and allows you to revert to nearly any prior edit stage of a document. Question:...
0
votes
2answers
44 views

How to remap MacBook keys [duplicate]

So, I play a game and I am unable to quickly reach my 6,7,8,9,0 keys. Is there any way that I could revamp my keyboard keys so that, for example : z would result in the same keystroke as my 6 x ...
0
votes
0answers
25 views

Need help with small AppleScript for Mail app [closed]

Is it possible to get the Mail system change its email signature automatically to specific recipients? If yes, can somebody please help me to write a code for that so I can implement it ? Example: I'...
-1
votes
0answers
23 views

Can you get reminders in Reminders.app without launching the app

I am using BetterTouchTool and you can add AppleScript widgets. Here's one that gives me the first non-completed reminder: tell application "Reminders" set activeReminders to name of (reminders ...
0
votes
0answers
17 views

Late at night with inverted colors on, dynamic background is inverted as well, how to stop it?

I'm having the Catalina background in dynamic setting. I feel it really helps me to have a background that shows night and day on my laptop. However, now that I'm experimenting with working late at ...
0
votes
0answers
32 views

Apple Script “on idle” only works once with desired speed

I try to use Apple Script to get Keynote directly into presentation mode, and quit when the presentation stops. As one (of many) approaches I tried a Script saved as stay open application: on idle ...
-1
votes
0answers
26 views

Can't paste into Apple Script dialog box

I built a workflow combining AppleScript and Shell Script. Running the workflow in Automator I am able to paste from the clipboard into the dialog box that AppleScript creates while testing. When ...
1
vote
1answer
72 views

Script or App to auto write URL of browser-downloaded files to their respective Comments field (metadata) in the files Get Info sheet?

I'm looking for a script or any other way to automatically write the URL of a download file to its "Comments" field, as shown in a files Get Info sheet (Command+I in Finder). Anyone know if I could ...
1
vote
0answers
39 views

Modify iTunes library from a script

In my project, I have a bunch of music tracks in a directory of my computer. I want to add them to my iTunes library in an automated way. I also want to group them in playlists depending on the ...
1
vote
1answer
74 views

How to get last active tab in Safari using AppleScript?

I'm pretty new to AppleScript and wanted to make a simple script for Safari. In fact, I want to activate the last active tab after closing the current tab. This is where I'm stuck tell application "...
-2
votes
0answers
38 views

AppleScript Automation for select all files in folder, create/rename .zip name of parent folder

AppleScript Automation for select all files in a folder, create/rename ZIP with name of parent folder Can somebody help me with AppleScript? I tried to solve my problem with Automator but cant get it ...
1
vote
1answer
36 views

How to mount a .dmg file with JXA?

I made the below AppleScript tell application "DiskImageMounter" try open alias imagePath on error errText display dialog "Could not mount" & errText end try end tell ...
1
vote
1answer
27 views

Google Backup and Sync super slow and 100% CPU usage for days

I recently copied a lot of files into a synced folder to be back them up. The total file size was about 30GB, I have 10MB up/100MB down internet connection. So in a perfect world 8 hours should have ...
0
votes
1answer
22 views

AppleScript app not responding force close

I have a simple script: caffeinate -di that I saved as an app. When I click on the app it runs the process and stays in the dock. When I click on the Dock icon, it says "Application Not ...
1
vote
0answers
17 views

How do I access my .plist with JXA (Javascript for Automation)?

According to the Script Dictionary: PropertyListFile Object [inh. File] : A file containing data in Property List format properties: (PropertyListItem) : the contents of the ...
0
votes
1answer
35 views

Batch removing part of filenames using Automator

I'm trying to create an Automator script that removes portion of a filename after a delimeter while preserving the extension. Files are usually called like 1-cropped_DSC5888.jpg, 2-...
2
votes
1answer
31 views

Using AppleScript to change text color in Keynote

I am tired of clicking through the color wheel to get custom colors and I would like to use AppleScript to automate with BTT a simple button to change the selected text color to a set of company ...
2
votes
0answers
34 views

How can I run an executable as sudo by double clicking in Finder?

I just wanted to see if anyone more experienced with MacOS (primarily develop on Windows) can help me with a small issue I'm currently trying to resolve. Based on the comments I just want to add some ...
3
votes
2answers
81 views

Get page number from Metadata instead of Index

In Applescript, we can get the index number of the current page we are viewing in Skim with the following code: tell application "Skim" activate set theDoc to front document get index ...
1
vote
2answers
60 views

Using sudo command in shell script in Automator app?

I'm planning to make a small Automator app to make these commands into something I can run regularly: rm -rf ~/Library/Caches/* rm -rf ~/Library/Saved\ Application\ State/* sudo rm -rf /Library/...
0
votes
1answer
45 views

Where to find docs for the supported actions for `tell application` statement

Where to find docs for the supported actions for tell application statement. Similar to tell application "Finder" to close every window How can I know that Finder is supported and also close every ...
0
votes
2answers
60 views

AppleScript for locking the screen in Catalina

Is there a way to build an AppleScript for locking the screen? I want to add a Quick Action (and the relative button on the Touch Bar as described here) This solution i.e., tell application "System ...
0
votes
0answers
44 views

Requiring user input in order to run a script which controls Safari

Using Script Editor, I've created the following script to close tabs and open a particular window: tell application "Safari" repeat with i from (count of windows) to 1 by -1 repeat with j ...
0
votes
1answer
23 views

Running perl shell script from AppleScript on Mojave

I have a simple AppleScript that calls a perl shell script to replace a string with another string (here one with two) in files with specified file extensions (here .txt and .xyz). It used to work ...
0
votes
1answer
35 views

Regarding AppleScript, is it possible to change “page layout” export option when exporting Numbers documents to PDF?

A little while ago I cobbled together a short AppleScript for exporting multiple Pages documents to PDF at one time, and now I want to do the same with Numbers. The basic principle is the same and the ...
1
vote
0answers
69 views

Automator slows down to a crawl following a simple AppleScript workflow?

Context: I am trying to use Automator to turn the pages of a web-based e-reader open in Google Chrome, copy their respective HTML code from Chrome Developer Tools (which is already kept open), save it ...
0
votes
0answers
20 views

Paste preset html code via Applescript into text edit

Hi so I want to preset specific line of html code, and then paste it with key combo using Applescript. Here is the html code: <li> <div class="topic-title"> <h2>Topic title goes ...
1
vote
0answers
19 views

How to open a window and tab in Terminal via Javascript automation

I want to use the Script Editor program to create a script (Javascript) that will recreate my Terminal window and tab setup. I open a few windows, open tabs within those windows, label the tabs, run ...
0
votes
0answers
11 views

Get artwork of song Apple Music

I can't seem to be able to get the artwork data of my currently playing songs... tell application "Music" if running then set songArt to data in artwork end if end tell This should ...
0
votes
1answer
132 views

Automator: remove last 9 characters in filename

I'm hoping to find a solution that will be a simple fix. Here's what I want to do: Every week I have a new batch of files that I process through Apple's Automator to complete various functions such as ...
1
vote
1answer
56 views

AppleScript to massage URLs

I want to have a Services menu item that takes the selected text (a URL) and escapes the percent character and the # character: Replace % with \% Replace # with \string# I copied and edited an ...
1
vote
1answer
38 views

How can I initiate scripts to run on my Mac from triggering events on my phone?

I would like to replace the mechanism I currently use to trigger scripts to run on my Mac. Currently, I use mostly IFTTT applets that create text files in Dropbox. Then I attach folder actions to ...
0
votes
2answers
55 views

Repeat AppleScript if User Confirms a Pop-Up Dialog

I built a script that selects and copies all text from the front Safari tab, closes the tab, and pastes the text into the front BBEdit document with a couple blank lines of padding. I'll run it when ...
-1
votes
1answer
50 views

Creating a New TXT Document within a Newly-Created Folder

I'm building an Applescript that currently creates a new finder folder inside a certain folder: tell application "Finder" activate make new folder at folder "RecUp Memos" of folder "Dropbox" of ...
0
votes
1answer
32 views

How to close specific URLs with Applescript

I'm trying to write a little applescript that closes tabs that have URLs that do not contain certain text, but I can't get it to work. Right now, my script closes every tab regardless of the URL. ...
0
votes
1answer
63 views

In Automator, can I combine 2 or more variables into a new variable?

First off, let´s set the scene. I am trying to make a small applet (.app) to include in a DMG-file for distribution. The .app file will only activate when a user drags a folder with my product-files ...
1
vote
0answers
28 views

Include a binary in applescript bundle?

I've got an applescript that calls a binary on my computer (installed with homebrew). I'd like to share the applescript with friends, but can't guarantee that they'll have the binary. For example, a ...
0
votes
0answers
31 views

Is it possible to AirPlay my Mac's desktop to an Apple TV via the command line?

I'm ultimately trying to automate a process which AirPlay's a Safari browser to an Apple TV. I'm familiar with the say -a "AirPlay" command which only AirPlay's audio so I was hopeful that there could ...
1
vote
1answer
52 views

How to reproduce Windows Chrome BAT files setup in macOS 10.15

On Windows, Chrome is my primary browser. I've developed a series of *.bat files on Windows that each open a series of tabs with specific URLs in Chrome: @echo off set BROWSER=chrome.exe set ...
1
vote
1answer
32 views

How can I create a shortcut to open Safari PDF in Preview?

If I open a PDF file in Safari (say, from a website), it is shown in a browser window or tab, and from there I can hover over the bottom of the page and from there click on this overlay to open the ...
0
votes
1answer
67 views

AppleScript tell Numbers make Pop-Up Menu from Contacts Group names, wait for input, then Email ScreenCapture

This is a bit long-winded, but here goes… Using AppleScript (vanilla, please), I want to automate the Numbers spreadsheet I made for my wife’s music lessons Accounts (which she uses four times a ...
0
votes
0answers
43 views

AppleScript - Repeat While with Return

My goal is to run a script continuously for 10 seconds, returning the result while the script runs. Right now when I run the script below the script stops after returning the result. If I remove the ...
1
vote
0answers
57 views

ApplesScript, autopress space bar

I am trying to run a script that will double press space bar in a fast sequence after this command repeat 10000 times tell application "System Events" to keystroke "g" using command down ...
0
votes
0answers
41 views

Applescript (Adobe Illustrator) find coincident X coordinate on a path for any given Y coordinate

I have two lines as shown in the screenshot below (Adobe Illustrator file) which my script produces. Is there any way, using AppleScript, to find the value of X for the coincident points on the ...

1 2 3 4 5 52