Page 1 of 1

Recent Stack List - File Menu

Posted: Tue Apr 10, 2012 5:18 am
by pderks
I found a solution, to manipulate the Recent Stack List offered by the Menu Item 'Open Recent File' of the Menu 'File' according to my needs.

My Stack | Script expects 6 Controls:
  • • 2 Fields:
    • • LC_Recent_Lim
      • LC_Recent
  • • 4 Buttons
    • • pdLC_Recent_Lim_Get
      • pdLC_Recent_Lim_Set
      • pdLC_Recent_List_Get
      • pdLC_Recent_List_Set

Code: Select all

---
on pdLC_Recent_Lim_Get
   put the cNumRecent of stack "revPreferences" into fld "LC_Recent_Lim"
end pdLC_Recent_Lim_Get
---
on pdLC_Recent_Lim_Set
   put fld "LC_Recent_Lim" into Lim
   if Lim is not an integer then put 60 into Lim
   put Lim into fld "LC_Recent_Lim"
   set the cNumRecent of stack "revPreferences" to Lim
end pdLC_Recent_Lim_Set
---
on pdLC_Recent_List_Get
   put "LC_Recent" into FdNa
   put "" into fld FdNa
   wait 10 ticks
   set the TabStops of fld FdNa to 500
   put "" into RSL
   -- put the cRecentStackPaths of stack "revPreferences" into RSL_I 
   put the cRecentPaths of stack "revPreferences" into RSL_I 
   set the Itemdelimiter to "/"
   repeat for each line LineX in RSL_I
      put last item of LineX & tab & LineX & cr after RSL
   end repeat
   set the ItemDelimiter to tab
   delete last char of RSL
   put RSL into fld FdNa
   repeat with ii = 1 to the Number of lines in fld FdNa
      get item 2 of line ii of fld FdNa
      if there is no file it then set the TextColor of line ii of fld FdNa to "red"
   end repeat
   sort lines of fld FdNa
   put the cNumRecent of stack "revPreferences" into fld "LC_Recent_Lim"
end pdLC_Recent_List_Get
---
on pdLC_Recent_List_Set
   put "LC_Recent" into FdNa
   put false into Miss_F
   set the ItemDelimiter to tab
   sort fld FdNa
   repeat with ii = 1 to the Number of lines in fld FdNa
      get item 2 of line ii of fld FdNa
      if there is no file it then 
         put true into Miss_F
         set the TextColor of line ii of fld FdNa to "red"
      end if
   end repeat
   if Miss_F = true then
      answer Error "Some Files do not exist …"
      exit to top
   end if
   answer Question "Set the RecentStacks to this StackList ?" with "Yes" or "Cancel"
   if it ≠ "Yes" then exit to Top
   put "" into RSL
   repeat for each line LineX in fld FdNa
      put item 2 of LineX & cr after RSL
   end repeat
   set the ItemDelimiter to comma
   delete last char of RSL
   set the cRecentStackPaths of stack "revPreferences" to RSL
   set the cRecentPaths of stack "revPreferences" to RSL
   put the cNumRecent of stack "revPreferences" into fld "LC_Recent_Lim"
end pdLC_Recent_List_Set
Have fun

Peter