Questions tagged [applescript]

AppleScript is a proprietary programming language in macOS to control and exchange data with applications.

361 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
519 views

Applescript to turn on mirroring and set resolution to Scaled + 1440 x 900 when external display is connected

When I connect an external display I need a script to automatically: 1. Check if external monitor is connected by detecting the "Attachment" tab exists. 2. Activate the "Attachment" Tab to focus. 3. ...
2
votes
0answers
61 views

Anybody have a clever idea to create a system wide override to force text editing shortcuts?

macOS defaults to a handful of convenient text editing shortcuts such as: ^e moving the cursor to the end of lin ^k deleting all characters after the cursor until the end of the line ^a moving the ...
2
votes
0answers
330 views

How do I create an Automator-based “Replace Text” Service that works with sandboxing?

I want to create a Service using Automator on macOS 10.12.6. I selected: Service receives selected rich text in any application Input is entire selection ☑️ Output replaces selected text I then ...
2
votes
0answers
69 views

Run an App with different folder as “~/Library”

I'm trying to set up the Minecraft game so that I can launch it from and run it onto a USB flash drive (portable game and savefiles without additional config to play on each Mac). This is normal ...
2
votes
0answers
249 views

Running an AppleScript on a remote computer using ssh

How would I execute an AppleScript that is saved on my computer on a remote computer?
2
votes
0answers
50 views

AppleScript delete file if not used/opended last 365 days

How to write/is it possible to write AppleScript, which will delete files in certain folder, if the file wasn't used/opened for a certain amount of time?
2
votes
0answers
84 views

Can an AppleScript Service discern if selected text is editable?

I have an Automator Service entitled "Calculator" that is comprised of a single "Run AppleScript" action. It takes the selected text and then performs a calculation on this input text. If the ...
2
votes
0answers
323 views

Deleting all files except some from a folder using applescript

I am trying to write an Apple script to delete all the contents of a folder except one file (stage.txt). This is the script I've written: tell application "System Events" if exists folder "~/...
2
votes
0answers
39 views

How to remove items in the “Open dictionary” window of MacOS Script Editor?

There are some items in the dictionary that I can't find in the Window -> Resource Library. Actually they are all one application I created with Automator but for some reason appeared multiple times ...
2
votes
0answers
811 views

Applescript / Javascript : click button with getElementsByClass

Here is the button I would like AppleScript to click : <button class="btn btn-primary" autofocus="" ng-click="ok()" tabindex="0">OK</button> Here is my code : tell application "Google ...
2
votes
0answers
61 views

iMessage Clear History Without Rebooting

If I remove all chat.db files in ~/Library/Messages on my Mac, I have to restart the whole system, otherwise iMessage says "updating database..." without doing anything. I think this is because not ...
2
votes
0answers
132 views

pptx file not opened via Apple Script

I want to write an Apple Script that converts me Microsoft PowerPoint presentations into PDFs. I started with a small version, but strange enough, already that very short stub fails: on run arguments ...
2
votes
0answers
190 views

How to set up an Applescript to remove attachments in Mail as part of a rule?

I'm on Sierra and have MailActOn in Mail. I want to set up an Outbox mail rule to run an Applescript that effectively will delete all email attachments on the message I am replying to, after ...
2
votes
0answers
36 views

Running a Service in QuickBooks

I have written a script that works on its own or when I run it from Automator. But when I add it as a service to QuickBooks I get and error message: "The action Run AppleScript encountered an error." ...
2
votes
0answers
246 views

Hot keys forcing Siri to open twice

About 30% of the time when pressing Command + Space for a fraction of a second too long, it causes Siri to close and open again. This delays the process a significant amount that at times its required ...
2
votes
0answers
216 views

Global shortcut for menu item within menubar bar application

I'd like to create a applescript that selects the "History" menu item from the menubar application Jing. I'm aware of how to create a global shortcut for an application with multiple menus, but I'm ...
2
votes
0answers
289 views

'Add notes' to a Calendar event using Automator

I would like to build a 'Service' for selected text which: Get the currently selected text Creates an Calendar event adds the selected text as a 'note' for that Calendar event I prefer Automator for ...
2
votes
0answers
1k views

Apple Script to Apply Rules in Mail.app

I've created some rules in my Mail.app to change background color of specific messages And also I've created rules in the mail server to move specific messages to some folder For messages in the ...
2
votes
0answers
33 views

How to fix «event coreslct» error?

I have an AppleScript source with this code: tell "Microsoft Word" «event coreslct» (last row of table X of document Y) insert rows selection position below number of rows Z end tell After ...
2
votes
0answers
174 views

The process of making custom notifications, iOS GarageBand, iTunes database, iTunes file format, AppleScript

I'm developing an iOS and Android app which uses custom notification sounds to provide users with step-by-step instructions. I've recently stepped through a pretty messy process of creating these ...
2
votes
0answers
565 views

How to get the fps of a video from QuickTime Player's inspector using applescript

I need a quick and easy way to find the frame rate of a video in applescript. So far grabbing it through QuickTime Player's inspector seems like the easiest option. tell application "QuickTime Player"...
2
votes
0answers
48 views

Getting all windows returns inaccurate items

I noticed when getting all windows that there are extra window items returned than there are. For example for Safari, it returns 9 windows but there are only 3 windows open; all the others are ...
2
votes
0answers
83 views

Applescript Printer Alerts via iMessage

Is there a way to send an SMS via Applescript/Automator in either of these scenarios: When a low printer ink alert occurs ("Cyan is at or below 10%) With the periodic status of ink levels ("Cyan=10%, ...
2
votes
0answers
139 views

Automating VPN switching

I can us a VPN app like tunnelbear to appear to be in other countries, but is there a way to do this in a bash script or applescript? I want to be able to run automated tests on my iOS apps (in the ...
2
votes
0answers
502 views

automatically share photos to Photos iCloud Shared Albums

I'd like to script the Yosemite Photos app so that every time I place images to a folder on my desktop, it automatically is imported into the Photos app and uploaded to a shared album. Is this ...
2
votes
0answers
471 views

How to detect if chrome (or any other app) is playing sound using bash/applescript

I am writing a script to turn off audio on my mac, but need to check if its coming from the browser or an app (say Spotify). Is there a way to detect which app is playing sound?
2
votes
0answers
856 views

Start QuickTime and set camera to iPhone from command line

I'm attempting to start QuickTime from AppleScript and select the camera of my iPhone like I do from QuickTime. I can't seem to make it change the camera. The script I have now is: tell application "...
2
votes
0answers
642 views

batch convert iWork 08 files to new version on Yosemite

TL;DR Short version: I have a bunch of files that were created with iWork 08. Is there a way, maybe using AppleScript or Automator, to convert them to the new format (Pages 5.5, Numbers 3.5) without ...
2
votes
0answers
180 views

How do I make an applescript launch as soon as it exits screen saver

I would like my mac to to say 'Login Authorized' as soon as I exit screen saver mode. Where should I place the script? Thank you in advance!
2
votes
0answers
919 views

Tell application “Microsoft Outlook” not working after Yosemite upgrade

I have two Macs. The AppleScript code below runs on one Mac ("Mac 1"), but not on the other ("Mac 2"). Mac 1 is running Snow Leopard, where Mac 2 was upgraded to Yosemite, and the AppleScript below ...
2
votes
0answers
299 views

Export image from clipboard to folder

I create a lot of mockups for my mobile phone. I recently heard of the brilliant idea to just put your current mockup as an image into your Dropbox (or whatever cloud your using). Then just take your ...
2
votes
0answers
2k views

Applescript, OS X : How to Get a list of phone numbers from Contacts, and send an iMessage with Messages App? Halfway there I think..?

I am trying to create an applescript that will grab all of the labeled phone numbers of 'mobile' and 'iPhone' from the every contact in Contacts App (specifically the phone numbers from the iCloud ...
2
votes
0answers
2k views

Applescript / Automator - Pass variables between them

I have a question about how to pass the applescript input from one computer to another computer's automator input (I created it as a program). I've created the script below to ask for the filename and ...
2
votes
0answers
90 views

Click in finder vs “open -a” on command line

I have a file type (.mxl -- compressed MusicXML) which if I double click in Finder opens properly in my .mxl reader (Finale 2014.app) but which if I call "open file.mxl" or "open -a /Applications/...
2
votes
0answers
62 views

Applescript Editor's compiler erratic behaviour

I've just come across some bizarre behaviour in the Applescript Editor (Snow Leopard - 10.6.8) that I was wondering if anyone knows how to get around it. Basically, one second a statement will ...
2
votes
0answers
420 views

AppleScript for enabling VPN broken after update to 10.9.3

I've been using an AppleScript for connecting to my office VPN. After updating my macbook to 10.9.3, it fails to execute, and throws an exception Unable to get network preferences (honestly, it is ...
2
votes
0answers
704 views

Get iTerm session by tty name

I want to run a command within an iTerm2 session like this: tell application "iTerm" tell session id "/dev/ttys020" exec command "ls" end end But I get the following error (with and without '...
2
votes
0answers
118 views

Run rake using Automator

I have install ruby using RVM. Next I create workflow in Automator, which detects new files in folder and then copies them to another dir. The next thing I want - to switch to those folder and run few ...
2
votes
0answers
69 views

Sort Stickies by desktop

I have OS X Lion 10.7.5 with four desktops and also have 4 groups of stickies (one group per desktop). Every time that I have to reopen the Stickies app, they are unsorted (all stickies open on the ...
2
votes
0answers
697 views

AppleScript to find old mail messages is slow in ScriptEditor

So I have an AppleScript that iterates over all the messages in various mailboxes and finds messages which meet various criteria and moves them to Deleted Items. The mailboxes in question are ...
2
votes
0answers
185 views

AppleScript deployment conventions?

I haven't seen a package-management system for AppleScripts, but it seems like the foundations for one are present. Given: Scripts (and folder) located in the ~/Library/Scripts/Applications folder ...
2
votes
0answers
1k views

Progress Indicator for AppleScript

Okay, so I have an AppleScript that is really just a wrapper for a simple shell script, so I could turn it into a double-click to run application, droplet and URI handler on OS X. Anyway, this works ...
2
votes
0answers
789 views

With Lion, Problems Accessing Shared NTFS Folders with SMB://

We are testing a local login script that we created for our Macintosh users on Lion. It has worked fine on all OS X versions prior to 10.7. Listed below is the script that we are using. When we run ...
2
votes
1answer
311 views

Applescript - Contacts: Why can I get addresses and emails from a contact but not phones

Errors when getting phones In Script Editor, if I run: tell application "Contacts" to get the vcard of person 301 the result is: "BEGIN:VCARD VERSION:3.0 PRODID:-//Apple Inc.//Mac OS X 10.13.6//EN ...
2
votes
1answer
410 views

How to bring an application to the front, no bouncing dock icons

In my AppleScript, I use activate to bring an application to the front. However, on machines of some colleagues, it doesn't do that. The app-icon in the dock will bounce, but it doesn't get put into ...
1
vote
0answers
8 views

Automator workflow - connect to server when locked onto a specific network (Wi-Fi/Ethernet)

I'm trying to get Automator to complete the following workflow: 1) IF Wi-Fi network is "Network_Name1" or "Network_IP1" (or any other way to identify a specific network connection): TRUE: Jump to 3 ...
1
vote
0answers
29 views

Setting System Preferences via script

Good thing: I got a spiffy new e-ink monitor and it's going to help a ton with my concussion symptoms. Bad thing: It can't exactly handle things like video conferencing, so I need to switch back and ...
1
vote
0answers
25 views

Selecting multiple words via AppleScript in PowerPoint

I'm trying to come up with an AppleScript that selects multiple adjacent words in a Microsoft PowerPoint slide. I figured out how to select single words, and how to select the entire range of a text ...
1
vote
0answers
29 views

Using Automator, Applescript & FFMPEG with If/Else Statements

I'm just not finding the resources I need. Perhaps someone can point me in the right direction and delete this post afterward. I'm working on making an Applet that is more complex than the one I have ...
1
vote
0answers
34 views

Applescript to chop specific text out of a text file and paste it to notes file

I have created a text file from a pdf using automator. I am now trying to copy two separate slices of this file and paste them to a Notes file. Here is a sample file: A lot of text above...............

1
2
3 4 5
8