Database 是否通过运行另一个applescript来更改一个applescript中的属性?

Database 是否通过运行另一个applescript来更改一个applescript中的属性?,database,properties,applescript,Database,Properties,Applescript,有人知道如何通过运行另一个applescript来更改一个applescript中的属性吗? 我知道如何读取存储在单独脚本中的属性,但我不知道如何编辑它们 比如说。 文件1包含以下属性:(另存为桌面上的“测试”) 文件2能够获取此属性的值 global test set test to (load script (("/Users/knickman/Desktop/test.scpt") as POSIX file)) if test's test is 1 then say "yes

有人知道如何通过运行另一个applescript来更改一个applescript中的属性吗? 我知道如何读取存储在单独脚本中的属性,但我不知道如何编辑它们

比如说。 文件1包含以下属性:(另存为桌面上的“测试”)

文件2能够获取此属性的值

global test
set test to (load script (("/Users/knickman/Desktop/test.scpt") as POSIX file))

if test's test is 1 then    
say "yes"   
else    
say "no"    
end if
这很有效。但是,如果我尝试从另一个脚本更改文件1中的值,其内容如下:

global test
set test to (load script (("/Users/knickman/Desktop/test.scpt") as POSIX file))

set test's test to 1

这不管用。我想做的是可能的吗?我试图用它作为一个简单的数据库。感谢您的帮助

使用
加载脚本加载脚本
将创建存储在内存中test.scpt文件中的脚本对象副本

修改已加载脚本的属性只会更改内存中脚本对象的值,不会对最初加载脚本的脚本文件产生影响。但是,您可以使用该命令使更改保持不变:

global test
set test to load script (POSIX file "/Users/knickman/Desktop/test.scpt")

if test's test is 1 then
    say "yes"
    set test's test to 0
else
    say "no"
    set test's test to 1
end if

store script test in (POSIX file "/Users/knickman/Desktop/test.scpt") replacing yes
global test
set test to load script (POSIX file "/Users/knickman/Desktop/test.scpt")

if test's test is 1 then
    say "yes"
    set test's test to 0
else
    say "no"
    set test's test to 1
end if

store script test in (POSIX file "/Users/knickman/Desktop/test.scpt") replacing yes