admin管理员组文章数量:1263928
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.
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.
Share Improve this question asked Apr 5, 2012 at 3:51 mh taqiamh taqia 3,5961 gold badge26 silver badges37 bronze badges 4- This might do what you want: jstalk – brettkelly 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. – mh taqia 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? – kopischke 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 – mh taqia Commented Apr 7, 2012 at 8:34
2 Answers
Reset to default 11Since 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();
You can use node js module: https://github./TooTallNate/node-applescript
本文标签: macosAppleScript to JavascriptStack Overflow
版权声明:本文标题:macos - AppleScript to Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740936681a2310697.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论