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
2k views

Create a New Space in Mavericks using Applescript

In Mavericks, is it possible to use Applescript to create a new Space in Mission Control? I also tried the following code to switch to another Space, but it does not seem to do anything... tell ...
1
vote
1answer
1k views

how to log the search history in mac dictionary

I am trying to improve my vocabularies so am hoping to log all the search I made on mac dictionary. I have found a link which probably a bit outdated so it doesn't work, thought I do get the file on ...
1
vote
1answer
53 views

Remove multiple app badge icons with one script?

I found this link to remove a badge icon from a single app. Disable badge for specific app with a script Is it possible to create a script with multiple apps to remove all badges at once? Running ...
1
vote
1answer
238 views

Applescript to return name of new file added to folder

This is mostly a test so that I can work up to the function that I want to create down the line. I'm very new to AppleScript so bear with me! I wrote this as an attempt to test a folder action that ...
1
vote
2answers
1k views

Applescript - how can I select all *non*-folders in an expanded list view window?

I am trying to write a script which will select all non-folders in a given Finder window which is in List View and has revealed/expanded all sub-folders (see image). As there tend to be many more ...
1
vote
1answer
346 views

How to change the size of a Google Hangouts window in AppleScript?

Using AppleScript, I want to set the bounds of the window for the Google Hangouts desktop application. The application file is located at: /Users/Me/Applications/Chrome Apps.localized/Default ...
1
vote
1answer
3k views

Automator workflow or AppleScript to close Safari after a period of time

I would like to create an Automator workflow (or some similar function) that will close down Safari after a specified period of time. For instance, I simply want to run Pandora in Safari during the ...
1
vote
1answer
476 views

AppleScript at Startup and specific time

I'm trying to run a startup AppleScript, and a AppleScript which run at a set time (I hate the automator / calendar approach) on idle set currentTime to current date if the weekday of ...
1
vote
1answer
156 views

Can I give Automator apps a window?

Can I create a window / UI for applications created using Automator? Or is this just not possible with Automator apps? Background: I created an "application" through Automator, and dragged the app ...
0
votes
1answer
7k views

Automatically Save Attachments in Mail.app in 10.8 Mountain Lion

I am trying to automatically save all email sent to one address (let's call it test@example.com) to this folder /Users/luomat/Dropbox/Incoming/e2w/ (where /Users/luomat = $HOME). Here is the rule ...
0
votes
1answer
174 views

Service crashes when using AppleScript to click menu bar icon [duplicate]

The following AppleScript code clicks the WiFi icon found in the menu bar (source): tell application "System Events" to tell process "SystemUIServer" to tell (menu bar item 1 of menu bar 1) to click ...
0
votes
1answer
2k views

Position windows via command line

I've got a little bit of ruby that sizes and repositions windows to a saved layout. It uses a snippet of AppleScript to actually do the positioning: osascript -e 'tell application "Twitter" to set ...
0
votes
2answers
270 views

AppleScript shell script

How can I run a shell script on multiple different computers with the same code? If I have it run from /users/'my name'/desktop/etc. then it won't work when I use it on a different computer, ...
8
votes
3answers
4k views

How can I make an AppleScript activate upon logging in?

Is it possible to force an AppleScript to activate when I log in?
8
votes
1answer
3k views

What is the difference between “activate” and “launch”?

Here is an example of Applescript code: do shell script "osascript -e 'tell application \"Safari\" to activate'" do shell script "osascript -e 'tell application \"Safari\" to launch'" Is there any ...
6
votes
1answer
3k views

Make a FaceTime call using AppleScript

Is it possible to initiate a FaceTime call with "+1 (###) ###-####" when I execute an AppleScript? Does FaceTime support AppleScript and how can I automate the start of a call?
5
votes
2answers
3k views

AppleScript app started prompting to run or quit. How can I disable this?

I'm not entirely sure why this has started happening since this is completely new behaviour and I haven't done any system updates but I have a nice little toolbar app for my Snow Leopard Finder.app ...
5
votes
2answers
2k views

A programmatic method for disabling all sharing services?

I'm seeking a programmatic method for disabling all the sharing services on a Mac. My preference is for an AppleScript or a shell script. I'd like to have the services shown in the picture below ...
5
votes
1answer
489 views

How to register an AppleScript as a potential default web browser?

I've written an AppleScript that I want to set as the default browser. I've added a CFBundleDocumentTypes section to the p-list (copied from Safari) and rebuilt the launch services database, but that ...
5
votes
4answers
847 views

Set a keyboard shortcut to clear all tracks from the Up Next queue in iTunes

I am looking for a way to assign a keyboard shortcut to clear all the tracks from Up Next queue of iTunes. Does anyone know a way to do this? Using Mac OS X Mountain Lion 10.8.4
5
votes
1answer
1k views

How can I find the intersection of two lists in AppleScript?

Let's say I have two lists in AppleScript: set listA to {"red", "green", "blue"} set listB to {"green", "blue"} I'd like to create a third list that has only the items present in both lists: set ...
5
votes
1answer
2k views

enabling/disabling Internet Sharing with terminal in mac osx 10.9.2

The problem is setting the internet sharing with CLI instead of GUI in Mac OS 10.9.2 I followed instructions as per this thread Start/stop internet sharing from a script? including both CLI and ...
4
votes
1answer
2k views

applescript (osascript) for changing Terminal.app profile

Is here a way to changing the Terminal.app profile from the command line? Here is already couple of questions about changing colors, but I need change the whole profile from the "Basic" (what is my ...
4
votes
1answer
8k views

How to open a shell script in a new Terminal window and run it with administrator privileges

I need to programmatically open a shell script in a Terminal window and run it with administrator privileges. I'm using osascript as it displays a convenient prompt for an admin login/password. I'm ...
4
votes
3answers
828 views

AppleScript – Pages export to PDF fails due to Sandbox permissions

I'm trying to create an Automator workflow to export selected Pages documents to PDF. So far, everything goes well, except for the final export step. on run {input, parameters} repeat with ...
4
votes
1answer
2k views

Why am I getting “Error -1,752” when trying to save in Script Editor?

I'm trying to edit a script in ~/Library/Scripts/Applications/Mail. When I attempt to save from Script Editor I get The document "Reply.scpt" could not be saved. (Error -1,752). It doesn't seem to be ...
4
votes
1answer
137 views

Change what percentage/time remaining causes the battery icon on Mac to go red

I'm dead broke. So, I have a cheap battery for my dead-broke-esque 2008 MacBook. It only lasts about 2 hours on a full charge. However, it's a little goofy at times. Not in a dangerous way, just that ...
3
votes
2answers
133 views

Cleaning up birth years 2000 in my Address Book

A few years ago (or actually, more likely, in 2000), for some reason, birthdays that didn't have a birth year (but did and do have correct month and day) were automatically given the birth year 2000 ...
3
votes
1answer
3k views

Automatically forward “Starred in Gmail” messages to OmniFocus

Summary: I would like to create some sort of an automated process where any messages that I 'star' in Gmail (aka 'flag' when using Gmail via IMAP) will automatically be added to OmniFocus, and then "...
3
votes
1answer
942 views

Control haptic engine and force touch from terminal

Is there any way that I can create haptic feedback with the integrated force touch trackpad on my rMBP using a terminal command (preferably without AppleScript, but if that's the only way, then sure.)?...
3
votes
1answer
765 views

Applescript - Connection is invalid

I have an application for mac and I use the following applescript code (exported as an AS app) to start that app periodically: on idle tell application "System Events" tell application "...
3
votes
3answers
1k views

Applescript app to shut down Mathematica at a specific time of day

I have the following workflow that I need to execute on a daily basis for a period of days: The computers start at a specified time, Mathematica and a specific Mathematica notebook launch and ...
3
votes
0answers
374 views

How to use AppleScript to make Siri shortcuts?

Is there a way for me to configure my MacBook with AppleScript so that Siri will tell me my schedule for the day and other relevant information I want to know? I would like to be able to write ...
3
votes
1answer
326 views

AppleScript to copy cell range to clipboard as image is broken after Office Excel update 16.11

I have a simple script that opens an excel file and copy the used range to cilpboard as image. It was working for at least 5 years. Now with the latest update from microsoft it is not longer working ...
2
votes
1answer
3k views

How to make applescript hold a key for 2 seconds

So I am trying to make a script that moves me forward and backward to prevent afk in a game but the game is not registering the key as it is too short here is what I have so far. repeat 100 times ...
2
votes
3answers
5k views

How Can I Create a Multi-Line Input Dialog using Applescript?

How can I create a multiline text input dialog using Applescript? Creating a single line dialog is simple...
2
votes
1answer
965 views

Automator task to open screenshots in Preview automatically

I'm pretty new to Automator but it seems like it's possible - I just can't seem to get it to work. I'd like to be able to take a screenshot and then open it up in Preview for easy annotation. If it's ...
2
votes
1answer
330 views

Enable Safari Zoom by Script

I've got a WQHD (1440p) Monitor hooked up to my 13 inch MacBook Pro when I'm sitting at my desk. Love the high resolution (much screen real estate) but sometimes I find myself toggling Safari's Zoom ...
2
votes
2answers
170 views

Process list with name and VPRVT

Is there any way to get just name and VPRVT of running processes?
2
votes
2answers
1k views

Using cURL to download images in XML feed?

I have an XML file that has links to various .jpg I want to create an applescript that downloads a local copy of these. The idea is to also label them sequentially with a number say 001 to 030. ...
2
votes
2answers
652 views

How can I use AppleScript to see if a specific line of a .txt file matches a variable?

I have a .txt file saved on my computer. The contents of the .txt file looks like this, for example: I want my Automator application to read the first line of the .txt file and to put that line into ...
2
votes
1answer
195 views

Removing only birth years from a group in my Address Book

A lot of my contacts (600+) had somehow got their birth years set to 2000. Their birth months and days are correct, but the 2000 is wrong. With the tremendous help I got here, I was able to get them ...
2
votes
3answers
2k views

Deleting all songs in a given iTunes playlist using Applescript

I'm working on a script to manage my "queue" playlist in iTunes and wanted an easy and fast way to quickly delete all songs in that playlist. Applescript seemed the best option and I created a little ...
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
1answer
309 views

What is the difference between HFS path and alias path?

This was brought up in a comment from another question/answer and I was curious what is the difference between an HFS path and an alias path. My understanding they were the same.
2
votes
0answers
96 views

How to delete a specific line of a paragraph in AppleScript? [duplicate]

I have a text variable of class text that shows something like this when it is returned: " This is sentence 1. This is sentence 2. This is sentence 3. This is sentence 4." I want to be able to ...
2
votes
1answer
415 views

Launching Character Viewer (aka CharacterPalette) from command line

So, recently I have being using the Character and Keyboard Viewer a fair bit and set up simple Alfred keywords that toggle the launch/quitting of these apps so as not to have to leave the keyboard. ...
2
votes
1answer
430 views

How do I enable “Announce the time” programmatically?

The "Date & Time" System Preferences pane has an option to "Announce the time". I'd like to be able to turn on this preference option by invoking a shell script. Is this possible? (It's fine if ...
2
votes
1answer
545 views

How can I batch zip multiple folders without _macosx files?

I'm wanting to zip multiple folders at the same time, where each folder is it's own zip file. I'd like to create the zip without the _macosx or any other hidden files, and if possible have the zip ...
2
votes
1answer
934 views

How to remove the last character of a string if I know what the character is in AppleScript?

So basically I was messing around with AppleScript and created a variable based on the app's path and it always has a forward slash at the end that I don't want. See my other question for more info. ...