Wunsch: Liste zuletzt geöffneter Dateien aktualisieren.

Allgemeine Fragen zu SoftMaker Office 2018 für Linux. Für alles andere bitte die programmspezifischen Foren benutzen.
Antworten
Benutzeravatar
Michael Uplawski
Beiträge: 783
Registriert: 09.06.2010 14:27:54

Wunsch: Liste zuletzt geöffneter Dateien aktualisieren.

Beitrag von Michael Uplawski »

Benutze weiterhin mein Skript, jetzt für sämtliche installierten Office-Versionen.

Siehe auch Liste zuletzt geöffneter Dateien aktualisieren und alle Vorgängerthreads.
Benutzeravatar
Michael Uplawski
Beiträge: 783
Registriert: 09.06.2010 14:27:54

Re: Wunsch: Liste zuletzt geöffneter Dateien aktualisieren.

Beitrag von Michael Uplawski »

Ich weiß, dass es dazu schon eine Basic-Version gegeben hat.

Hier nochmal mein Ruby-Skript, “verbessert” um die Möglichkeit, Konfigurationen in ~/Softmaker/Settings oder ~/.softmaker zu finden. Damit funktioniert das Skript mit der Version 2018 und den Vorgängern des Office-Pakets.
Es werden auch leere Dateien aus der History entfernt.

Damit das bei jedem Start eines Office-Programms läuft, muss das Startskript für ein Office-Programm um den Aufruf des Skripts erweitert werden. Zum Beispiel für /usr/bin/textmaer16free:

Code: Alles auswählen

#!/bin/sh
# A script to run TextMaker.
/home/[user]/bin/so_refresh_history.rb
/usr/share/freeoffice2016/textmaker "$@"
Eine aktuelle Ruby-Version wird ebenfalls benötigt.

Code: Alles auswählen

#!/usr/bin/env ruby
#encoding: UTF-8
=begin
/***************************************************************************
 *   ©2016-2018 Michael Uplawski <michael.uplawski@uplawski.eu>            *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
=end

SDIR_old="%s/%s" %[ENV['HOME'], '.softmaker']
SDIR="%s/%s" %[ENV['HOME'], 'SoftMaker/Settings']

[SDIR_old, SDIR].each do |d|

  configs = Dir.new(d).entries.collect{|e| e if e.end_with?('config.ini') && !e.start_with?('bak') }.compact
  configs.each do |e|
    fn = d.dup << File::Separator << e
    puts "working on " << e
    cont = File.read(fn)
    if(cont.include?('History]') )
      hist = cont.match(/History\][^\[]*/m)[0]
      lines = hist.split("\n")
      lines.delete_if do |l|
        if(l.include?(','))
          file = l.split(',')[2]
          !file || file.empty? || !File.exist?(file.strip)
        end
      end	
      cont_a = cont.split(hist)
      cont = cont_a[0] 
      if(lines.length > 0)
        cont << lines.join("\n")
      end
      if cont_a.length > 1
        cont << "\n" << cont_a[1]
      end
      puts "Writing file " << fn
      File.write(fn, cont)
    end
  end
end
Antworten

Zurück zu „SoftMaker Office 2018 für Linux (allgemein)“