Edit

SwizzleHandler(fromName, toName, [mode])

Result type:  none

Definition:  SwizzleHandler can be used to change or duplicate a handler name in your script at runtime. You can use this to dynamically disable a handler that MoneyWorks would automatically call to reduce runtime overhead. You can also use it to apply multiple specialised names to a single handler implementation. The changes will apply until the script is reloaded.

Example: 

    on AddToolToTransactionList(winRef)
        InstallToolbarIcon(winRef, "Do_Thing")
    end
    
    on Load
        SwizzleHandler("AddToolToTransactionList", "Before:F_TRANSLIST:DI", SwizzleDuplicate)
        SwizzleHandler("AddToolToTransactionList", "Before:F_TRANSLIST:CI", SwizzleRename)
    end

This will effectively rename the AddToolToTransactionList handler to Before:F_TRANSLIST:DI and Before:F_TRANSLIST:CI, so that MoneyWorks will call it when you select either the Sales or Purchase Invoices views in the Transaction list.

The optional mode parameter can be SwizzleDuplicate (1) or SwizzleRename (0). The default is SwizzleRename.

If toName is an empty string, the fromName is removed from the name table.

Although SwizzleRename removes the original name from the name table, direct calls to the handler using that name that were linked at compile-time will still work. Dynamic calls generated at runtime (including automatic calls by MoneyWorks in response to UI events) will no longer find the handler by its old name.

Availability:  MoneyWorks Gold 9.2.1 and later