Shoutbox

How Can I Open Windows Explorer ? - 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: How Can I Open Windows Explorer ? (/showthread.php?tid=81499)

How Can I Open Windows Explorer ? by Lén on 02-06-2008 at 11:11 PM

Hi,
After hours of research i've decided to post here...

So my problem is that i want to create a command that open the windows explorer like the /received command do for "My received files"  ... so if anybody knows how to do it...

RE: How Can I Open Windows Explorer ? by Patchou on 02-06-2008 at 11:18 PM

Something like this should work :)

code:
Interop.Call("shell32.dll", "ShellExecuteW", 0, "explore", "C:\directory", 0, 0, 1)

RE: How Can I Open Windows Explorer ? by Lén on 02-06-2008 at 11:26 PM

I try it now


RE: How Can I Open Windows Explorer ? by Eljay on 02-06-2008 at 11:27 PM

You will need to use a double backslash for the path (e.g. "C:\\directory").


RE: How Can I Open Windows Explorer ? by Lén on 02-06-2008 at 11:45 PM

My script looks like it:

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    var explorer = '/explorer ';
        if(Message.substring(0,8)==explorer)
    {
    Interop.Call("shell32.dll", "ShellExecuteW", 0, "explore", "C:\\Documents and Settings", 0, 0, 1);
        return '';
    }
}

function OnGetScriptCommands(){
    var commands = '<ScriptCommands>';
        commands+='<Command>';
            commands+='<Name>BendeR</Name>';
            commands+='<Description>Multi-fonctions</Description>';
        commands+='</Command>';
        commands+='</ScriptCommands>';
    return commands;
}

function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd){
    if(MenuItemId=="enabled"){
        OriginWnd.SendMessage(OnEvent_ChatWndSendMessage("", "/explorer"));
    }
    if(MenuItemId=="about"){
        WndAbout = MsgPlus.CreateWnd("WndAbout.xml", "WndAbout");
    }
}

function OnGetScriptMenu(nLocation){
    var ScriptMenu = "<ScriptMenu>\n";
    if(nLocation===1){
        ScriptMenu    +=    "<MenuEntry Id=\"enabled\">Explorer</MenuEntry>";
        ScriptMenu    +=    "<Separator/>";
    }
    ScriptMenu    +=    "<MenuEntry Id=\"about\">À propos</MenuEntry>";
    ScriptMenu    += "</ScriptMenu>";
    return ScriptMenu;
}

But I miss something... 'cause it still not work :(

EDIT:
there isn't a /explorer in the command window, why?
RE: RE: How Can I Open Windows Explorer ? by pollolibredegrasa on 02-07-2008 at 12:13 AM

quote:
Originally posted by Lén
there isn't a /explorer in the command window, why?

code:
function OnGetScriptCommands(){
    var commands = '<ScriptCommands>';
        commands+='<Command>';
            commands+='<Name>BendeR</Name>';
            commands+='<Description>Multi-fonctions</Description>';
        commands+='</Command>';
        commands+='</ScriptCommands>';
    return commands;
}


The part in bold defines what is shown in the command window, so it needs to be

code:
commands+='<Name>explorer</Name>'

Also, after quickly looking at your code, the lines
code:
var explorer = '/explorer ';
if(Message.substring(0,8)==explorer)
should be
code:
var explorer = '/explorer';
if(Message.substring(0,9)==explorer)


Hope this helps. :)
RE: How Can I Open Windows Explorer ? by Lén on 02-07-2008 at 12:21 AM

OMG! you're great !!
All work ! thanks guys


RE: How Can I Open Windows Explorer ? by Spunky on 02-07-2008 at 12:23 AM

quote:
Originally posted by fatfreechicken
Also, after quickly looking at your code, the lines

code:

var explorer = '/explorer ';
if(Message.substring(0,8)==explorer)



should be
code:

var explorer = '/explorer';
if(Message.substring(0,9)==explorer)





Hope this helps. 


I'm fairly certain it only needs 8, not 9... It's zero based
RE: How Can I Open Windows Explorer ? by Lén on 02-07-2008 at 12:36 AM

Let's Tryin'....

Biiiip !!! Wroong!


No ... it doesn't work with 8 on my script... (he is a rebel, or it is normal... who cares ^^).


RE: How Can I Open Windows Explorer ? by Eljay on 02-07-2008 at 12:44 AM

quote:
Originally posted by SpunkyLoveMuff
I'm fairly certain it only needs 8, not 9... It's zero based

The first parameter is zero-based because it's an offset, but the second parameter is just the length of the substring.
RE: How Can I Open Windows Explorer ? by Spunky on 02-07-2008 at 04:03 PM

* Spunky === n00b