5

What is the equivalent below code in Javascript? Is this apple script convertable to java script?

tell application "Finder"
    activate
    set position of Finder window 1 to {607, 276}
    close Finder window 1
end tell

Thanks.

4
  • This might do what you want: jstalk.org Commented Apr 5, 2012 at 3:54
  • I want to run this code by JavascriptCore framework. Is it possible? I am Windows programmer and beginner in Mac. Commented Apr 5, 2012 at 4:11
  • check out JSTalk, as linked above by @inkedmn – it’s built on top of JavascriptCore. Just out of interest: why do you want to use JavaScript for this? Commented Apr 5, 2012 at 12:14
  • 2
    Because Javascript is public and popular and I am familiar with it. Can I do Scripting InDesign CS4, CS5, ... with js talk? How I can reference Application Object? and can I use it in carbon apps? Tnx Commented Apr 7, 2012 at 8:34

2 Answers 2

11

Since the release of OS X Yosemite, JavaScript is available to automation.

The equivalent of your code would be:

var finder = Application('Finder');

finder.activate();
finder.windows[0].position = {x: 607, y: 276};
finder.windows[0].close();
Sign up to request clarification or add additional context in comments.

Comments

0

You can use node js module: https://github.com/TooTallNate/node-applescript

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.