--- In [email protected], "brucexs" <[EMAIL PROTECTED]> wrote:
>
> --- In [email protected], "aviasd" <aviasd@> wrote:
> >
> > Hi
> > 
> > I want to build a menu of recent documents , sorted by their 
loading 
> > application. so that on a keypress, a menu pops showing a colmun 
> > seperated menu of 10 recent xls, pdfs , docs etc .. allowing me 
to  
> to 
> > open/copy path etc...
> > 
> > so the question is - can I get the file association of an lnk 
file 
> and 
> > sort the lnks in A directory according to this association ?
> 
> Yes, but with significant scripting.
> - use file.deleteold to keep recent folder at a reasonable size 
(this 
> could be a startup scheduled event rather than in script)
> 
> - use file.listfiles or .allfiles to get files in recent folder.
> - use file.resolve to get actual path and keep both whole path and 
> extension  in separate vectors
> - use file.doublesort to sort whole paths based on extension
> - write vector of whole paths to file, formatted either for 
filemenu 
> (easy) or .ini (harder) adding column separating directives as 
desired
> - display with menu showfile or filemenu function
> - if you want to do something other than just run the file, you 
will 
> also have to have some say of specifying these different actions, 
like 
> different hot keys, or displaying a another menu after choosing the 
> file, or interpreting left and right mouse clicks for menu 
selection 
> differently
> -
>


Here's my script - It's good and running.
assigned hotkey for running the script and preping the file ,and a 
bar click to open the file as menu filemenu. 
When I click an item it opens it... only thing I don't know is how to 
assign specific actions per mouse click.. For instance:
I want to left click to run , and right click to copy to clipboard...

is there an option to do that without creating ini files ?


The script:


;create sorted menu of recent document by extention
  prof = env("userprofile")
  recent = prof ++ "\\recent"

  maxitems = 100
;max items to display
  oldestDate = 55
;how many files to keep in recent
  file.deleteold(oldestDate,recent)

  local m ,key
  m=map.create(maxItems)
  file.allfiles(recent,"m[file.resolve(_file_)]=file.type(file.resolve
(_file_))")

  local v,w,i
  v = vec.create(maxItems)
  w = vec.create(maxItems)
  i=1
        m.restart
        for (1)
           key = m.getnext
           if (m.eof)
              break
           v[i] = key
           w[i] = m[key]
           i++

         ;  win.debug(v[i],w[i])
        endfor

  w.doublesort(v)
  n = vec.create(100)
  j=0
  if (w[0]=="") do
    n[j]="Folders"
  else
    n[j]=w[0]
  endif
  j++
  currext =w[0]
  maxi =25
        for (i=1; i<v.length; i=i+1)
           if (currext!==w[i]) do
             currext= w[i]

             if (j>maxi) do
               n[j]= "colsep"
               maxi = maxi + 25
             else
               n[j] = "sep"
             endif
             j++
             n[j] = "filetype: " ++ currext
             j++
           endif
           if (length(v[i])>30) do
             maxvi = select(v[i],9) ++ ".." ++ select(v[i],-20)
           else
             maxvi = v[i]
           endif
           n[j] = maxvi++ "=\"" ++ replacechars(v[i],"\\","/") ++ "\""
           j++
        endfor

 han = file.open(pprofolder ++ "/extsort.txt", "w")
 
        for (i=0; i<n.length; i=i+1)
           han.WriteLine(n[i])
        endfor
        han.close

;---------------------------------------

ps - it's my first ppro script, so programming tips are appreciated :)

Avi

Reply via email to