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
17 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
52 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 ...
3
votes
3answers
616 views

Add currently playing song to Apple Music using AppleScript Editor

I am trying to make an AppleScript that automatically adds the current track that I am listening to on Apple Music to my library. What I have done so far is set the option "Add songs to Library when ...
1
vote
0answers
31 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 ...
0
votes
1answer
58 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
2answers
723 views

Automator: Move files into new subfolder based on file's name

Disclaimer, this may not be something Automator can do. I have a large directory of movie files. In order to use a piece of software, each movie needs to be in it's own folder. I'd like to create ...
3
votes
2answers
74 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
1answer
70 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 "...
9
votes
4answers
11k views

Any way to change sound output device via Applescript or shell?

I would like to change sound output device (like option-clicking the speaker icon in the menubar) via script, but NOT through UI scripting, e.g., launching the System Pref panel. UPDATE: Using @...
4
votes
4answers
252 views

Switch to a specific input source in OS X in Catalina with AppleScript

I use different keyboard layouts and switched between them using a simple script on changeKeyboardLayout(layoutName) tell application "System Events" to tell process "SystemUIServer" ...
1
vote
1answer
31 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 ...
-1
votes
0answers
31 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 ...
2
votes
3answers
1k views

Temporary Folder Path for Apple Script

set targetFile to (path to temporary items as string) & fileName I am trying to download a web image to temporary folder by curl in a Apple Script. According to the above code, the curl ...
1
vote
1answer
35 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 ...
7
votes
3answers
2k views

How to make the “Page Down” key on the keyboard move only half the distance as usual

I'm a computer programmer and use Xcode so I am constantly scrolling up and down. Often times I would like to move the page down but not as much as the "Page Down" keyboard key moves it. I would like ...
0
votes
1answer
21 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
1answer
23 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 ...
1
vote
0answers
16 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 ...
1
vote
3answers
1k views

AppleScript to turn on the Accessibility Keyboard in High Sierra

How can I write a script to turn on the accessibility keyboard present in macOS High Sierra? It's of course possible to do this by going to System Preferences > Accessibility > Keyboard > ...
0
votes
1answer
34 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
27 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 ...
1
vote
1answer
35 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
1answer
33 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
2answers
51 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
41 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
52 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
29 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
51 views

Applescript problems with renaming a file and getting the alias to change it's name as well

I have run into a particular problem with a larger script that I am writing. I am trying to rename all the files in a folder with a prefix of "temp_" and in doing so have the alias to that file still ...
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
2answers
99 views

Problem with Automator/AppleScript Question

I am building a program to delete files/folders. Here is how my program looks in Automator: The problem I am having is sometimes where the program runs I get this error: The program does work so I ...
1
vote
0answers
68 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
1answer
65 views

Syncing and deleting categories in Outlook?

I created a bunch of Outlook categories via AppleScript using the following command: make new category with properties {name:"Snooze2", color:"blue"} These new categories work as expected, but don't ...
0
votes
1answer
28 views

How to apply a Category to an Outlook Email using AppleScript

I have the AppleScript below for Outlook 2016. I am able to mark my mail as read, and I am able to move the email to the appropriate folder. But I can't categorize the email for some reason. Does ...
14
votes
5answers
32k views

Turn Wifi off/on with a single key?

Is there a way to assign the WiFi on/off function to one of the function keys like F4 that I otherwise never use? I assume Applescript would be required. However I may want to use a BASH script ...
0
votes
0answers
17 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
17 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
1answer
127 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 ...
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 ...
1
vote
1answer
52 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 ...
6
votes
1answer
17k views

How do I make the mouse click at current location using AppleScript?

So I've been trying to make a program using AppleScript, but there's one thing that's been teasing me for some time now - How do I make the mouse click at current location without using Mouse Keys? ...
0
votes
2answers
54 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
vote
1answer
165 views

Catalina Messages app: run applescript on receive new message & when the message is read?

Are applescripts for Messages still saved in /Library/Application Scripts/com.apple.iChat? That seems like an odd location, but I didn't find a folder for com.apple.messages I tried saving this in ...
1
vote
1answer
232 views

Keyboard shortcut in finder to launch >share via>airdrop

I'm for a way to share a group of selected files I have selected in the finder window, via airdrop, with a simple keyboard shortcut. since you can use cmd+c to copy, I thought there had to be a way I ...
-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 ...
9
votes
5answers
6k views

Change display arrangement in OS X programmatically

I periodically have to move my display around (physically1) and this requires also rearranging my display arrangement in System Preferences. Manually doing this all the time is a pain in the neck. ...
0
votes
1answer
30 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. ...
3
votes
4answers
354 views

How can I automate repeat mouse clicks, with delay, from fixed coordinates within a browser window?

Looking for a quick and dirty way to automate this mundane activity. I presume this could be done with an automation to press the mouse button from two separate pixel coordinates, with delay, so long ...
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 ...
1
vote
0answers
27 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 ...

1 2 3 4 5 51