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
Triggers an action before layer activation
Triggers an action after layer activation
Triggers an action before layer deactivation
Triggers an action after layer deactivation
Triggers an action before layer import
Triggers an action after layer import
Triggers an action before layer export
Triggers an action after layer export
Triggers an action before layer reset
Triggers an action after layer reset
Triggers an action before layer deletion
Triggers an action after layer deletion
Triggers an action before new layer creation
Triggers an action after new layer creation
Triggers an action before an application is captured to a layer
Triggers an action after an application is captured to a layer
For a global setting, place the value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FSLX\Parameters\FSL.
For a local setting, create the value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FSLX\Parameters\FSL\1, where '1' is the read-only (RO) layer number.
Layer numbers can be found by selecting Details from the View drop-down in the SWV Admin tool. The Sublayer info column lists both the read-only sublayer (RO) and the writable sublayer (RW) numbers.
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.
Imported Document ID: HOWTO50198
Subscribing will provide email updates when this Article is updated. Login is required.