What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [question] Run commands from script

Pages: (3): « First [ 1 ] 2 3 » Last »
[question] Run commands from script
Author: Message:
skorpan
Junior Member
**


Posts: 16
Joined: Sep 2006
O.P. [question] Run commands from script
Hi!

I have searched the forum for a way to run commands from the scripts.

If I want to open the folder c:\test\, or the file c:\program.exe, how do I do that?

This post was edited on 09-11-2006 at 10:59 AM by skorpan.
09-11-2006 10:58 AM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: Run commands from script
code:
var Shell = new ActiveXObject('WScript.Shell');
Shell.Run("c:\\program.exe");//You need to use "\\" instead of "\"


This post was edited on 09-11-2006 at 11:01 AM by Felu.
09-11-2006 11:00 AM
Profile E-Mail PM Web Find Quote Report
skorpan
Junior Member
**


Posts: 16
Joined: Sep 2006
O.P. RE: RE: Run commands from script
quote:
Originally posted by -!Felu!-
code:
var Shell = new ActiveXObject('WScript.Shell');
Shell.Run("c:\\program.exe");//You need to use "\\" instead of "\"



Thanks alot!
Now I only need to know how I replace single "\" with "\\" in strings.. ;)

This post was edited on 09-11-2006 at 11:16 AM by skorpan.
09-11-2006 11:12 AM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: [question] Run commands from script
quote:
Originally posted by skorpan
Thanks alot!
Now I only need to know how I replaces single "\" with "\\" in strings.. [Image: msn_wink.gif]
I meant in scripting you'll need to use double slash(\\) instead of a single slash(\) in any path you specify.
09-11-2006 11:16 AM
Profile E-Mail PM Web Find Quote Report
skorpan
Junior Member
**


Posts: 16
Joined: Sep 2006
O.P. RE: RE: [question] Run commands from script
quote:
Originally posted by -!Felu!-
quote:
Originally posted by skorpan
Thanks alot!
Now I only need to know how I replaces single "\" with "\\" in strings.. [Image: msn_wink.gif]
I meant in scripting you'll need to use double slash(\\) instead of a single slash(\) in any path you specify.

I got that =)
But the functions in Messenger Plus scripting enviroment returns path in the style of "c:\my dp folder\", so I need to change it to "c:\\my dp folder\\".

That is my new problem :)
09-11-2006 11:17 AM
Profile E-Mail PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
30 / Male / Flag
Joined: Apr 2006
Status: Away
RE: [question] Run commands from script
quote:
Originally posted by skorpan
I got that =)
But the functions in Messenger Plus scripting enviroment returns path in the style of "c:\my dp folder\", so I need to change it to "c:\\my dp folder\\".

That is my new problem (Smilie)
No, it returns the correct way... If it returns "c:\\my dp folder\\" the folder won't open but if it returns "c:\my dp folder\" the folder would open.

I don't know the reason behind this, but i think you get what i mean. If someone can explain why then please do [Image: msn_tongue.gif].
09-11-2006 11:22 AM
Profile E-Mail PM Web Find Quote Report
skorpan
Junior Member
**


Posts: 16
Joined: Sep 2006
O.P. RE: RE: [question] Run commands from script
quote:
Originally posted by -!Felu!-
quote:
Originally posted by skorpan
I got that =)
But the functions in Messenger Plus scripting enviroment returns path in the style of "c:\my dp folder\", so I need to change it to "c:\\my dp folder\\".

That is my new problem (Smilie)
No, it returns the correct way... If it returns "c:\\my dp folder\\" the folder won't open but if it returns "c:\my dp folder\" the folder would open.
Wrong.
The function in Messenger Plus I use returns a value in style of "c:\my folder\sub folder" (I add a "\" on the end manually).

If I take this string and pass it on to Shell.Run(string); (where string is the returned path from above) it dies not open anytning. I just get a error message.
09-11-2006 11:26 AM
Profile E-Mail PM Find Quote Report
alexp2_ad
Scripting Contest Winner
****

Avatar
Who love the chocolate?

Posts: 691
Reputation: 26
37 / Male / –
Joined: May 2004
Status: Away
RE: RE: [question] Run commands from script
EDIT:  What's the error you get, and what's the exact code you're using?

quote:
Originally posted by -!Felu!-
I don't know the reason behind this, but i think you get what i mean. If someone can explain why then please do [Image: msn_tongue.gif].

The reason is that in strings, the backslash \ is used as an "escape character", meaning it's used to show that the next character signifies something other than it's literal character.  For example:

\n  =  new line
\"   =   inside a string this is used to show a quote, rather than actually showing the ending of the string

So to get an actual \ into a string, you double it up to \\ and it gets changed into a \ when the string is passed / used etc.

This post was edited on 09-11-2006 at 11:27 AM by alexp2_ad.
09-11-2006 11:26 AM
Profile E-Mail PM Find Quote Report
skorpan
Junior Member
**


Posts: 16
Joined: Sep 2006
O.P. RE: RE: RE: [question] Run commands from script
quote:
Originally posted by alexp2_ad
So to get an actual \ into a string, you double it up to \\ and it gets changed into a \ when the string is passed / used etc.

I wrote this above...
quote:
But the functions in Messenger Plus scripting enviroment returns path in the style of "c:\my dp folder\", so I need to change it to "c:\\my dp folder\\".

I ask again: How do I double it up in a string?
09-11-2006 11:34 AM
Profile E-Mail PM Find Quote Report
alexp2_ad
Scripting Contest Winner
****

Avatar
Who love the chocolate?

Posts: 691
Reputation: 26
37 / Male / –
Joined: May 2004
Status: Away
RE: [question] Run commands from script
You actually WANT a double \\ for some reason?

Use a quadruple one:

"c:\\\\my dp folder\\\\"

That will be seen as "c:\\my dp folder\\"
09-11-2006 11:36 AM
Profile E-Mail PM 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