What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Script to run a command line whenever a contact becomes online

Pages: (2): « First [ 1 ] 2 » Last »
Script to run a command line whenever a contact becomes online
Author: Message:
jabaltie
New Member
*


Posts: 7
Joined: Jun 2007
O.P. Script to run a command line whenever a contact becomes online
Hello !

I'd like to know if there would be out there some sort of script that would be "hooked" to the "Contact becomes online" event, so that I could run an external command line (generic) whenever a contact of my interest becomes on-line.

For instance, I wanna a script that whenever Mary becomes on-line, it launches (executes) a command line of my own.

What I would do on this command line ?

I would send a SMS to my mobile phone, so that wherever I am, I would RUN after a WLM machine in order to talk to Mary !

I'm fluent with programming languages, and with JavaScript as well. But I dont know WLM scripting yet...

Thanks in advance !

Hope the idea can help you out there ! See ya !
06-12-2007 06:29 PM
Profile E-Mail PM Find Quote Report
Volv
Skinning Contest Winner
*****

Avatar

Posts: 1233
Reputation: 31
35 / Male / Flag
Joined: Oct 2004
RE: Script to run a command line whenever a contact becomes online
code:
function OnEvent_ContactSignin(strEmail) {
    new ActiveXObject("WScript.Shell").Run("\"C:\\path to file\\file.bat\"");
}
You can replace \"C:\\path to file\\file.bat\" with any console command.

This post was edited on 06-12-2007 at 06:38 PM by Volv.
06-12-2007 06:37 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Script to run a command line whenever a contact becomes online
Well, if you have any program which can send a message to your mobile, it's very easy to do that:
code:
function OnEvent_ContactSignin(Email) {
   if(Email == "mary@hotmail.com") {
      new ActiveXObject("WScript.Shell").Run('C:\sendsms.exe');
   }
}
or something likely... Note that if there are any spaces in your file path, you should place the path between quotes (e.g.: '"C:\Program Files\SendSMS\sendsms.exe"').

If you don't have a program which does that... well, I don't know. :P

EDIT: Damn, Volv beat me again. :( But he made an error: his code would execute for EVERY contact. :P

This post was edited on 06-12-2007 at 06:40 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
06-12-2007 06:40 PM
Profile E-Mail PM Web Find Quote Report
Volv
Skinning Contest Winner
*****

Avatar

Posts: 1233
Reputation: 31
35 / Male / Flag
Joined: Oct 2004
RE: Script to run a command line whenever a contact becomes online
quote:
Originally posted by Mattike
But he made an error: his code would execute for EVERY contact. :P
I suppose :p
06-12-2007 06:42 PM
Profile PM Find Quote Report
jabaltie
New Member
*


Posts: 7
Joined: Jun 2007
O.P. RE: Script to run a command line whenever a contact becomes online
Thanks to you all folks for the help !

I just have to research now how to wrap that JavaScript code into a .plsc file....

Thanks !

06-12-2007 07:49 PM
Profile E-Mail PM Find Quote Report
L. Coyote
Senior Member
****

Avatar
Captain Obvious

Posts: 981
Reputation: 49
39 / Male / Flag
Joined: Aug 2004
Status: Away
RE: Script to run a command line whenever a contact becomes online
quote:
Originally posted by jabaltie
I just have to research now how to wrap that JavaScript code into a .plsc file....
Tips:

* Download the documentation (from the script database in MsgPlus! Live site).
* Search before posting something, as there's a chance it's been answered many times.

The PLSC file is simply a ZIP file renamed. All you need to do is zip your script, add a ScriptInfo.xml file, which is explained in the script documentation, change .zip for .plsc, and that's it. (Y)

Hack, hack, hack!
Finally became a Systems Analyst! :spam:

06-12-2007 07:54 PM
Profile PM Find Quote Report
Volv
Skinning Contest Winner
*****

Avatar

Posts: 1233
Reputation: 31
35 / Male / Flag
Joined: Oct 2004
RE: Script to run a command line whenever a contact becomes online
quote:
Originally posted by jabaltie
Thanks to you all folks for the help !

I just have to research now how to wrap that JavaScript code into a .plsc file....

Thanks !
And you don't need to create a .plsc file in order to use a script. PLSC files are for the purpose of distributing the script to others.

Just go to the Script Preferences and click "Create new", then "Edit" and place the code in there, click "Save" and you're good to go.
06-13-2007 04:36 AM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: Script to run a command line whenever a contact becomes online
For running a program or opening a file or something similar use the code that has been said above.  ie
code:
...
new ActiveXObject("WScript.Shell").Run('C:\sendsms.exe');
...
But if you want to execute a command line then replace that line with something like this
code:
new ActiveXObject("WScript.Shell").Exec('shutdown -a');

That codes aborts a shutdown, i couldn't think of anything else off the top of my head and I know that one isn't harmful is you accidentally execute it.

I actually use the Exec method at uni in a HTML document to bypass the 15 minute timer they have on the 'express' computers :tongue:.
[Image: markee.png]
06-13-2007 04:50 AM
Profile PM Find Quote Report
jabaltie
New Member
*


Posts: 7
Joined: Jun 2007
O.P. RE: Script to run a command line whenever a contact becomes online
Well, it turns out that there must be some sort of security checking within scripts.

Cause my script CAN NOT be activated.

This is how I did the script :



function OnEvent_ContactSignin(Email)
  {
   if  ((Email == "jabaltie@unimep.br"))
       {
         new ActiveXObject("WScript.Shell").Run('C:\test\cl52\xtest391.exe ' + Email);
       }
  }


When I quote the line where the 'Run' command line is, the script CAN BE activated OK.

However, when I unquote that line, the script CAN NOT be activated anymore.

Any clues ?

I now doing this "run" is dangerous of course but, if only I could do it for THIS script...


Thanks again folks !
06-13-2007 01:37 PM
Profile E-Mail PM Find Quote Report
jabaltie
New Member
*


Posts: 7
Joined: Jun 2007
O.P. RE: Script to run a command line whenever a contact becomes online
Ops, sorry, I found the mistake by myself...

It's the double slashes I should use on the RUN command line :

new ActiveXObject("WScript.Shell").Run('C:\\test\\cl52\\xtest391.exe ' + Email);


Now, one more thing.....

I like to edit my scripts using an external editor, which is TSE PRO 32 from SemWare. Wonderful editor.

So, would there be a way to do some sort of "# INCLUDE" within WLM Plus so that I could edit my scripts outside WLM itself ?

Say that inside WLM I simply would put

# INCLUDE "this_script_of_mine_on_this_file_path"

And then I could edit the script with my editor of choice ?

06-13-2007 01:44 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » 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