Dynamically reposition an Indicator in a Browser session
This script shows how you can reposition an Indicator icon to a different position on the screen. It implements a handler which is invoked when ever the a session is switched to another active session.
- This script handles positioning of the RF Signal Strength indicator to different positions for each session. When you switch to a session, the RF signal strength indicator is repositioned appropriately for that session.
- This script assumes that the RF Signal strength indicators are enabled in both sessions.
The AddMetaItem interface of the Browser object actually writes a META tag to the HTML for the web page. The line CETerm.PostIDA(“IDA_INFO_REFRESH ”,0 ) is required to apply the changes to the web page.
To download this sample, Right mouse click and select "Save Target As..." RepositionSignalMeter.js
To load and run the script, see this article.
/*OnSessionSwitch()*/
// Move RF signal strength according to the switched active session
function OnSessionSwitch( session, previousSession )
{
var b = CETerm.Session(session).Browser;
if (b.DocLoaded)
{
if (session == 1)
{
b.AddMetaItem("Signal", "x=195");
b.AddMetaItem("Signal", "y=2");
}
else
{
b.AddMetaItem("Signal", "x=10");
b.AddMetaItem("Signal", "y=100");
}
CETerm.PostIDA("IDA_INFO_REFRESH", 0);
}
}