OS X Yosemite Javascript for Automation and iTunes

梦想的初衷 提交于 2019-12-13 21:30:34

问题


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( itunes.version() );
delay(1)
appUrl = "itms://itunes.apple.com/us/app/ibooks/id364709193?mt=8";
win = itunes.openLocation(appUrl);

The script opens iBook page. How to find and click button "Free"? How to list all elements on open page?

Thank you for any help.


回答1:


After looking in the script editor, the library for the Itunes Application, i didn't found any method or object dealing with books in the itunes store. So i think, it's a dead end. The iBooks application is not scriptable anyway.

However to go ahead with your problem, clicking the [Free] button :

appUrl = "itms://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=38&popId=42";
win = itunes.openLocation(appUrl);

The URL targeted by the [Free] button could be found by browsing books in iTunes, in the right side of the interface ( "Free books", right-clic => Copy the link ). Perhaps the URL is different for your US version but you got the idea.



来源:https://stackoverflow.com/questions/26711618/os-x-yosemite-javascript-for-automation-and-itunes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!