Command line with autocomplete

Next
 From:  ttype (STRUBE)
7280.1 
I have written a small command line with autocomplete. Neither finished nor beautiful yet, but working for me. Maybe someone is bored and very good in CSS and jQuery.

It can be found here:
https://github.com/thetumbledtype/moi3d-scripts-other/blob/master/CmdLine.htm
Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Max Smirnov (SMIRNOV)
7280.2 In reply to 7280.1 
Great!
But I think it will be better to read all commands directly from the commands directory.
Try this:
code:
cmds=[];
var files = moi.filesystem.getFiles(moi.filesystem.getCommandsDir(), '*.js' );
for ( var i = 0; i < files.length; i++ ) { cmds.push( files.item(i).substring(files.item(i).lastIndexOf(moi.filesystem.getPathDelimiter())+1, files.item(i).lastIndexOf("."))); }	
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  ttype (STRUBE)
7280.3 In reply to 7280.2 
I have removed the icons from sidepane.htm so that I have more space for objects, since I tend to have several layers for construction lines and profiles. Right now it works for me, but I have to work with it for a while to see whether there better possibilities for me to choose tools.

What really didn't work was making the whole thing part of a fly out menu, because the resizing closes the window. Otherwise I would have written something that just adds a search field to ExtScriptsFull.menu.htm.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  ttype (STRUBE)
7280.4 In reply to 7280.2 
Hi Max, found out your example is not working when running MoI using Wine. moi.filesystem.getPathDelimiter() for some reason returns Ubuntu's / and not Wine's \.

code:
var cmds = [];
var files = moi.filesystem.getFiles(moi.filesystem.getCommandsDir(), '*.js');
for ( var i = 0; i < files.length; i++ ) {
    var fn = moi.filesystem.getFileNameFromPath(files.item(i));
    cmds.push(fn.slice(0, -3));
}
cmds.sort();
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All