0

我编写了一个 AppleScript,其中包括设置我的桌面背景。但是,使用 AppleScript 的“设置图片”会突然改变背景 - 它看起来不太好。有没有办法获得通过桌面和屏幕保护程序首选项的“更改图片”设置循环背景时使用的漂亮淡入淡出效果?

理想情况下,我想在 AppleScript 中执行此操作,但如果可以在 Cocoa(或其他)中执行此操作,请告诉我!谢谢!

4

1 回答 1

1

回答我自己的问题!

这不是想要的,但足够接近:

set picture rotation to 1 -- turn on wallpaper cycling
set change interval to -1 -- force a change to happen right now
delay 1.5 -- wait a bit to allow for the fade transition - you may want to play w/ this #
set picture of item N of theDesktops to POSIX file ("yourfilenamehere.png") -- set wallpaper to wallpaper you want
set picture rotation to 0  -- turn off wallpaper cycling

通过利用 Apple 的内置壁纸更换器,您可以在 AppleScript 中获得淡入淡出效果,但您需要将要在目录中更改的任何图像放在一起,并在桌面和屏幕保护程序首选项中选择它或以编程方式。

此外,set picture rotation to 1似乎会自动将壁纸更改为我认为是该目录中的第一张图片(按字母顺序) - 不过,我没有费心去测试它,但这对我的目的无关紧要。1.5 的延迟允许有点闪烁,但由于我使用的图像是 TARDIS,这是可以接受的,实际上是为了产生很酷的效果(只要我们注意哭泣的天使!)

于 2012-08-22T15:46:43.457 回答