What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » advice - how to create PSM text:%location

advice - how to create PSM text:%location
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: advice - how to create PSM text:%location
Well, I don't know how one would retrieve the name as configured in the Messenger settings, because we don't have a decent API for that. However, it is possible (and quite simple in fact) to retrieve the network name and description of the current computer.

js code:
var MAX_COMPUTERNAME_LENGTH = 31;

function GetComputerName() {
    var nLength = MAX_COMPUTERNAME_LENGTH + 1;
    var lpBuffer = Interop.Allocate(2*nLength+4);
    var lpSize = Interop.Allocate(4);
    lpSize.WriteDWORD(0, nLength);

    var Result = Interop.Call("kernel32", "GetComputerNameW", lpBuffer, lpSize);
    var sName = (Result === 0) ? false : lpBuffer.ReadString(0);
    lpBuffer.Size = 0;
    lpSize.Size = 0;

    return sName;
}
To get the computer's description, you simply need to check whether there's a valid REG_SZ key value named "srvcomment" in "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" and read that.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-31-2009 11:41 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
advice - how to create PSM text:%location - by SkipRinPerth on 01-19-2009 at 05:32 AM
RE: advice - how to create PSM text:%location - by ShawnZ on 01-19-2009 at 06:16 AM
RE: RE: advice - how to create PSM text:%location - by SkipRinPerth on 01-31-2009 at 10:37 AM
RE: RE: RE: advice - how to create PSM text:%location - by Vilkku on 01-31-2009 at 10:50 AM
RE: advice - how to create PSM text:%location - by Th3rmal on 01-19-2009 at 06:35 AM
RE: advice - how to create PSM text:%location - by Matti on 01-31-2009 at 11:41 AM
RE: advice - how to create PSM text:%location - by matty on 01-31-2009 at 01:24 PM
RE: advice - how to create PSM text:%location - by ShawnZ on 01-31-2009 at 04:00 PM
RE: advice - how to create PSM text:%location - by Matti on 01-31-2009 at 05:40 PM
RE: advice - how to create PSM text:%location - by matty on 01-31-2009 at 06:26 PM
RE: advice - how to create PSM text:%location - by janlukaz on 02-01-2009 at 02:58 AM
RE: advice - how to create PSM text:%location - by ShawnZ on 02-01-2009 at 03:24 AM
RE: advice - how to create PSM text:%location - by matty on 02-01-2009 at 04:40 AM


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