Questions tagged [javascript-automation]

an environment for scripting Mac applications using JavaScript. Available in OS X Yosemite and later, this is a newer companion to the traditional AppleScript environment, and targets the same underlying OSA object model. Sometimes abbreviated as JXA.

JavaScript for Automation is an environment for scripting Mac applications using JavaScript. Available for the first time in OS X Yosemite, this is a newer companion to the traditional AppleScript environment, and targets the same underlying OSA object model. JavaScript for Automation is sometimes abbreviated as JXA.

Apple's documentation as of this writing consists of release notes only, with the release notes for Yosemite describing the language features and providing examples on a single, lengthy page.

253 questions
0
votes
1 answer

JXA Applescript Getting Value of Slider

I have a slider, and if I get sliders()[0].value(), it returns a totally wrong value. I'm thinking something has to do with Value Indicator. However, valueIndicator doesn't show up in sliders()[0].uiElements() or .entireContents(). How can I obtain…
jl303
  • 1,461
  • 15
  • 27
0
votes
2 answers

save contact's profile picture using JavaScript for Automation

I would like to write the profile picture of a contact to a file. 1) how to read TIFF image? The dictionary describes the image property: image (*TIFFPicture* or missing value) : Image for person. In the dictionary TIFFPicture is a link, but when I…
wivku
  • 2,457
  • 2
  • 33
  • 42
0
votes
1 answer

How to open an application on a specific screen/display using JavaScript for Automation (JXA)?

I would like to open two applications on two different screens/displays using JavaScript for Automation (JXA), how is it possible? I'm able to open the applications, but I can't find a way to control where it should open.
0
votes
1 answer

JXA and .length

I am trying to turn an old javascript program of mine into a service on a mac using automator. When I use my Code, it doesn't work. I have checked what I can, and I have found that the most basic issue I encounter is that the .length property from…
user5225532
0
votes
3 answers

Permissions error when running another JS AppleScript from another JSAppleScript

I am trying to separate out my .applescript files into different ones to tidy things up. I have a JS AppleScript file called Test.applescript that tries to run the JS AppleScript file Group Tracks Dependency.applescript and what I want to do is pass…
0
votes
1 answer

How do I return a manipulated array as text to TextEdit?

I'm new to JXA and I'm trying to learn how to do some very basic things in TextEdit. I know how to get the paragraphs of a document as an array: app = Application('TextEdit') docPars = app.documents[0].paragraphs() And then, say, sort it. But I…
0
votes
2 answers

OS X - JavaScript for Automation - How to create and store variable for future use

I am creating a small program that will help automate the initialization of a virtual environment and startup of a Django server. I would like to share this program with others. I am looking for a way to create a variable (location of a folder)…
gnulinux
  • 3
  • 1
0
votes
1 answer

Possible to execute inline JavaScript statement in Applescript?

I know that you can tell Chrome or Safari to do JavaScript (or write entirely in JS... à la JXA) but whilst answering another question, I got curious... Is there a way to arbitrarily execute an inline JavaScript statement inside an AppleScript …
brandonjp
  • 3,018
  • 2
  • 28
  • 27
0
votes
1 answer

Run AppleScript or JXA script faster on keystroke

Trying to run an JXA script (basically AppleScript) when a keystroke is pressed from any application. Got it working by using Automator and creating a service which is activated (and runs the script) when a certain keystroke is pressed. The problem…
Kjell
  • 801
  • 7
  • 19
0
votes
1 answer

Keynote: change Shape Styles via AppleScript or JXA

This is for either AppleScript or JXA: I'd like to automate a task in Keynote, which involves Keynote's Shape Styles: if any existing shape has a certain RGB-value, I'd like to assign a specific Shape Style to it. So first question would be: is…
Fish
  • 37
  • 1
  • 1
  • 3
0
votes
1 answer

How to sort a Numbers table using Javascript for Automation

I want to sort a Numbers table using Javascript for Automation, the code like table.sort(table.columns["P"], {direction: "descending"}) But the Script Editor told me: Parameter is missing. (-1701) Here is the code I wrote: var Numbers =…
sfufoet
  • 1,091
  • 1
  • 6
  • 4
0
votes
4 answers

Moving created files with JXA

I'm new to JXA scripting, but I'm attempting to troubleshoot some older scripts currently in place here at work. They loop through an InDesign document and create several PDFs based on it. Previously, they would be stored in a folder called…
0
votes
1 answer

Extract PresentationNotes from keynote

I'm having a hard time extracting presentationNotes from a keynote presentation using JXA (Javascript for osx) I don't want to use applescript. There is way more to this script than extracting notes. It seems rather simple. However when I get the…
0
votes
2 answers

JXA & OmniGraffle

I can't figure out how to translate the following AppleScript into JXA (JavaScript for Automation under Mac OS X Yosemite) : tell application id "com.omnigroup.OmniGraffle6" tell canvas of front window make new line at end of graphics…
0
votes
1 answer

How to translate this slider value change from AppleScript to JavaScript

This bit of AppleScript works. If I have the System Preferences Sound panel open, and run it in the Script Editor app, it changes the volume to be at 50%. tell application "System Events" tell process "System Preferences" set v to value…
Rob N
  • 15,024
  • 17
  • 92
  • 165
1 2 3
16
17