[JW Lua] macOS: Starting plug-ins with the ExecuteOSMenuCommand/MenuPositionCommand doesn't work

Robert Patterson robert at robertgpatterson.com
Tue Apr 9 17:02:51 CEST 2024


Another thing to try is to see if you can execute the menu item from a
script with no plugin window present. If that doesn't work, then it may be
that there is a problem with the menu command. If you can get a simple
script like that to fail, I'll have a look at it.

On Tue, Apr 9, 2024 at 9:57 AM Robert Patterson <robert at robertgpatterson.com>
wrote:

> For most menu commands to work on macOS, the dialog window must be in
> focus when the menu is executed. I changed some of the mac-side APIs for
> control activation in 0.72, and it may have
> affected ActivateDocumentWindow. If you haven't tried v0.72, you might try
> that first (though I don't believe it actually changed for
> ActivateDocumentWindow).
>
> It may be that activation of the document window is not sufficient and
> that Finale has to get control in order to reactivate menu items, so it
> might work to activate the window and then execute the menu item from a
> subsequent timer callback.
>
>
> On Tue, Apr 9, 2024 at 9:45 AM Jan Angermüller <jan at angermueller.com>
> wrote:
>
>> Has anybody found a solution to the issue that on macOS some Finale
>> plug-ins can't be called from within Lua?
>> (described in details the old emails below)
>>
>> I am trying to call the "Change default to whole note rests" plug-in from
>> within a lua script.
>> It works fine on Windows. But on MacOS calling ExecuteOSMenuCommand has
>> no effect.
>> However, the result of the ExecuteOSMenuCommand call is true on macOS.
>>
>> To set the focus I have tried different variations of
>> finenv.UI():ActivateDocumentWindow ()  and/or
>> finenv.UI():MenuCommand(finale.MENUCMD_SELECTIONTOOL) directly before
>> ExecuteOSMenuCommand .
>> But still it doesn't work.
>>
>> finenv.UI():GetOSMenuCommandFromItemText works fine on both Windows and
>> macOS.
>>
>> Jan
>>
>> Am 11.11.2022 um 14:30 schrieb Robert Patterson:
>>
>> Most likely it is the focus issue, especially if you are using a dialog
>> box, and I don't know of a way to resolve it. I've never tried to use
>> execute menu item for plugins.
>>
>> If you are trying to activate another Lua script, you could use
>> FCLuaScriptItem(s) instead.
>>
>> On Fri, Nov 11, 2022 at 6:05 AM Jan Angermüller <jan at angermueller.com>
>> wrote:
>>
>>> Robert,
>>>
>>> is there any trick for starting plug-ins from within a lua script with
>>> the finenv.UI():ExecuteOSMenuCommand *on macOS*?
>>>
>>> On macOS I haven't succeeded neither with ExecuteOSMenuCommand nor with
>>> MenuPositionCommand.
>>> On Windows both functions works fine.
>>>
>>> finenv.UI():GetOSMenuCommandFromItemText seems to work fine on macOS.
>>> Or it least it returns a value that seems to be valid (2033201231).
>>>
>>> In the documentation it says that on macOS the Finale *document window
>>> must be in focus*.
>>> Is this the problem? Can I force the document to be in focus?
>>> I have tried finenv.UI():ActivateDocumentWindow ()  or
>>> finenv.UI():MenuCommand(finale.MENUCMD_SELECTIONTOOL) directly before
>>> finenv.UI():ExecuteOSMenuCommand.
>>> It doesn't work.
>>>
>>> Do you have a working example lua script to start any plug-in from the
>>> Finale Plug-ins menu on macOS?
>>>
>>> This topic has already been twice on the mailing list for
>>> MenuPositionCommand() (see below).
>>> But with no answers yet.
>>>
>>> I had an interesting request for which I developed a working Windows
>>> script. But it doesn't work on macOS yet.
>>> The request was for a script that starts another plug-in, but applies
>>> the plug-in only to all parts, not to the score.
>>>
>>> Jan
>>>
>>>
>>> Am 02.03.2020 um 15:47 schrieb Jan Angermüller:
>>>
>>> Hi Simon,
>>>
>>> did you find a solution for this?
>>> I encountered the same issue.
>>> It works fine on Windows, but on MacOS I can't access the Plug-ins menu
>>> via MenuPositionCommand() either.
>>>
>>> Best,
>>> Jan
>>>
>>> Am 28.01.2017 um 18:09 schrieb Simon Leclerc:
>>>
>>> Hi everyone,
>>>
>>> I’m trying to access the menu “Plug-ins” (as in “File”, “Edit”,
>>> “Utilities”, etc…) using the ui:MenuPositionCommand(), but to no avail.
>>>
>>> I have access to all the other menus and sub-menus, but the “Plug-in”
>>> one, which should be #7 on a Mac system, seems not possible to be invoked.
>>>
>>> I tried many combinations, the zero-based concept not being true all the
>>> time, but could not find the right one.
>>>
>>> Any clue?
>>>
>>> Thanks to all.
>>>
>>>
>>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20240409/f1f3a967/attachment.htm>


More information about the JWLua mailing list