0

我想使用两个简单的按钮单击来生成“部门”和“套件”的变量。单击一次按钮应根据“部门”的返回值创建另一组按钮选项 为什么这不起作用?

--set up departments and suites
property departments : {"Audio", "Video", "Digital"}
property suites_Audio : {"A1","A2", "A3", "TXFR"}
property suites_Video : {"VFX1", "VFX2", "FCP1", "FCP2", "Flame1", "Flame2"}
property suites_Digital : {"MCR", "Encoding", "Store"}


--get suite location
display dialog "Enter your department" buttons departments
set department to button returned of the result
set suites to "suites_" & department
display dialog "Enter your suite" buttons {suites}
set suite to button returned of the result

我对这两行的语法有一种感觉:

set suites to "suites_" & department
    display dialog "Enter your suite" buttons {suites}

因此,单击正确的部门应该会生成一组新的按钮,以便从顶部的套件属性中向下挖掘到正确的套件。

有人可以帮忙吗?

4

1 回答 1

1

您正在重置套件的价值:

set suites to "suites_" & department

尝试:

--set up departments and suites
property departments : {"Audio", "Video", "Digital"}
property suites : {{"A1", "A2", "A3", "TXFR"}, {"VFX1", "VFX2", "FCP1", "FCP2", "Flame1", "Flame2"}, {"MCR", "Encoding", "Store"}}

--get suite location
display dialog "Enter your department" buttons departments
set department to button returned of the result

set suite to first item of (choose from list item (my findOffset(department)) of suites with prompt "Enter your suite")

on findOffset(findItem)
    repeat with i from 1 to (count departments)
        if item i of departments = findItem then return i
    end repeat
end findOffset
于 2013-05-02T16:50:44.637 回答