1
Apple 데스크톱을 사용하여 바탕 화면 배경을 최신 NASA 이미지로 설정하려고합니다. 이 RSS 피드를 사용하여이 작업을 수행하려고합니다. https://www.nasa.gov/rss/dyn/lg_image_of_the_day.rssRSS를 AppleScript로 구문 분석 (grep? 사용)
마지막 퍼즐 조각이 rss 피드의 이미지 URL을 구문 분석합니다. 이 grep을 사용하여 매우 가능해야한다고 가정하지만 grep 사용법을 모르겠습니다. 내가 피드를 살펴 봤는데, 내가 원하는 URL이 먼저 <item>
의 첫 번째 <link>
이 될 것입니다.
set {year:y, month:m, day:d} to (current date)
set todaydate to d & "\\ " & m & "\\ " & y
log todaydate
set myFile to "/Users/me/Pictures/NASA\\ Image\\ of\\ the\\ Day/" & todaydate & ".jpg"
property RSSURL : "https://www.nasa.gov/rss/dyn/lg_image_of_the_day.rss"
--get the first download link from the rss feed
--ie stuff inside <link> </link> directly after first <item>
set pictureURL to "" --but to the right thing, of course
do shell script "curl -o " & myFile & " " & pictureURL
tell application "Finder" to set desktop picture to POSIX file "myFile"
마크 업 그레픽은 엉망이며 잘못되었습니다. System Events의 XML Suite 참조 : 관련 값을 참조로 추출 할 수 있어야합니다. – foo