Let me preface this by saying that I know that I can easily do the following using a calculated Apple Script from Filemaker. I'd really love to know how to accomplish this inside an Apple Script. I'm trying to set variables into a macro program called Keyboard Maestro that I will refer to as KM.
My script first steps through found records in Filemaker and copies data from each found record. I can't figure out how to set a KM Variable from a loop in Apple Script because, as far as I know, you can't dynamically set the names of Apple Script variables.
I can create the names (that i would like to use) of the variable by creating a list with:
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
--
But when I set the contents of my fields to the list items that I created, the variables don't show up in 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
How can I setup these KM variables?