Folder content in a smart dropdown button

Discuss and share scripts and script files...
Post Reply
sinilill
Posts: 111
Joined: 02 Dec 2013 18:37

Folder content in a smart dropdown button

Post by sinilill »

I have taken the script from the PaperList script and modified a little bit, I hope the original authors don't mind it.
The main task for the script would be to make a smart dropdown button from a folders content. With files, Xyplorer should open them, with folders Xyplorer should open them in a new tab.
Maybe a more experienced user can have a look at the script, correct some mistakes and make it better, right now it just open files.

The script so far:

Code: Select all

  $DISASTER_MSG = "You don't have at least one file!<crlf><crlf>Quiting now.";
  $DIR_FILES = "<xypath>\_GAMES";

  // Gather menu entries
  $Files = "";
  //Layout section: Prepare list from files names of saved layouts
  If (Exists($DIR_FILES) == 2) {
    //$Files = ListFolder($DIR_FILES, "*.*", 5);
    $Files = FormatList(FolderReport("files","r",$DIR_FILES\,"r",,"|"),f,"|","*.*");
    $Files = Replace($Files, "$DIR_FILES\", "");
    $Files = Replace($Files, "*.*", "");
  }

  // Exit if nothing is to pick
  If (!$Files) {
    Msg($DISASTER_MSG);
    End(1);
  }

  // Build and assemble menu
  $Filemenu = "";
  If ($Files) {
    Foreach ($Item, $Files, "|") {
      $Filemenu = $Filemenu . "  $Item|<xyicons>\circle.ico"<crlf>;
      $Filemenu = $Filemenu . "  open(""$DIR_FILES\$Item"", , , ""l"");<crlf><crlf>";
    }
    $Filemenu = """$DIR_FILES|<xyicons>\folder.ico""" . ";" . "<crlf>" . "$Filemenu";
  }

  //Load($Filemenu, , s);
  $MScript = $Filemenu;
  Load($MScript, , s);
Many thanks

Post Reply