What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Auto Web Address Opener

1 votes - 5 average   Auto Web Address Opener
Author: Message:
Barneyvxd
New Member
*


Posts: 1
– / Male / Flag
Joined: Mar 2009
O.P. Auto Web Address Opener
Hey,
I have pretty little Javascript knowledge and well i was just wondering if it's possible to have a web address that's sent to you open immediately instead of having to press the link. Like incase you're busy, and they urgently need to show you something, this is kind of a request and i really hope that someone can help me...

Thanks  (:
03-31-2009 10:29 PM
Profile E-Mail PM Find Quote Report
rtsfg
New Member
*

Avatar

Posts: 8
33 / Male / Flag
Joined: Mar 2009
RE: Auto Web Address Opener
Be, careful, you're using Jscript, which is not JavaScript.

You could use this:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
  //find out if its a web address...
  if (Message.substr(0,4) == "www." || Message.substr(0,7) == "http://")
   new ActiveXObject("WScript.Shell").run(Message);
}


The "find out" part should work with some substr...

edit: like this, for example.

btw, I would never use a script like this, who knows what kind of addresses you'll recieve :S

This post was edited on 04-01-2009 at 10:59 AM by rtsfg.
04-01-2009 10:56 AM
Profile E-Mail PM Web Find Quote Report
James Potter
Full Member
***

Avatar

Posts: 108
Reputation: 4
64 / Male / Flag
Joined: Dec 2008
RE: Auto Web Address Opener
quote:
Originally posted by rtsfg
Btw, I would never use a script like this, who knows what kind of addresses you'll recieve :S
How about adding a "filter" that has arrays for each contact (the person who requested the script should be smart enough to know how to duplicate arrays and add contacts that will be "filtered" out... Or wouldn't he? ;)

[Image: 29dtmhs.png]
04-01-2009 11:19 AM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: Auto Web Address Opener
quote:
Originally posted by rtsfg
Be, careful, you're using Jscript, which is not JavaScript.

You could use this:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
  //find out if its a web address...
  if (Message.substr(0,4) == "www." || Message.substr(0,7) == "http://")
   new ActiveXObject("WScript.Shell").run(Message);
}


The "find out" part should work with some substr...

edit: like this, for example.

btw, I would never use a script like this, who knows what kind of addresses you'll recieve :S

That only finds addresses at the start of a message and could open a webpage called "www.google.com <-- Check this out" which wouldn't work

Best option is to use string.search and a RegExp
<Eljay> "Problems encountered: shit blew up" :zippy:
04-01-2009 12:18 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Auto Web Address Opener
Javascript 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>&amp;Cancel</Caption>
                    </Control>
                </LeftControls>
                <RightControls>
                    <Control xsi:type="ButtonControl" Id="BtnSend">
                        <Position Left="0" Top="0" Width="75"/>
                        <Caption>&amp;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.
04-01-2009 01:12 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On