What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » instantiate plus! scripting objects from outside?

Pages: (3): « First « 1 2 [ 3 ] Last »
instantiate plus! scripting objects from outside?
Author: Message:
rh
Full Member
***


Posts: 115
– / Male / –
Joined: Mar 2003
O.P. RE: RE: instantiate plus! scripting objects from outside?
quote:
Originally posted by deAd
The Messenger API is limited but very easy to use. You pretty much make an instance of it and say Messenger.MyStatus = 4. I believe that Plus! uses the Messenger API for a lot of things (but not all of them :P).


well, if could tell me what's the name of the ActiveX object i need to instantiate for this (i suppose nowadays it would be activeX-based?) then this would be extremely helpful...
08-08-2006 10:47 PM
Profile E-Mail PM Find Quote Report
Shondoit
Full Member
***

Avatar
Hmm, Just Me...

Posts: 227
Reputation: 15
35 / Male / Flag
Joined: Jul 2006
RE: instantiate plus! scripting objects from outside?
I believe there are 2 threads mixed here^o)
One about Changing the status on Remote control button push, and one about executing the content of a file, when it changed
Mods? Can I request a split for this?


1. You can definitly use the MSN API for that, try to find some documentation about it
2. MpScripts.net has a code snippet for that, I'm having problem with the site right now, so I will post it later, or maybe you could find it yourself...

I believe it's called 'Messenger API Type library'

Here is a VB example
code:
Public WithEvents msn As Messengerapi.Messenger

Private Sub Form_Load()
   Set msn = New Messengerapi.Messenger
end sub

private sub command1_click()
  msn.MyStatus = MISTATUS_AWAY
end sub

Haven't tested it, I'm doing it right now
My scripts:                            [Image: shondoit.gif]
+ Timezone
+ Camelo
+ Multisearch
08-08-2006 10:55 PM
Profile PM Find Quote Report
Silentdragon
Full Member
***

Avatar
if(life==null && wrists) EmoAlert();

Posts: 148
Reputation: 2
34 / Male / –
Joined: Jun 2006
RE: instantiate plus! scripting objects from outside?
code:
/* File modification dates registry */
var FileModificationDates = [];
/**
* Listen for file modification
*
* @param string FilePath the file to observe
* @param function Callback function to call when the file is modified
* @return boolean
*
* @note : Callback function should take one argument which is the the path of the file
*/
function ListenForFileModification(FilePath, Callback) {
    var DateLastModified = GetFileModificationDate(FilePath);
    if (DateLastModified === false) return false;
   
    Callback = Callback || function(FilePath) {};
    FileModificationDates[FilePath] = {
        file        : FilePath,
        date        : DateLastModified,
        callback    : Callback
    }
    MsgPlus.AddTimer('LSTN_FileModification_' + FilePath, 100);
    return true;
}
/**
* Get the file modification time
*
* @param string FilePath the file
* @return string
*
* @note : returns false if file does not exist
*/
function GetFileModificationDate(FilePath) {
    var FileSystem    = new ActiveXObject('Scripting.FileSystemObject');
    if (!FileSystem.FileExists(FilePath)) return false;
    var File = FileSystem.GetFile(FilePath);
    return '' + File.DateLastModified + '';
}
/* common Timer event handler */
function OnEvent_Timer(TimerId) {
    var TimerMatchLSTN = TimerId.match(/^LSTN_FileModification_(.+)$/);
    if (TimerMatchLSTN.length && FileModificationDates[TimerMatchLSTN[1]]) {
        var FilePath = TimerMatchLSTN[1];
        var DateLastModified = GetFileModificationDate(FilePath);
        if (DateLastModified === false) return false;
       
        if (DateLastModified != FileModificationDates[FilePath].date) {
            FileModificationDates[FilePath].callback(FilePath);
            FileModificationDates[FilePath] = undefined;
            return true;
        }
        MsgPlus.AddTimer('LSTN_FileModification_' + FilePath, 100);
        return true;
    }
}
// usage example :
ListenForFileModification(MsgPlus.ScriptFilesPath + '\\file.txt', function(FilePath){Debug.Trace('File modified : ' + FilePath)});

There's the code from MPScripts.net
08-08-2006 11:18 PM
Profile E-Mail PM Web Find Quote Report
Shondoit
Full Member
***

Avatar
Hmm, Just Me...

Posts: 227
Reputation: 15
35 / Male / Flag
Joined: Jul 2006
RE: instantiate plus! scripting objects from outside?
@SilentDragon, thanks

quote:
I believe it's called 'Messenger API Type library'
I was right about that...

quote:
Haven't tested it, I'm doing it right now
And I tested it now, and it worked in VB6

This post was edited on 08-08-2006 at 11:25 PM by Shondoit.
My scripts:                            [Image: shondoit.gif]
+ Timezone
+ Camelo
+ Multisearch
08-08-2006 11:23 PM
Profile PM Find Quote Report
AberNStein
Full Member
***


Posts: 132
Reputation: 2
Joined: Jul 2006
RE: RE: instantiate plus! scripting objects from outside?
quote:
Originally posted by Shondoit
@SilentDragon, thanks

quote:
I believe it's called 'Messenger API Type library'
I was right about that...

quote:
Haven't tested it, I'm doing it right now
And I tested it now, and it worked in VB6

i don't think ahk can use activex controls. you'd have to make a separate program in vb then use SendMessage and OnMessage to communicate or something.

quote:
Originally posted by Shondoit
I believe there are 2 threads mixed here(Smilie)
One about Changing the status on Remote control button push, and one about executing the content of a file, when it changed
Mods? Can I request a split for this?
writing to a file and monitoring the contents was a proposed solution for communicating betweek autohotkey and plus live. imo no split necessary

This post was edited on 08-09-2006 at 04:51 AM by AberNStein.
[Image: gybouserbar6hc.gif]
08-09-2006 04:49 AM
Profile PM Find Quote Report
rh
Full Member
***


Posts: 115
– / Male / –
Joined: Mar 2003
O.P. RE: instantiate plus! scripting objects from outside?
OK, thanks to some of the information in this thread and other inforfation from the web, I was abl to solve the problem. this is the VBscript:

code:
SET msn = CreateObject("Messenger.UIAutomation.1")
if msn.MyStatus=10 then
    msn.MyStatus=2
else
    msn.MyStatus=10
end if


and this is how it is launched from AHK:

code:
cmd=%windir%\system32\wscript.exe "%A_ScriptDir%\SwitchMSNStatus.vbs"
Run, %cmd%


now when i am sitting on my couch watching TV, and people start chatting to me, i can easily "shake them off" through one button press (Y) thanks to everyone

regards,
rh
08-09-2006 07:38 AM
Profile E-Mail PM Find Quote Report
Intosia
Junior Member
**

Avatar
I'm dynamic ^^

Posts: 78
40 / Male / –
Joined: Mar 2004
RE: instantiate plus! scripting objects from outside?
Nice solution :)
08-09-2006 09:08 AM
Profile E-Mail PM Web Find Quote Report
Pages: (3): « First « 1 2 [ 3 ] Last »
« 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