This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
jwlua:quickscripts [2014/09/23 20:07] jariw [Align Repeat Brackets] |
jwlua:quickscripts [2015/07/13 18:07] (current) jariw [Swap Metatool Key Assignment] |
||
---|---|---|---|
Line 812: | Line 812: | ||
end | end | ||
end</code> | end</code> | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Swap Metatool Key Assignment ==== | ||
+ | |||
+ | The following script swaps the expression metatool keyboard assignments for the keys '1' and '2'. Metatools are saved to the (ASCII) key number, and the Lua ''string.byte()'' function is used to find the key number. Simply resaving to the other key number will do a swap of the metatool keys. Beta version 0.40 or later is required for this sample code. | ||
+ | |||
+ | <code lua swapmetatools.lua>-- Load all existing metatool assignments for the Expression Tool | ||
+ | local mas = finale.FCMetatoolAssignments() | ||
+ | mas:LoadAllForMode(finale.MTOOLMODE_EXPRESSION) | ||
+ | -- Find the current expression metatools for keyboard keys '1' and '2' | ||
+ | metatool1 = mas:FindKeystroke(string.byte("1")) | ||
+ | metatool2 = mas:FindKeystroke(string.byte("2")) | ||
+ | -- Swap the keyboard mapping for these 2 objects | ||
+ | if (metatool1 ~= nil) then | ||
+ | metatool1:SaveAsKeystroke(string.byte("2")) | ||
+ | end | ||
+ | if (metatool2 ~= nil) then | ||
+ | metatool2:SaveAsKeystroke(string.byte("1")) | ||
+ | end</code> | ||
+ | |||
---- | ---- |