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
2answers
56 views

Make AppleScript turn a variable into the items between two specified items

set theList to {"1", "", "", "apple", "acda", "", "3454", "ImportantStuff", "important1", "important2", "important3", "NotImportantStuff", "2", "", "efrg"} set theImportant to items between "...
0
votes
1answer
17 views

Adding column to multiple identically formatted tables in Numbers

I have a document in Number that contains many tables with the same format/columns but different content. I'd like to modify the format for all, adding a new, empty column in the same place with the ...
2
votes
2answers
40 views

Apple Remote Desktop Shutdown

I am relatively new to Macs and their osascript syntax. I have a mac mini set up as a server and I am trying to use Apple Remote Desktop to send a command to one of the iMac workstations. When I send ...
0
votes
0answers
28 views

AppleScript: Wait for Firefox Page to load

https://apple.stackexchange.com/a/320105/319746 I was trying to find a Firefox equivalent to the script in the link above under the line "Safari's Reload button", which monitors particular properties ...
3
votes
0answers
37 views

Is there any way to create an iTunes smart playlist with a user defined text field as the condition?

I'm using iTunes 12.8 with Yate by 2manyrobots (https://2manyrobots.com/yate/) to manage metadata for a library of approx 50k AIFF tracks. Yate has the ability to retrieve data from Discogs and ...
2
votes
1answer
66 views

Make AppleScript delay a random number between x and y?

set DelayTime1 to {18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58} set DelayTime2 to ...
1
vote
1answer
43 views

How to make AppleScript read the items of a variable that are numbers

set theList to {"123", "124", "abc", "125", "efgh", "126"} set theNumbers to numbers of theList return theNumbers How can I get AppleScript to recognize which items of theList are numbers and assign ...
0
votes
2answers
44 views

AppleScript sum of a list

I'm trying to get the sum from a list. The list newTotal: {"30.00", "30.00"} repeat with each from 1 to count of items of newTotal set myFinalTotal to myFinalTotal + each end repeat But the ...
0
votes
1answer
37 views

Applescript to filter the clipboard

Let say I have this in my clipboard : ************TH4F fsdfssdggg0878 Ex.US Unknown 0 $100.00 05/24/17 04:40 No Bonus ************TH4F fsdfssdggg0878 Un.UK Unknown 0 $50.00 05/...
0
votes
1answer
39 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 ...
2
votes
1answer
64 views

Automate moving and renaming files

I have files nested within multiple sub-folders. I want to move these files, one folder up the folder structure and rename the files as per its new parent folder. I will need this to be automated with ...
0
votes
1answer
51 views

Batch edit ID3 music tags using custom algorithm

I like to keep my iTunes library organised and all files well-tagged, so I often spend enjoyable yet unreasonably long amounts of time editing all the ID3 tags manually. Call it OCD or perfectionism, ...
0
votes
1answer
47 views

List all Outlook folder and subfolder with Applescript

I want to merge an Exchange account in IMAP. I moving all folder manualy in IMAP account but some emails are corrupted and all corrupted mail beging with Content-type: multipart/mixed; ...
1
vote
0answers
37 views

Replace font in incoming mail [mail.app]

I'm trying to write an Applescript (my first) to change the font of incoming emails using a rule in Mail.App. In particular, some tasteless individuals use Comic Sans, and I want to change their ...
0
votes
1answer
44 views

AppleScript : separating number from text in variable

I have a script which calculate the timeframe between date and return the result in days or month or years. For exemple, given myResult = "6 Days" How can I separate the number from the text ? I ...
0
votes
1answer
70 views

if external disk found by terminal applescript

Hey so MacBooks have this nasty habit of not mounting external disks when plugged in before... reference link the solution is quite simple with terminal eject the disk and the manually unplug replug ...
0
votes
0answers
20 views

Smart Folder from arbitrary script output?

This is a long shot, but is it possible to create a Smart Folder which, instead of building its search using the Search Criteria UI, but instead use the properly formatted output of necessary for a ...
1
vote
1answer
35 views

How to use lock screen events as a trigger for a script?

My Magic Mouse 2 died today and I thought it would be cool if I could use the locking of the screen as a trigger to send a push notification to my iPhone to remind me to plug my mouse in to charge. I ...
1
vote
0answers
27 views

Help with Apple Script for dealing with duplicates in Numbers

I had a script that I used to find duplicates in a numbers document and to highlight the duplicate in red. Well I now have a file where there are multiples of the descriptor in column B that are ...
3
votes
2answers
43 views

How can I make two applications activate from an AppleScript app?

So I am playing around with AppleScript and am quite new to it. How do I make the script quit both apps if: app1 and app2 are running or if app1 or app2 is running and run them if they are not ...
0
votes
0answers
32 views

AppleScript to window in another Space?

I'm trying to adapt an AppleScript that is using System Events, based on calling the front window of the application I want to control. The script is working okay if the application is in the same ...
7
votes
3answers
829 views

How to create an executable file for an AppleScript?

I want to create an executable file that when run will send a popup. I have the code for the popup osascript -e 'tell app "Finder" to display dialog "message"' but don't know how to create an ...
0
votes
1answer
33 views

Lock every object across entire keynote deck using applescript?

I'm trying to use an applescript to lock every object across every slide of a keynote deck, with only partial success. I've provided the code I'm using below. So far it works, but it seems to skip any ...
0
votes
1answer
94 views

AppleScript to create a new Outlook email using selected text as subject?

I have a workflow that involves creating emails by copying and pasting text into the subject. I think an AppleScript could do much of the heavy lifting. I'd also use Automator to set up the input as ...
1
vote
1answer
27 views

Auto Typer onto Unfocused Application

How do I execute commands such as typing out text, onto an unfocused application in the background? For example, I want to have it type out text in a messaging application while I'm on my browser. ...
1
vote
2answers
57 views

sub Applescript with Global / property

I'll like to run a second applescript with variable from the first Applescript. If I do a first script to property myName : "Kevin" And a second script with : set remoteScript to (load script "/...
1
vote
0answers
24 views

AppleScript : to do Javascript action in Safari repeatedly

I created this script to highlight some data points in Safari. This was working fine but I had to restart the script often as shorting the data in a different order remove all the highlight ... I ...
1
vote
1answer
21 views

Applescript : Merging list

I'm trying to merging two list but always have an error set myNewList to "" set myClipboard to the clipboard set theList to words of myClipboard ##set theLength to (get length of mylist) set ...
1
vote
1answer
54 views

Test if application has windows on current space

Scripting different desktops in recent macOS versions is difficult, but one scenario I wanted to accomplish is to open a document in Safari in a specific window: If a Safari window is open in the ...
0
votes
1answer
22 views

Using Automator services (Quick action) with Office 365

I've tried and searched a lot of time now but I can't get my services running under Office 365 (e.g. Word) If I right click and look under "Services" (I hope it's called that I have a german version) ...
7
votes
2answers
678 views

Removing all characters except digits from clipboard

I'm trying to refine a script I use within an Automator program and I would appreciate your help on this. The program is designed to mark a telephone number into clipboard make a tel:link and send it ...
1
vote
1answer
49 views

Applescript error: “Connection is invalid” when app quits

I'm working on some code to check on the currently open tabs/windows in my installed web browsers, like so: on checkbrowser() if application "Safari" is running then tell application "...
0
votes
2answers
28 views

Changing Sound Outputs w/Applescript (I seem to have misplaced my tab group)

I'm starting with the disclaimer that this is my first time posting, so if I breach etiquette, I promise it's by accident; just let me know. I'm trying to make an AppleScript to change the sound ...
0
votes
1answer
74 views

Calling Screencapture of a Web Page in AppleScript

As a newcomer to AppleScript, it is quite possible that I am missing something obvious, but I would appreciate feedback! My intention is to use Safari to load a series of images from an issue of The ...
0
votes
1answer
38 views

Applescript : refer to an app from a variable

I sometime use Safari, sometime Safari Technology Preview, I was thinking that would be nice to just refer it once in a variable a bit like this set SafariBuild to "Safari Technology Preview" tell ...
0
votes
0answers
24 views

Working with Apple HTML class data in AppleScript

I saw the following line of code in this post on AppleScript coding of HTML class data. do shell script "osascript -e 'try' -e 'get the clipboard as «class HTML»' -e 'end try' | awk '{sub(/«data ...
0
votes
1answer
34 views

Tell application next track inside repeat

I am trying to define script to play next on iTunes an Spotify like this. on run {input, parameters} set apps to ("Spotify", "iTunes") repeat with thisApp in apps tell application ...
0
votes
0answers
21 views

Macbook Pro Disable Touch bar [duplicate]

A few days ago, I started to have problems with the touch bar. I need to turn off completely because it's too annoying. I found a post where there was a app in a GitHub repository but it was removed. ...
1
vote
1answer
34 views

Running Compiled AppleScript from DMG Doesn't Work

As a follow up for my previous question (Set the Working Folder of .app Created by Apple Script) I have the following problem. I have an AppleScript which is Poor man's Installer: tell me to ...
0
votes
0answers
51 views

Applescript (move file to folder) and highlight next file in finder

i made an applescript, fairly easy, to move a file to another folder in finder and use it with bettertouchtool as shortcut. tell application "Finder" move selection to folder ((path to home ...
0
votes
0answers
27 views

Rename JPG's Based on Portion of Parent and Subfolder and Number them Beginning with 100

I see similar questions have even addressed, but I don't see anything this specific. Is it possible to make a folder action that runs automatically and only on certain types of files (jpg)? And... ...
0
votes
0answers
14 views

Showing apps as overlays on any space using a hotkey

From my linux days, there were terminal emulators which allowed pressing a key, and then appearing as an overlay on any workspace. I was missing this feature on macOS, and was wondering is it possible....
0
votes
0answers
22 views

How to run an AppleScript from a Mail rule when screen is locked

I wrote an AppleScript to send an email with a hashtag in the subject to trigger@applet.ifttt.com and I created a Rule in Apple Mail to run the AppleScript when a new mail is from a specific sender ...
0
votes
1answer
52 views

Set the Working Folder of `.app` Created by Apple Script

I have a simple Shell File .sh which copies files form the PWD to a destination folder. This is basically Hand Made installer of a program. I want to create an APP from it. The idea is to have the ...
1
vote
0answers
34 views

AppleScript : Remove class if [closed]

How can I remove each class on Safari, only for specific text ? I know this script bellow would remove every class named : sortable itemDescription tell application "Safari Technology Preview" ...
2
votes
1answer
265 views

How can I automate mouse clicks and keyboard input with Automator in Mac Mojave?

If I position my mouse cursor at a certain point on the screen, is it possible to use the Automator or AppleScript to "click" the mouse, enter a keyboard shortcut (say, command-5), press the return ...
1
vote
1answer
67 views

How can I use variable in AppleScript for name of browser?

I'm trying to streamline an AppleScript which monitors whether tabs in web browsers are currently open to specific sites. I can repeat the same block of code multiple times, clunky but it works: ...
0
votes
0answers
53 views

Applescript temporarily stop user input/detect through mouse and keyboard

I've looking through apple forums and here looking for a solution. The only solution I could find was to permanently disable the built in Keyboard (which is clearly not a great solution). Can anyone ...
1
vote
1answer
76 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
vote
1answer
101 views

Take screenshot of screenshot with AppleScript

I want to open an image on the desktop with the 'Quick Look', then screenshot it, and then open the new screenshot to take another one of it. In resume, I want to know how to screenshot an image that ...