This is an old revision of the document!
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; submenuname: The name of the Plug-ins submenu (where the plug-in is located) within quotes. Use "" for the root Plug-in menu.
; pluginname: The name of the plug-in name and window title (supply it within quotes)
; containerindex: The 1-based container from the top. Top container is 1, second container is 2, etc.
; taskindex: The 1-based task from the top of the container. First task is 1, second task is 2, etc.
openJWpluginwindow(submenuname, pluginname, containerindex, taskindex)
{
; open plugin window (from submenu or root Plug-in menu)
if (submenuname = "")
{
WinMenuSelectItem, Finale 201, , Plug-ins, %pluginname% ; Root Plug-ins menu
}
else
{
WinMenuSelectItem, Finale 201, , Plug-ins, %submenuname%, %pluginname% ; Submenu in Plug-ins menu
}
; Wait for max 1 second for the plug-in window to open
WinWaitActive %pluginname%, ,1
if ErrorLevel
{
return 0 ; fail
}
; Set focus to the tree view
WinActivate %pluginname%
ControlFocus SysTreeView321, %pluginname%
if (ErrorLevel)
{
return 0
}
; Collapse all containers
Send {Home}
Loop 20
{
Send {NumpadSub}{Down}
}
; Move up to first container
Send {Home}
; Move down to the correct container
containerloop := containerindex - 1
Loop %containerloop%
{
Send {Down}
}
Send {NumpadAdd}
; Expand the container
Send {NumpadAdd}
; Select the task in the container
Loop %taskindex%
{
Send {Down}
}
return 1 ; Success
}
setJWpluginpanelvalue(pluginname, panelitemnumber, value)
{
ControlFocus SysTreeView321, %pluginname%
if (ErrorLevel)
{
return 0
}
; Tab to the panel item
Loop %panelitemnumber%
{
Send {Tab}
}
; Allow the new control to get focus, which take some time...
Sleep 20
ControlGetFocus controlvar, %pluginname%
IfInString controlvar, Button
{
; *** Checkbox ***
if (value = 0)
Control Uncheck, ,%controlvar%
else
Control Check, ,%controlvar%
}
IfInString controlvar, ComboBox
{
; *** Pull-down list - 1-based list index ***
Control Choose, %value%, %controlvar%
}
IfInString controlvar, Edit
{
; *** Edit - set the text **
ControlSetText %controlvar%, %value%
sleep 20 ; a little sleep here as well, since multiple edit boxes seem to need it
}
; MsgBox %controlvar%
return 1
}
applyandcloseJWpluginwindow(pluginname)
{
WinActivate %pluginname%
if (ErrorLevel)
{
return 0
}
ControlFocus SysTreeView321, %pluginname%
if (ErrorLevel)
{
return 0
}
Send {Enter}
sleep 50
WinClose %pluginname%
}
#IfWinActive, ahk_class Finale
^!T::
if (openJWpluginwindow("", "JW Meter and Rhythm", 5, 1) = 1)
{
setJWpluginpanelvalue("JW Meter and Rhythm", 1, 1)
applyandcloseJWpluginwindow("JW Meter and Rhythm")
}
return