首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Automator中的持久变量存储

Automator中的持久变量存储
EN

Stack Overflow用户
提问于 2012-11-11 03:33:52
回答 1查看 1.4K关注 0票数 1

是否可以在automator工作流中存储持久化值(特别针对服务流)?

似乎常规的automator变量are not persistent;例如,尝试使用an applescript chunk which has a property (通常会持续)实际上也不会持久化Applescript中的属性(在测试中有效,但当您运行服务时,该值不会持久化)。

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2012-11-11 13:22:45

您可以使用脚本对象将数据存储在一个偏僻的地方。

代码语言:javascript
复制
on run
    -- Path of script which holds data
    set thePath to (path to desktop as text) & "myData.scpt"
    --set thePath to (path to preferences as text) & "myData.scpt" -- better

    script theData
        property xxx : missing value
    end script

    try
        set theData to load script file thePath
    on error
        -- On first run, set the initial value of the variable
        set theData's xxx to 5
    end try

    -- change the value of the variable
    set theData's xxx to (theData's xxx) + 1

    -- save your changes
    store script theData in file thePath replacing yes
    return theData's xxx
end run
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13325386

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档