Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带注释记号的Applescript。访问幻灯片中的形状_Applescript_Osx Yosemite_Keynote - Fatal编程技术网

带注释记号的Applescript。访问幻灯片中的形状

带注释记号的Applescript。访问幻灯片中的形状,applescript,osx-yosemite,keynote,Applescript,Osx Yosemite,Keynote,我有一个模板化的注释记号文件和一些幻灯片,所有的幻灯片都有两个形状。我想说一些类似“嘿,给我幻灯片2的形状2”。这样做的目的是,我可以直接将文本项添加到该形状中。下面是我现在拥有的代码 我正在使用最新的基调6.5.2&约塞米蒂 tell application "Keynote" activate tell document 1 set anniversary to "Anniversaries" set

我有一个模板化的注释记号文件和一些幻灯片,所有的幻灯片都有两个形状。我想说一些类似“嘿,给我幻灯片2的形状2”。这样做的目的是,我可以直接将文本项添加到该形状中。下面是我现在拥有的代码

我正在使用最新的基调6.5.2&约塞米蒂

  tell application "Keynote"

        activate

        tell document 1

            set anniversary to "Anniversaries"
            set myShape to shape 2 of slide 2
            tell myShape 
                set thisTextItem to make new text item with properties {object text:anniversary}
                #log thisTextItem
                tell thisTextItem
                    set the size of its object text to 144
                    set the color of its object text to "blue"
                end tell

            end tell

        end tell

    end tell
我可以自己判断幻灯片2,当然我会在幻灯片2上看到一个大的文本项,文本为“Anniversaries”,颜色为蓝色,但这是唯一的幻灯片2。。。不在幻灯片2的形状2中

使用此代码,运行脚本时会出现弹出错误:

结果:

“错误”注释记号出现错误:无法创建或将该元素移动到该注释记号中 集装箱编号:10024


这是什么意思?我是否无法访问幻灯片中的形状??在幻灯片中的形状内设置文本的任何帮助/信息/示例都是有益的。谢谢

您可以在形状中设置文本的属性,不能在形状中插入
文本项
对象

tell application "Keynote"
    tell document 1
        tell shape 2 of slide 2
            set object text to "Anniversaries"
            tell object text
                set it's size to 44
                set it's color to {0, 0, 65535} -- blue
            end tell
        end tell
    end tell
end tell

谢谢经过研究,我确信这一点。如果您想看一看,另一个问题会出现:)