当前时间显示在Keynote vie Applescript中

时间:2016-03-29 12:15:33

标签: applescript keynote

    tell application "Keynote"
        repeat
            delay 2 -- seconds.  This script does not need to run faster
            set the_time to current date
            set the_time to time string of (current date) -- get now()
            set the_time to every word of the_time -- slice
            set the_time to item 1 of the_time & ":" & item 2 of the_time -- extract fields
            set body of the first slide to the_time as string
        end repeat
    end tell
end tell

我想在Keynote中显示幻灯片1(在本例中)的当前时间。我发现它应该与applescript一起使用,因为Keynote不支持这个未来。

" Applescript说“Keynote”发送错误:幻灯片1的主体无法在类型说明符中转换。 所以" set body of the first slide to the_time as string"有问题,但我不知道哪个。

1 个答案:

答案 0 :(得分:0)

  • 应用Keynotedocuments
  • documentslides
  • slidetext items
  • text item有一个object text

尝试

repeat
    delay 2 -- seconds.  This script does not need to run faster
    set the_time to text 1 thru -4 of time string of (current date)
    tell application "Keynote"
        set object text of text item 1 of first slide of document 1 to the_time
    end tell
end tell