OnEvent entries let you trigger actions automatically when a layer's state changes. For example, you can play a sound when a layer is activated or run a program when a layer is deactivated. The following table explains all possible registry values, all of which are REG_MULTI_SZ types:
Table: OnEvent actions
For example, a user edits an HTML document and wants Notepad++ to always open when a layer containing Firefox is activated. The user can create a registry value named OnPreActivate with the value data 'C:\Program Files\Mozilla Firefox\Firefox.exe'. This value runs Firefox.exe before the layer is activated. If Notepad++ is also captured to the layer containing Firefox.exe, the registry value needs to be named OnPostActivate. Notepad++ is not available until the layer is successfully activated.
OnEvent actions can also be used with any layer operations that can be performed with SVSCMD command-line actions. For example, you want to reset a layer containing Firefox every time the layer is deactivated. You can add an entry named OnPostDeactivate with the value'svscmd.exe [layer GUID] reset'. The entry triggers a reset after deactivation.
If creating an onEvent action, the w tag can also be used to cause the action to wait until the indicated process is finished. For example, the registry value 'OnPreActivate' with the value data '"C:\WINDOWS\system32\notepad.exe"' runs Notepad.exe before it activates a layer. However, changing the value date to 'w,"C:\WINDOWS\system32\notepad.exe"' indicates that the layer does not activate until the Notepad.exe process exits.
Post events are triggered regardless whether the main action is successful or not. Post events occur for activate, delete, deactivate, create, and other main actions regardless of the result of the main action.
Rate this Article