matty
Scripting Guru
    
Posts: 8328 Reputation: 109
40 / / 
Joined: Dec 2002
Status: Away
|
RE: Auto Web Address Opener
js code: var oChatWnds = {}
function OnEvent_ChatWndSendMessage( pChatWnd, sMessage ){
oChatWnds[ pChatWnd.Handle ] = sMessage;
}
function OnEvent_ChatWndReceiveMessage( pChatWnd, sOrigin, sMessage, nMessageKind ){
if ( oChatWnds[ pChatWnd.Handle ] === sMessage ) return;
var regexp = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var urls = sMessage.match(regexp);
if ( urls.length === 0 ) return;
var oWnd = MsgPlus.CreateWnd( 'wUrlOpener', 'Window.xml' );
for ( var url in urls ) oWnd.LstView_AddItem( 'LvUrls', urls[url] );
}
function OnEvent_ChatWndDestroyed( pChatWnd ){
delete oChatWnds[ pChatWnd.Handle ];
}
function OnwUrlOpenerEvent_CtrlClicked( pPlusWnd, sControlId ){
if(sControlId.match(/^BaseBtn/)) return;
for (var j=0; j<pPlusWnd.LstView_GetCount('LvUrls'); j++){
if (pPlusWnd.LstView_GetCheckedState('LvUrls', j)){
Debug.Trace( pPlusWnd.LstView_GetItemText('LvUrls', j , 0) );
/**
Open the windows here
**/
}
}
}
}
xml code: <?xml version="1.0" encoding="UTF-16"?>
<Interfaces xmlns="urn:msgplus:interface" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:msgplus:interface PlusInterface.xsd" Name="urlOpener">
<Window Id="wUrlOpener" Version="1">
<Attributes>
<Caption>URL Opener</Caption>
</Attributes>
<TitleBar>
<Title><Text></Text></Title>
</TitleBar>
<Position Width="350" Height="213">
<Resizeable Allowed="BothSides">
<MinWidth>250</MinWidth>
<MinHeight>158</MinHeight>
</Resizeable>
</Position>
<DialogTmpl>
<BottomBar Style="Plain">
<LeftControls>
<Control xsi:type="ButtonControl" Id="BtnCancel">
<Position Left="0" Top="0" Width="50"/>
<Caption>&Cancel</Caption>
</Control>
</LeftControls>
<RightControls>
<Control xsi:type="ButtonControl" Id="BtnSend">
<Position Left="0" Top="0" Width="75"/>
<Caption>&Open URL(s)</Caption>
</Control>
</RightControls>
</BottomBar>
</DialogTmpl>
<Controls>
<Control xsi:type="StaticControl" Id="lblTitle">
<Position Top="3" Left="5" Width="210" Height="10"/>
<Caption>Select a URL to open</Caption>
<Attributes>
<AutoAdjustWidth>true</AutoAdjustWidth>
</Attributes>
</Control>
<Control xsi:type="ListViewControl" Id="LvUrls">
<Position Top="15" Left="5" Width="330" Height="126">
<Anchor Horizontal="LeftRightFixed" Vertical="TopBottomFixed"/>
</Position>
<Attributes>
<AutoTip>true</AutoTip>
<AlwaysShowSelection>True</AlwaysShowSelection>
</Attributes>
<ReportView>
<FullRowSelect>True</FullRowSelect>
<HasCheckboxes>True</HasCheckboxes>
</ReportView>
<Images>
<Columns WidthFormat="Absolute">
<Column>
<ColumnId>ColUrl</ColumnId>
<Label>URLs</Label>
<Width>250</Width>
</Column>
</Columns>
</Control>
</Controls>
</Window>
</Interfaces>
Clearly I was bored...
This post was edited on 04-01-2009 at 03:40 PM by matty.
|
|