experimenting with Wscipt.shell - 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: experimenting with Wscipt.shell (/showthread.php?tid=94242) experimenting with Wscipt.shell by scripto on 03-30-2010 at 11:35 AM
code: shouldn't the code above execute a shutdown command once i receive the word comment from a contact in a chat box ??? it's not working where is the error ?? RE: experimenting with Wscipt.shell by matty on 03-30-2010 at 01:11 PM
quote:Correct me if I am wrong but I am sure this is case sensitive... Javascript code: RE: experimenting with Wscipt.shell by Spunky on 03-30-2010 at 05:00 PM
quote: IIRC it is. Also, you don't need the path as matty has shown, but it may help. @matty: You forgot to double slash before "shutdown" and the "s" in "Shell" <in the op> wasn't in the correct case either. RE: experimenting with Wscipt.shell by matty on 03-30-2010 at 05:05 PM
quote:Fixed and the objects name is case insensitive. RE: experimenting with Wscipt.shell by scripto on 03-30-2010 at 05:57 PM
ok with all of you guys argument about it am kinda lost RE: experimenting with Wscipt.shell by matty on 03-30-2010 at 06:28 PM Did you try the code that I had posted? RE: experimenting with Wscipt.shell by djdannyp on 03-30-2010 at 06:36 PM
This is all the code you need: Javascript code: RE: experimenting with Wscipt.shell by scripto on 03-30-2010 at 07:05 PM
@matty: i just test it and it work fine RE: experimenting with Wscipt.shell by matty on 03-30-2010 at 07:10 PM
quote:Not sure what the problem was. I was simply pointing out things it could be. You had ActiveXOBject. You may have needed the full path the the executable etc. RE: experimenting with Wscipt.shell by scripto on 03-30-2010 at 07:46 PM
mmm ok anyway thank you RE: experimenting with Wscipt.shell by CookieRevised on 03-31-2010 at 11:13 AM
Yes, you can create a script which reads the output of shelled commands (commands executed in a so called 'DOS box'). You could use some command line redirection 'tricks' or you could Windows APIs to do the job (better, more robust way). But that wont be easy to understand if you're not an experienced scripter though. RE: experimenting with Wscipt.shell by scripto on 03-31-2010 at 07:52 PM
just wanna create something looks like telnet or SSH RE: experimenting with Wscipt.shell by CookieRevised on 04-01-2010 at 02:37 AM
quote:That would be extreme hard to do. If not, a lot of work. By creating something like that you're reinventing the wheel. Why not simply install a remote desktop program (or use the build in remote desktop function in Messenger/Windows)? It will do everything you which for and more. quote:There is no alternative link; the link is correct. Make sure you aren't blocking some sites in your browser or firewall, etc. RE: experimenting with Wscipt.shell by scripto on 04-01-2010 at 05:57 PM
mmm nahh i just need to know how to read th result of the dos box and the rest will be little bit easy i may be new with JScript but i have some experience with C/C++ and java RE: experimenting with Wscipt.shell by CookieRevised on 04-02-2010 at 10:39 AM
What result do you exactly mean? The entire dos box? or the output of the last command? And is that output always just 1 line, or not (remember that many commands produce an unknown amount of multiple lines of text output). And what exact commands do you want to use (most important question)? RE: experimenting with Wscipt.shell by scripto on 04-02-2010 at 12:13 PM
mm i just want to capture the result of the command line and all the box... and for sure the output is not always one line RE: experimenting with Wscipt.shell by CookieRevised on 04-02-2010 at 01:44 PM
quote:yes, but _what_ exact command line? quote:It doesn't need to be scriptable. Remote desktopping means you are in total control (at least what the other party has granted you access to) of the remote computer. You can do whatever you want as if you are physically in front of that remote computer. RE: experimenting with Wscipt.shell by scripto on 04-02-2010 at 02:52 PM
mmm let's say the "dir" command the "del"... "copy" RE: experimenting with Wscipt.shell by SmokingCookie on 04-02-2010 at 06:42 PM
You'll need to output some stuff that is known to your script; things it'll be looking for. An example: Batch code: Then have the script load the file and search for "!BEGINBATCH!", "!ENDCOMMAND!" and "!ENDBATCH!". NB you'll need to know where Output.txt is located. I don't really know where you'll find it; you'll need to experiment with that. RE: experimenting with Wscipt.shell by CookieRevised on 04-02-2010 at 11:04 PM
quote:Such a batch file is not needed. It is making things way too limited and too complicated. If you take the "redirecting the command line" approach (which is already a complicated thing if you want to do it right), 'all' you need to do is to add something like "> UNIQUENAME.TXT" to the command line you've send to your remote pc. ------------------ Note that that is just a simply example, the stuff you actually need to add will be a bit more complicated as you also need to catch errors and messages which are not send to the standard output but to the secondary error stream. People who often work in DOS know what I mean; eventhough you used "> file.txt" sometimes stuff will still be printed on the screen. eg: do "dir :: > file.txt". So, you actually need to add "> UNIQUENAME.TXT 2>&1" to also redirect the STDERR stream to the STDOUT stream. UNIQUENAME must be unique, as you do not want to overwrite an existing output file from a previous command which is still running. ------------------ But the hard part is that you need to wait until the command has finished before you can open the output file and send it. And if you get the command wrong, it might even be that the process will never end to begin with. Also some commands do require keyboard input (eg: "dir /p"). It speaks for its own that doing such commands (even by accident!) will render the whole process useless and the script running this will hang and probably take messenger with it. But all in all, using this method is very limited; you can only do so much with the command line, and constantly needing to send output files doesn't work that well in practice. So, the method is a very dodgy way of doing things, because... ...If you have only a fixed set of commands you want to use, you far better use Windows APIs to do the stuff directly. ...And if you're not sure about what commands you're going to need (or want to do stuff like file and directory manipulations - you said you want to use DIR, COPY, DEL, etc), I strongly recommend using a Remote Desktop software. There are a lot of free and small Remote Desktop softwares available on the net, not to mention that it is also already available in Windows and directly accessable from Messenger. It has also the benefit that you would still be able to access your remote pc and do stuff when Messenger has problems logging in, etc. Imagine you're doing some file/dir maintenance and suddenly Messenger disconnects, then you're screwed... With remote desktopping you wont have that problem. RE: experimenting with Wscipt.shell by scripto on 04-03-2010 at 12:04 PM
ok thank you all for your respond |