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

Ignore timeout error while executing a javascript automation script on OSX

While converting a document to another document , my script (written in javascript in the Script Editor on OSX 10.10) times out with an error -1712 ("AppleEvent Timed Out"). How can ignore this timeout? Or at least extend the timeout delay.
0
votes
1 answer

how to change text item delimiter in Keynote rich text so period and comma are not ignored (using Javascript for Automation)?

In short: with iWork rich text objects, breaking the text up in words goes from: "This... he said, is a sentence!" to: ["This", "he", "said", "is", "a", "sentence"] So: periods, comma and exclamation point have disappeared. Similar to the…
wivku
  • 2,457
  • 2
  • 33
  • 42
0
votes
1 answer

create duplicate of file (Keynote presentation) using Javascript for Automation

What is the recommended way to create a duplicate of a file and specify the new name? At the moment I use: test = Application("Finder").duplicate(Path("/var/tmp/old.txt"), {replacing:true}) // creates "/var/tmp/old copy.txt" test.name = "new.txt" //…
wivku
  • 2,457
  • 2
  • 33
  • 42
0
votes
1 answer

Using Javascript for Automation to copy cells in Numbers

I want to use JXA to automate some updating of Numbers spreadsheets. For example, copying a range of cells from one spreadsheet to another one with a different structure. At this point, I'm just testing a simple program to set or read the value of…
DaveAZ
  • 21
  • 1
  • 3
0
votes
0 answers

Javascript for Automation and iTunes: update description is not saved?

Using Javascript for Automation (Yosemite), I would like to update the description of an iTunes video file. The issue: the description reverts to the old value (and e.g. rating saves correctly). The code I use: var track =…
wivku
  • 2,457
  • 2
  • 33
  • 42
0
votes
1 answer

how can I get raw html for a web page using javascript automator (JAX) for mac yosemite?

I figured out how to open a web page, but I want to submit a form to google and then get the html results. how can I do this? I want to take those page results so I can parse the data myself. chrome = Application("Google Chrome"); win =…
0
votes
1 answer

OS X Yosemite Javascript for Automation and iTunes

I'm trying to click on button "Free" to download application in iTunes. I'm using Javascript for Automation to open iTunes application page: itunes = Application('iTunes'); itunes.activate(); console.log( itunes.name() ); console.log(…
-1
votes
1 answer

escaping an apostrophy in a jxa doshellscript

in a jxa script i am running a shell script that runs osascript with mulitple -e arguments containing a multiline applescript which normally work just fine. this one will not work however. the apostrophy in the word range's is not being…
Neal Vadekar
  • 127
  • 1
  • 3
-1
votes
1 answer

Can the ObjC function UCKeyTranslate be used from JavaScript for Automation?

In an osascript/JXA context, I need to map macOS keyCodes and modifiers to Unicode strings (for any keyboard layout, specified at run-time) The obvious candidate appears to be UCKeyTranslate, but my attempts to get a reference to it from a…
houthakker
  • 688
  • 5
  • 13
-1
votes
2 answers

How Do I Use Objective-C (ObjC) with JavaScript for Automation (JXA) to Get HTML of Web Page

I have an AppleScript that I'm trying to convert to JXA. PURPOSE: Get HTML Source of Web Page The AppleScript runs fine, but the JXA script fails with this error: "TypeError: Object is not a function" I'm running Script Editor 2.8.1 (183.1) on…
JMichaelTX
  • 1,659
  • 14
  • 19
-2
votes
1 answer

Applescript for Safari AUTOMATION -- any advice, information, tip etc --

PreNote: I am open and hungry for any information, advice, tip etc. Hello Everyone! I am trying to create automation with applescript. This is my first personal applescript task but I have some valuable questions. Basically I am trying to catch live…
-2
votes
1 answer

What's !! meaning when used in the of statement?

Such as if(!!you) , I thought we can get rid of the !! , and it's the same. Cause JavaScript will change it to Boolean automatically?
-3
votes
1 answer

Looking for a JS framework that works outside browser and node

I am looking for a JavaScript framework that works without a browser, and without Node. I need a system to organise some JS AppleScripts that are growing in size, so I am looking for something like AngularJS's factories, services, etc. Because I am…
Dylanthepiguy
  • 1,621
  • 18
  • 47
1 2 3
16
17