让我先说一下,我知道我可以使用 Filemaker 计算的 Apple Script 轻松执行以下操作。我真的很想知道如何在 Apple Script 中实现这一点。我正在尝试将变量设置到一个名为 Keyboard Maestro 的宏程序中,我将其称为 KM。
我的脚本首先遍历 Filemaker 中找到的记录,并从每个找到的记录中复制数据。我不知道如何从 Apple Script 中的循环中设置 KM 变量,因为据我所知,您无法动态设置 Apple Script 变量的名称。
我可以通过创建一个列表来创建变量的名称(我想使用):
set variableListFunderName to {}
set i to 1
repeat until i = winCount + 1
copy "Business_ExistingAdvance" & i & "FunderName" to the end of variableListFunderName
set i to i + 1
end repeat
set variableListFundingCurrentBalance to {}
set i to 1
repeat until i = winCount + 1
copy "Business_ExistingAdvance" & i & "FundingCurrentBalance" to the end of variableListFundingCurrentBalance
set i to i + 1
end repeat
set variableListFundingAmount to {}
set i to 1
repeat until i = winCount + 1
copy "Business_ExistingAdvance" & i & "FundingAmount" to the end of variableListFundingAmount
set i to i + 1
end repeat
--
但是当我将字段的内容设置为我创建的列表项时,变量不会显示在 KM 中:
--
set i to 1
repeat until i = winCount + 1
tell record i
set item i of variableListFunderName to cell "Funders_ExistingAdvances::FunderCompanyName"
set item i of variableListFundingCurrentBalance to cell "FundingCurrentBalance"
set item i of variableListFundingAmount to cell "FundingAmount"
end tell
ignoring application responses
tell application "Keyboard Maestro Engine"
setvariable item i of variableListFunderName & "_AS" to item i of variableListFunderName
setvariable item i of variableListFundingCurrentBalance & "_AS" to item i of variableListFundingCurrentBalance
setvariable item i of variableListFundingAmount & "_AS" to (item i of variableListFundingAmount)
end tell
end ignoring
set i to i + 1
end repeat
如何设置这些 KM 变量?