Я пытаюсь сделать applescript, который позволяет мне изменить изображение рабочего стола на случайное изображение в папке на моем жестком диске.
tell application "Finder"
set desktopPictures to folder "Path:To:Desktop:Pictures:"
set fileList to name of every file of desktopPictures
set theNum to random number from 1 to (count fileList) with seed ((time of (current date)) * 4)
set fileName to item theNum of fileList
set desktop picture to file fileName in desktopPictures
end tell
Пока все работает отлично, единственная проблема, которая у меня есть, это то, что когда я подключаю другой монитор, его изображение на рабочем столе не меняется. Я попытался решить эту проблему с помощью следующий код, который я нашел при поиске в Интернете
tell application "Finder"
set desktopPictures to folder "Path:To:Desktop:Pictures:"
set fileList to name of every file of desktopPictures
set theDesktops to a reference to every desktop
repeat with aDesktop in theDesktops
set theNum to random number from 1 to (count fileList) with seed ((time of (current date)) * 4)
set fileName to item theNum of fileList
set picture of aDesktop to file fileName in desktopPictures
end repeat
end tell
Но этот код не скомпилируется, так как я получаю синтаксическую ошибку:
Expected class name but found property.
С выделенным desktop
в строке 4