是否可以保存在AppleScript中创建的应用程序的某种设置?
这些设置应在脚本开始时加载,并在脚本结束时保存。
示例:
if loadSetting("timesRun") then
set timesRun to loadSetting("timesRun")
else
set timesRun to 0
end if
set timesRun to timesRun + 1
display dialog timesRun
saveSetting("timesRun", timesRun)其中对话框在第一次运行脚本时显示1,第二次运行时显示2...
函数loadSetting和saveSetting就是我需要的函数。
发布于 2011-05-06 02:25:23
脚本properties是永久性的,但是只要重新保存脚本,保存的值就会被脚本中指定的值覆盖。运行:
property |count| : 0
display alert "Count is " & |count|
set |count| to |count| + 1几次,重新保存,然后再运行几次。
如果要使用用户默认系统,可以使用do shell script "defaults ..."命令或(如果使用Applescript Studio) default entry "propertyName" of user defaults。在Applescript Studio中,您可以使用bind values to user defaults。
https://stackoverflow.com/questions/5902202
复制相似问题