The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [applescript]

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

Filter by
Sorted by
Tagged with
10
votes
0answers
299 views

Set “Load remote content in messages” per sender?

In the Mail setting (under Viewing) tab, there is a option Load remote content in messages which I unchecked, so for each email that contains remote content, I need to click the Load remote content ...
9
votes
4answers
10k views

Activating screen saver from AppleScript in Mountain Lion

I had a script that I used to use to activate my screen saver, and it no longer works in Mountain Lion. It was a shell script that called an AppleScript script: #!/bin/bash osascript /Users/lorin/...
8
votes
5answers
18k views

How do I make an AppleScript with a drop-down menu without Xcode?

How do I make an AppleScript that displays a drop-down menu without using Xcode?
8
votes
4answers
13k views

Script to raise a single window to the front

In a script I'm trying to find the Terminal.app window containing a specific tty device and raise that window to the top. Here's what I have in Applescript so far: tell application "System Events" ...
7
votes
1answer
4k views

How to use environment variables in applescript

I'd like to use my environment variables, which were defined in my environment.plist file, in my applescript. How do I do that, for instance: log "Glassfish Home: " & AS_HOME Where AS_HOME is ...
7
votes
2answers
6k views

Is it possible to restart an application using AppleScript?

I want to restart Safari and reopen it with some tabs that I specify.
7
votes
1answer
1k views

Execute a custom script when OS X 10.8 is in Power nap?

Apple new feature of OS X 10.8 in new Macs "Power Nap" checks email and does make backups. Is it possible to execute a custom script (bash, AppleScript,...) when OS X 10.8 is in Power nap mode? For ...
7
votes
1answer
9k views

Set size of window to exact pixels, and place via x, y coordinates

I would like to create a tool that allows you to set windows to exact sizes on the pixel scale to be able to have more precise screen divisions. For example, if I had four Terminal windows (and I ...
6
votes
2answers
8k views

Opening new Terminal.app window/tab with a certain profile from command-line or AppleScript?

When I login to my Mac, I want to automatically open a new Terminal.app window with a certain profile, say Monitor, that has a startup command and several appearance settings. I thought it would be ...
6
votes
1answer
1k views

Toggle Finder sort order with AppleScript under Lion 10.7?

For years I've been using this AppleScript to toggle the sort order of a Finder window: if sort direction of column id size column of list view options of window 1 is normal then set sort ...
5
votes
3answers
3k views

“drag n drop” application to convert images to base64 string (for web development)

I'm after an osx program that will convert an image into a base64 string (for web development). Basically replicates this: http://webcodertools.com/imagetobase64converter/Create I suspect there is ...
5
votes
1answer
7k views

How to use AppleScript to launch three scripts, each in new Terminal tab?

I'm trying to launch 3 tabs and run a script in each with AppleScript. So far I haven't been able to get this done. Currently I have: tell application "Terminal" activate do script "ping ...
5
votes
3answers
2k views

How to make a simple app from an applescript!

I've got an applescript that I use to open files such as test.txt in vim, using the terminal. I usually open a file by right-clicking it an selecting the service open in vim (this service is created ...
4
votes
1answer
878 views

How can I automatically download multiple sites through Coda?

I have several sites in Coda that I would like to automatically re-download when I tell it to. The sites are collaboratively managed, and I'd like to download a fresh copy of the sites automatically. ...
4
votes
1answer
11k views

Applescript date manipulation to get multiple formats

I need to get a date (month, day, year) in multiple different formats for each part. So, for January 2, 1999 I need: the month as January and Jan and 01 and 1 the day as 2 and 02 the year as 1999 ...
4
votes
2answers
7k views

how can I use applescript to type?

how can I use applescript to type in a specified area on the screen? I've tried the 'keystroke' command, but it doesn't seem to work. also, how can I use applescript to display an image? thanks a lot ...
4
votes
2answers
256 views

How do I prevent AppleScript from using short numbers?

So AppleScript by default uses the exponential notation of numbers - for example, 2.99E+68. How do I prevent that from happening? I want the number written out as it is.
3
votes
2answers
13k views

Access application submenus with AppleScript

I am trying to learn to access any menu item within an application with AppleScript. I can orient to the actual menu tab, and then access clickable menu items, but I can't access menu items within ...
3
votes
3answers
375 views

Can Safari's download popover window be made wider?

How can the max. width (fixed width≈425) of Safari's download-popover-window be made wider? Is there a way to get at Safari's "download pop over window" in any way so its max-size is larger than 425 ...
3
votes
2answers
735 views

How to close applications on sleep?

I have a password management application (KeePassX) of which backup I sync over Dropbox across several computers. However the password database can be open only on one computer at a time for file ...
3
votes
2answers
2k views

AppleScript: How to write to text file in specific location (signaled by specific character)?

I have a .txt file saved on my computer. I want my Automator application to add a bit of text to the .txt file (the text will be entered by the user). I already know how to append text or prepend text ...
3
votes
2answers
1k views

Run a script based on sunset and sunrise info?

What is the best way to run an Applescript when my current location's status changes from night to day and day to night? Thanks!
3
votes
3answers
536 views

How can I have a fixed order of the menu-extras?

Like the OSX menu items for wifi, battery... I would like to be able to have a permanent order of the third-party menu bar items. I do not want to mix OSX with third-party menubar items, I simply ...
3
votes
3answers
2k views

Take a screenshot of the top-most window

I want to have an AppleScript that takes a screenshot of the front most application. I have used this AppleScript: tell application "System Events" -- get frontmost process set frontmostProcess to ...
3
votes
3answers
3k views

How to fast set hot corners in Mavericks?

I used a downloaded applescript to fast enable/disable hot corners but they don't work after I upgrade to Mavericks. Someone knows what's happening? Here's the disable script, hope it'll help you ...
3
votes
2answers
637 views

Saving applescripts as scripts versus text

When saving a script in Applescript Editor, it defaults to the Script file format. The file produced is binary and cannot be indexed by Spotlight. So if I want to search a script based on a word used ...
3
votes
1answer
209 views

AppleScript: How to un-hide the file extension of a screenshot?

set filePath to "/Users/Me/Desktop/" & "Screenshot" & ".png" do shell script "screencapture -mx -T1 " & filePath tell application "Finder" set extension hidden of (filePath as POSIX ...
3
votes
1answer
311 views

How to set positioning/filling of desktop background image with AppleScript

How can I set the positioning/filling of the desktop background image from the command line with one of the available options listed in the Desktop & Screen Saver preferences: Crop, SizeToFit, ...
3
votes
1answer
91 views

How to prevent Script Editor from scrolling (and losing cursor location) on compile?

I have some lengthy .scpt files. By "lengthy," I'm talking character counts (excluding spaces) of 200,000. I use Script Editor.app to create and edit AppleScripts (simply because Script Editor was ...
3
votes
2answers
4k views

Applescript: Automatically check and remount server volume stopped working

Yesterday, I found a script that makes my Mac (MacBook Pro running El Capitan) automatically check for a volume on a server and remount it if the connection drops. I adapted it slightly to this, so my ...
3
votes
1answer
1k views

How to increase cursor size programmatically?

How do I increase the cursor size programmatically? I know how to do it manually. Is there a script that can do it from the command line rather than an AppleScript that does it from the GUI. Why? I ...
3
votes
2answers
493 views

Is there a macOS equivalent of the Windows assoc command?

I am looking to change a file association on the Mac using some sort of script. I know that I can do something like that in Windows using the assoc command. Is there something scriptable on macOS ...
3
votes
2answers
3k views

How can I avoid permission-related failures when importing in Photos.app via AppleScript?

The new Photos.app does not come with Automator support (although there are third-party actions available). It does, however, have some basic AppleScript support, including support for importing a ...
2
votes
2answers
468 views

Move external iTunes library files to different location without losing metadata

I'm trying to move my iTunes library to a new location. I'm running iTunes without the "organize media" option because I keep my library (60000+ songs) on a second drive in my MacBook... I recently ...
2
votes
1answer
245 views

Recreate an alias with the same name and timestamp programmatically

Let us develop a utility to batch process legacy alias files. Implemented as: Finder File Service, Automator Workflow, Applescript, Shellscript, or whatever else that those the job. Per each file ...
2
votes
1answer
325 views

In an AppleScript, how do I call/reuse a subroutine from another AppleScript?

snippet 1a on removeText(searchText, sourceText) set prevTIDs to text item delimiters of AppleScript set text item delimiters of AppleScript to searchText set sourceText to text items of sourceText ...
2
votes
1answer
224 views

How to make an AppleScript app locate itself?

I've been messing around with this cool AppleScript scripting language and I have yet another question. How to make an AppleScript app locate itself?Like something like this (that obviously doesn't ...
2
votes
1answer
5k views

How to make selection from AppleScript dialog list with keystroke?

I've created an application with AppleScript in Automator. The application, right off the bat, presents the user with a dialog list. By default, there are two ways to select an item from the list: ...
2
votes
2answers
443 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 ...
2
votes
3answers
838 views

Need script to automatically export Skim PDFs with embedded notes

I have a folder with a few thousand PDF files, most of which have Skim annotations (e.g., highlights and notes). If I had fewer files, I'd just go through each one, export the PDF with embedded notes, ...
2
votes
2answers
978 views

Wanted: Apple Script for copying file name and pasting it in Spotlight Comment box Mac OS X 10.8.5

Global Peace Mission Project looking for automating pre sorting movie file routines. Due to the instant impact inflow of third party YouTube contributions triggered by a blog launched March 22 after ...
2
votes
1answer
790 views

Not able to clear History in Safari using AppleScript in OS X El Capitan

I have been using below script to clear the Safari history from selenium test in OS X Yosemite . I have upgraded to OS X El Capitan and now the script won't work. Error returned : Can't get "Clear ...
1
vote
2answers
2k views

using automator/applescript to upload files to a web form?

I have a bunch of files I want to upload to web page. Unfortunately the web form for uploading only allows me to specify one at a time (it spawns and 'open file' dialog). Is there an easy way to do ...
1
vote
3answers
4k views

Applescript dictionary for Preview

Is there an Applescript dictionary for Preview.app? I am unable to find it under Mac OS X 10.7.5, and Applescript 2.2.1. I did a rudimentary search in google and duckduck but came up empty. I've ...
1
vote
1answer
157 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 ...
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
351 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
269 views

AppleScript to Make New Calendar in Specific Account

The AppleScript Dictionary for macOS Calendar 10.0 (High Sierra) appears to have no API for addressing specific accounts. For example… set myCalendar to make new calendar with properties {name:"New ...
1
vote
2answers
3k views

How to mount and name a volume if it's not already mounted with a startup script

I'm trying to do something I thought would be simple, but after researching it I feel like I'm half way towards shaving a yak, so I'm asking for advice. I want to create a script that lets me and my ...
1
vote
1answer
3k views

AppleScript Setting Select Drop Down

I am trying to enable dictation with applescript and so far have the following that works. But, how do I set the drop down for the shortcut key using AppleScript? Below is the AppleScript code: tell ...