Shoutbox

Coding help - 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: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Coding help (/showthread.php?tid=73389)

Coding help by Jimbo on 04-07-2007 at 04:23 PM

1) Why won't this work?

code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
if(Message=="notepad")
{
var shell = new ActiveXObject("wscript.shell");
shell.Run("notepad.exe");
return ""
}
}


2) How can i open notepad with some text already on it?
RE: Coding help by Felu on 04-07-2007 at 04:48 PM

1) The code seems to be fine. What does the debug window say?
2) Not possible unless you create a text file and edit it using a script and then open the next file.


RE: Coding help by Jesus on 04-07-2007 at 05:29 PM

quote:
Originally posted by Jimbodude
1) Why won't this work?
works for me :^)
RE: Coding help by felipEx on 04-07-2007 at 09:30 PM

you can try:

code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
if(Message=="notepad"){
return "/run notepad"
}
}

(A)
RE: Coding help by markee on 04-08-2007 at 09:04 AM

if you are wanting it to act like a command then you forgot the / ;)

if you just write "notepad" (without the quotes) as your whole message then it will work as long as you don't have the likes of Message Customizer! Live installed which will add colour coding to your message.

quote:
2) How can i open notepad with some text already on it?
You have a coupe of choices:
  • make a new text file and open it
  • parse keys (not a good method)
  • use the copy and paste method which is in a different thread (again not good)

These are the only ways I know of.
RE: Coding help by CookieRevised on 04-08-2007 at 09:10 AM

1) provided you enter "notepad" (without the quotes) and you don't have any other script which messes up the text you entered, as markee has suggested, it is possible that notepad.exe isn't listed in your default path, hence the run command wouldn't be able to find it and be able to start it.


2) two ways:

a) create a textfile first and open this with notepad.
Either by simply specifying the temporary name of the textfile as the command line (this will open the textfile with your default associated program, which is probably notepad).
Or enter the temporary textfile as a parameter of notepad on the command line.

b) open up notepad, find the window, and use Windows APIs to fill the text in.

c) any method invovling parsing and/or sending keys (this includes copy/pasting) is not a proper method and should never be used.