Shoutbox

Starting Messenger conversation from DOS command line? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: WLM Plus! Help (/forumdisplay.php?fid=12)
+----- Thread: Starting Messenger conversation from DOS command line? (/showthread.php?tid=93751)

Starting Messenger conversation from DOS command line? by glenncarr on 02-03-2010 at 03:55 PM

I'm a new user of Messenger Plus, but was wondering/hoping that it might provide a way to start a Messenger conversation from a DOS command line (on Vista in my case).

Any one know of any way to do this?

Thanks!


RE: Starting Messenger conversation from DOS command line? by Spunky on 02-03-2010 at 04:09 PM

Not sure it's possible, but why would you want to do that?


RE: Starting Messenger conversation from DOS command line? by matty on 02-03-2010 at 04:42 PM

You would need a script and an executable to achieve such a thing.


RE: Starting Messenger conversation from DOS command line? by Spunky on 02-03-2010 at 05:11 PM

quote:
Originally posted by matty
You would need a script and an executable to achieve such a thing.

That was my next reply ¬_¬ Although, would it actually need a script or could you just use the API (I know there are some issues where using the API opens an instance of Windows Messenger)
RE: Starting Messenger conversation from DOS command line? by matty on 02-03-2010 at 05:58 PM

I would do it how it was done with SendTo.


RE: Starting Messenger conversation from DOS command line? by glenncarr on 02-03-2010 at 10:28 PM

quote:
Originally posted by Spunky
Not sure it's possible, but why would you want to do that?
Because I want to :) ... I use the command prompt and specifically SlickRun for a lot of may day-to-day development work.  I'm just a command-line kinda guy.

RE: RE: Starting Messenger conversation from DOS command line? by glenncarr on 02-04-2010 at 12:05 AM

quote:
Originally posted by krissy-afc
quote:
Originally posted by glenncarr
quote:
Originally posted by Spunky
Not sure it's possible, but why would you want to do that?
Because I want to :) ... I use the command prompt and specifically SlickRun for a lot of may day-to-day development work.  I'm just a command-line kinda guy.
Or just a wanna be show of hacker to-your-friends.

Uhmm, no.


Here's a script I threw together which sort of works, but only if the main Messenger client isn't already active.  The AppActivate doesn't bring it to the foreground if the window already exists.

code:
args = WScript.Arguments
var WshShell = new ActiveXObject("WScript.Shell");

WshShell.Run( 'msnmsgr.exe' )
WScript.Sleep( 200 )
   
WshShell.AppActivate( 'Windows Live Messenger' )
WScript.Sleep( 200 )

WshShell.SendKeys( "%AS")
WScript.Sleep( 200 )
WshShell.SendKeys( "%D")
if ( args.length >= 1 )
{
    WshShell.SendKeys( args( 0 ) ) // Contact name
    WScript.Sleep( 200 )
    WshShell.SendKeys( "{ENTER}")

    if ( args.length >= 2 )
    {
        WshShell.SendKeys( args( 1 ) ) // Message
        WScript.Sleep( 200 )
        WshShell.SendKeys( "{ENTER}")
    }
}


Anyway, I'll dig around a while.  Thanks, (and I glad I could impress you  by wanting to use the command-line.  old geezer command-line guys like me are cool ;) )

EDIT: Using AutoIt works consistently (if anyone cares)...


code:
; im.au3
Run( "C:\Program Files (x86)\Windows Live\Messenger\msnmsgr.exe" )
WinWaitActive( "Windows Live Messenger" )
Send( "!AS" )
WinWaitActive( "Send an Instant Message" )
Send( "!D" )
If $CmdLine[ 0 ] >= 1 Then
    Send( $CmdLine[ 1 ] )
    Sleep( 200 )
    Send( "{ENTER}" )
    If $CmdLine[0] >= 2 Then
        $msg = StringRight( $CmdLineRaw, StringLen( $CmdLineRaw ) - StringLen( @ScriptFullPath ) - 2 ) ; 2 for quotes
        $msg = StringRight( $msg, StringLen( $msg ) - StringLen( $CmdLine[ 1 ] ) - 3 )
        Send( $msg )
    EndIf
EndIf


Usage: im.au3 <contact name> [message]

Cheers. (Y)