Page 2 of 2

Re: Tip: Simple file-based favorites

Posted: 19 Oct 2010 18:09
by SkyFrontier
Admin:
"Caption|Icon" goto "C:\Windows";
:shock: Outstanding. :shock:
Now I have a full featured temp/perm favs system, completely under control and easy (although I see a bit more room to improve this) to maintain.
Thank you very much, Don!

Re: Tip: Simple file-based favorites

Posted: 04 Nov 2010 16:05
by SkyFrontier
Cool entry to used along with the PermaFavorites trick:

Code: Select all

   $a = inputselect("E:\Access\ - Select Item/Folder to Open:", listfolder(E:\Access\, "*", 0)); #340; goto $a; focus; sendkeys"{enter}";
That way one can build a list and have several favorite containers listing hundreds of files at once, if he wants it so.
In hopes this gets better sorting options to display destination files/folders...
---
Using vale 4 for listfolder displays destination files/folders with no icons and path used is <curpath> instead of destination's - so files are unreachable. Is that correct?

Code: Select all

Reference:
v9.60.0111 - 2010-10-27 16:25
    * SC listfolder: Slightly revised the logic of the "flags" argument 
      (introduced in v9.60.0104):
        flags: (binary field)
          0: return folders and files with full paths [default]
          1: NoFolders (= return only files)
          2: NoFiles (= return only folders)
          4: NoPaths (= return the filenames without paths)

Re: Tip: Simple file-based favorites

Posted: 06 Nov 2010 20:32
by SkyFrontier
Formatlist:

Code: Select all

v9.70.0001 - 2010-11-06 16:12
    + Scripting got a new function.
      Name:   formatlist
      Action: Formats a list of items.
Great.
-how do I put this together?

Code: Select all

::$b = listfolder(E:\Access\, "*", 0); $a = inputselect("E:\Access\ - Select Items to Open:", formatlist($b, "s")); #340; goto $a; focus; sendkeys"{enter}";
Better? Fine.
You may want to edit S value at formatlist($b, "s") to meet your sorting needs, following the parameters stated at the link above.
EDIT: Scratched the original post to offer this as a solution. Lateral thinking can certainly cover some script-inabilities, sometimes... :wink:

Re: Tip: Simple file-based favorites

Posted: 30 Aug 2013 22:09
by totmad1
Came across this when looking for opening a single favorite folder.
I found I have a lot of favs folders, and on occasion only want to open a certain folder,
so altered this coding to help.
I hope this may help others.

Code: Select all

"Edit script : edit"
    $ScriptFile= self ("file");
	    run "notepad" $ScriptFile,w; // change "notepad" to your replacement
-
"test|:favfiles"
     global  $Subject ;  $Subject = "TEST";
           sub _Choose;
"AUDIO|:favfiles" 
     global  $Subject ;  $Subject = "AUDIO";
           sub _Choose;

"VID&&PROG|<xyicons>\temp\starBlGrn.ico" 
     global  $Subject ; $Subject = "VID&PROG";
        sub _Choose;

"DOC&&BOOK|<xyicons>\temp\Clipboard-1.ico"      // Note the use of DOUBLE Ampersand
     global  $Subject ; $Subject = "DOC&BOOK";  // Note the use of single Ampersand 
        sub _Choose;

"BACKUP|<xyicons>\temp\starRed.ico" 
     global  $Subject ; $Subject = "BACKUP";
        sub _Choose;

"PICICO|<xyicons>\temp\starGreen.ico" 
     global  $Subject ; $Subject = "PICICO";
        sub _Choose;

"ODD|<xyicons>\temp\starPink.ico" 
     global  $Subject ; $Subject = "ODD";
        sub _Choose;

"TEMP|<xyicons>\temp\starBlue.ico" 
     global  $Subject ; $Subject = "TEMP";
        sub _Choose;

"MyPaint|<xyicons>\temp\starCyan.ico" 
     global  $Subject ; $Subject = "MyPaint";
        sub _Choose;
"SCRIPT|<xyicons>\temp\starPurple.ico" 
     global  $Subject ; $Subject = "SCRIPT";
        sub _Choose;

-
-

"_favorites"  
       global  $Subject; #340; load "<xyscripts>\fav$Subject.xys";
"_SetTabs"
//collect paths from all tabs in current pane:
          global  $Subject;
   $TabCount = tab(,"c"); //how many tabs are open?
   //$Pane = getinfo("Pane"); //which pane is active?

   $Loop = 1;
   $Tabs = "";
   while ($Loop<=$TabCount)  //for each tab do
   {
     $Tabs = $Tabs . tab("get", "path", $Loop) . "\<crlf>";
     incr $Loop;
   }
   writefile("<xyscripts>\fav$Subject.xys", $Tabs);
   sel;
   status "Tabs stored as (Favorites) fav$Subject.xys!";
"_EditFolderPaths" global  $Subject;
   open "<xyscripts>\fav$Subject.xys";

"_Choose" 
   $Item = input ("Do you want to choose to (O)pen folder [Default], <crlf> (S)et from tabs , (E)dit list." ,, o ) ;
         if ($Item=="s"){
        sub _SetTabs ;
        }
         elseif ($Item=="e") {
            sub _EditFolderPaths ;
         }
        else {
          sub _favorites ;
          }

"CANCEL"

As you can see it is easy to alter to your own use.