ja, auch nicht Funktioniert.
Beiträge von sam2008
-
-
-
Hallo Zusammen,
diese UserScript funktioniert nicht mit Firefox 115.3.1 ESR.
Kann jemand sagen, wieso oder wo das Fehler ist:
setCurrentProfileNameToTitlebar.uc.js
Code
Alles anzeigen// ==UserScript== // @name setCurrentProfileNameToTitlebar // @namespace http://space.geocities.yahoo.co.jp/gl/alice0775 // @description Aktuellen Profilnamen in der Titelleiste anzeigen // @include main // @compatibility Firefox 117 // @author Alice0775 // @version 2022/06/03 00:00 // @version 2012/12/31 00:00 Bug 818800 Remove the global private browsing service // ==/UserScript== // @version 2023/07/17 00:00 use ES module imports // @version 2015/06/06 fix // @version 2012/08/06 08:00 remove hack privatebrowsingUI // @version 2010/09/25 23:00 Bug 598221 - Page Title not shown in Title Bar on Session Restore // @version 2009/07/25 18:00 Bug 506437 - The titlebar of a tear off window is not updated correctly after having detached a tab // @version 2008/03/06 15:00 // @Note Ich kenne nichts anderes als die offizielle Win32-Version und die, die den Pfad mit der Startoption -profile ändert (function(){ // Aktuellen Profilnamen abrufen // Unterstützung auch bei Namensänderung // Ich wünschte, ich könnte einen intelligenteren Weg verwenden (nsIToolkitProfileService)...orz, aber das funktioniert // Ich kenne nichts anderes als die offizielle Win32-Version und der Pfad wird durch die Startoption -profile geändert function getCurrentProfileName(){ function readFile(aFile){ let stream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(Ci.nsIFileInputStream); stream.init(aFile, 0x01, 0, 0); let cvstream = Cc["@mozilla.org/intl/converter-input-stream;1"].createInstance(Ci.nsIConverterInputStream); cvstream.init(stream, "UTF-8", 1024, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER); let content = "", data = {}; while (cvstream.readString(4096, data)) { content += data.value; } cvstream.close(); return content.replace(/\r\n?/g, "\n"); } let PrefD = Services.dirsvc.get("PrefD", Ci.nsIFile); let ini = Services.dirsvc.get("AppRegD", Ci.nsIFile); ini.append("profiles.ini"); ini = readFile(ini); let profiles = ini.match(/Name=.+/g); let profilesD = ini.match(/Path=.+/g); for ( let i = 0; i < profiles.length;i++) { if ((profilesD[i]+"$").indexOf(PrefD.leafName+"$") >= 0) { profiles[i].match(/Name=(.+)$/); return RegExp.$1; } } return null; } window.setCurrentProfileNameToTitlebar = function(){ let profile = getCurrentProfileName(); if (!profile) return; // Set the title modifer to include the build ID. let appBuildID = Services.appinfo.appBuildID; let version = Services.appinfo.version; let mainWindow = document.getElementById("main-window"); let { AppConstants } = ChromeUtils.importESModule( "resource://gre/modules/AppConstants.sys.mjs" ); let versionAttributes = { version: AppConstants.MOZ_APP_VERSION_DISPLAY, bits: Services.appinfo.is64Bit ? 64 : 32, }; ["data-title-default", "data-title-private", "data-content-title-default", "data-content-title-private"].forEach(callback); function callback(attrname){ let originalName = mainWindow.getAttribute(attrname); let titlemodifier = originalName + " " + versionAttributes.version + "-[" + profile+ "] ";// + " - " + appBuildID; // Set the new title modifier mainWindow.setAttribute(attrname, titlemodifier); } } setTimeout(function(){ setCurrentProfileNameToTitlebar(); //xxx Bug 598221 gBrowser.updateTitlebar() }, 500); })();
Vielen Dank
Mfg
-
Hallo,
vielen Dank. Jetzt funktioniert wieder.
Herzlichen Dank
-
Hallo zusammen,
diese Skript funktioniert mit Firefox 115.1.0 ESR aber nicht mit Firefox Nightly 118.0a1, kann jemand bitte mir sagen warum?
bookmarks_backup_restore_buttons.uc.js
Code
Alles anzeigen// Bookmarks Backup/Restore button script for Firefox 60+ by Aris (function() { try { Components.utils.import("resource:///modules/CustomizableUI.jsm"); ChromeUtils.importESModule("resource:///modules/CustomizableUI.sys.mjs"); var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService); var RESTORE_FILEPICKER_FILTER_EXT = "*.json;*.jsonlz4"; ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.defineModuleGetter(this, "MigrationUtils", "resource:///modules/MigrationUtils.jsm"); ChromeUtils.defineModuleGetter(this, "BookmarkJSONUtils", "resource://gre/modules/BookmarkJSONUtils.jsm"); ChromeUtils.defineModuleGetter(this, "PlacesBackups", "resource://gre/modules/PlacesBackups.jsm"); CustomizableUI.createWidget({ id: "uc-bookmarks_backup", // button id defaultArea: CustomizableUI.AREA_NAVBAR, removable: true, label: "Bookmarks Backup", // button title tooltiptext: "Bookmarks Backup", // tooltip title onClick: function(event) { if(event.button=='0') { let backupsDir = Services.dirsvc.get("Desk", Ci.nsIFile); let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); let fpCallback = function fpCallback_done(aResult) { if (aResult != Ci.nsIFilePicker.returnCancel) { // There is no OS.File version of the filepicker yet (Bug 937812). PlacesBackups.saveBookmarksToJSONFile(fp.file.path) .catch(Cu.reportError); } }; fp.init(window, "json", Ci.nsIFilePicker.modeSave); fp.appendFilter("json", RESTORE_FILEPICKER_FILTER_EXT); fp.defaultString = PlacesBackups.getFilenameForDate(); fp.defaultExtension = "json"; fp.displayDirectory = backupsDir; fp.open(fpCallback); } }, onCreated: function(button) { return button; } }); CustomizableUI.createWidget({ id: "uc-bookmarks_restore", // button id defaultArea: CustomizableUI.AREA_NAVBAR, removable: true, label: "Bookmarks Restore", // button title tooltiptext: "Bookmarks Restore", // tooltip title onClick: function(event) { if(event.button=='0') { let backupsDir = Services.dirsvc.get("Desk", Ci.nsIFile); let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); let fpCallback = aResult => { if (aResult != Ci.nsIFilePicker.returnCancel) { // check file extension if (!fp.file.path.toLowerCase().endsWith("json") && !fp.file.path.toLowerCase().endsWith("jsonlz4")) { this._showErrorAlert(PlacesUIUtils.getString("bookmarksRestoreFormatError")); return; } // confirm ok to delete existing bookmarks if (!Services.prompt.confirm(null, PlacesUIUtils.getString("bookmarksRestoreAlertTitle"), PlacesUIUtils.getString("bookmarksRestoreAlert"))) return; (async function() { try { await BookmarkJSONUtils.importFromFile(fp.file.path, { replace: true, }); } catch (ex) { PlacesOrganizer._showErrorAlert(PlacesUIUtils.getString("bookmarksRestoreParseError")); } })(); } }; fp.init(window, "json", Ci.nsIFilePicker.modeOpen); fp.appendFilter("json", RESTORE_FILEPICKER_FILTER_EXT); fp.appendFilters(Ci.nsIFilePicker.filterAll); fp.displayDirectory = backupsDir; fp.open(fpCallback); } }, onCreated: function(button) { return button; } }); // style button icon var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\ \ #uc-bookmarks_backup .toolbarbutton-icon {\ list-style-image: url("chrome://browser/skin/bookmark.svg"); /* icon / path to icon */ \ fill: red; /* icon color name/code */\ }\ #uc-bookmarks_restore .toolbarbutton-icon {\ list-style-image: url("chrome://browser/skin/bookmark.svg"); /* icon / path to icon */ \ fill: green; /* icon color name/code */\ }\ \ '), null, null); sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET); } catch (e) { Components.utils.reportError(e); }; })();
Herzlichen Dank
-
Moin 2002Andreas,
teste bitte mit diese Parameter:
Textbox caret stops blinking after a few seconds
Mfg
-
-
Moin milupo,
mit diese Code funktioniert nicht:
CodeChromeUtils.defineESModuleGetters(this, "PlacesBackups", "resource://gre/modules/PlacesBackups.sys.mjs"); ChromeUtils.defineESModuleGetters(this, "MigrationUtils", "resource:///modules/MigrationUtils.sys.mjs");ChromeUtils.defineESModuleGetters(this, "BookmarkJSONUtils", "resource://gre/modules/BookmarkJSONUtils.sys.mjs");
Hier ist mein Code:
Code
Alles anzeigenconst Cu = Components.utils; Cu.importGlobalProperties(['PathUtils']); Cu.importGlobalProperties(['IOUtils']); //**** Config.js für User Skripts **** try { if (!Services.appinfo.inSafeMode) { let path = PathUtils.parent(PathUtils.xulLibraryPath); if (Services.appinfo.OS == 'Darwin') { // macOS path = PathUtils.join(PathUtils.parent(path), 'Resources'); } var ucjsDirPath = PathUtils.join(path, 'userChromeJS'); path = PathUtils.join(ucjsDirPath, 'main.js'); const mainFileURI = PathUtils.toFileURI(path); Services.scriptloader.loadSubScript(mainFileURI, this, 'UTF-8'); } } catch(e) { Cu.reportError(e); } //**** Diesen Teil erstellt chrome Ordner in Benutzer Firefox Profile und kopiert alle Dateien **** try { Services.obs.addObserver( { observe: () => IOUtils.makeDirectory(PathUtils.join(PathUtils.profileDir + "\\chrome\\")) }, "profile-do-change", false ); Services.obs.addObserver( { observe: () => IOUtils.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\userChrome.css", PathUtils.join(PathUtils.profileDir + "\\chrome\\userChrome.css")) }, "profile-do-change", false ); Services.obs.addObserver( { observe: () => IOUtils.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\userContent.css", PathUtils.join(PathUtils.profileDir + "\\chrome\\userContent.css")) }, "profile-do-change", false ); Services.obs.addObserver( { observe: () => IOUtils.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\userChrome.js", PathUtils.join(PathUtils.profileDir + "\\chrome\\userChrome.js")) }, "profile-do-change", false ); Services.obs.addObserver( { observe: () => IOUtils.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\printpreview.uc.js", PathUtils.join(PathUtils.profileDir + "\\chrome\\printpreview.uc.js")) }, "profile-do-change", false ); } catch(e) { Cu.reportError(e); }; //**** Diesen Teil löscht in Benutzer Firefox Profile, Ordner storage\default **** try { Services.obs.addObserver( { observe: () => IOUtils.remove(PathUtils.join(PathUtils.profileDir + "\\storage\\default"), { recursive: true }) }, "quit-application", false ); } catch(e) { Cu.reportError(e); }; //**** Automatik Benutzer Favoriten Sicherung (als .json format) in User Home==>Firefox_Favoriten_BAK Ordner und Datei Name ist bookmarks.json **** //**** Wenn Firefox beendet, wird Benutzer bookmarks.json automatisch in Pfad U:\Firefox_Favoriten_BAK\ gespeichert **** try { ChromeUtils.defineModuleGetter(this, "MigrationUtils", "resource:///modules/MigrationUtils.jsm"); ChromeUtils.defineModuleGetter(this, "BookmarkJSONUtils", "resource://gre/modules/BookmarkJSONUtils.jsm"); ChromeUtils.defineModuleGetter(this, "PlacesBackups", "resource://gre/modules/PlacesBackups.jsm"); ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs"); ChromeUtils.importESModule("resource://gre/modules/PlacesUtils.sys.mjs"); Services.obs.addObserver( { observe: () => IOUtils.makeDirectory("U:\\Firefox_Favoriten_BAK") }, "quit-application-requested", false ); const path = PathUtils.join("U:\\Firefox_Favoriten_BAK\\bookmarks.json"); let importExportBookmarks = { modalWindow: null, init: async function() { Services.obs.addObserver(this, "final-ui-startup", false); }, observe: function(aSubject, aTopic, aData) { switch (aTopic) { case "final-ui-startup": BookmarkJSONUtils.importFromFile(path, {replace: false}) .then( () => this.modalWindow.open(), (e) => { IOUtils.remove(path), this.modalWindow.open(); let window = Services.wm.getMostRecentWindow('navigator:browser'); } ); Services.obs.removeObserver(this, "final-ui-startup"); Services.obs.addObserver(this, "quit-application-requested", false); break; case "quit-application-requested": let window = Services.wm.getMostRecentWindow('navigator:browser'); BookmarkJSONUtils.exportToFile(path, {replace: false}) .then( () => this.modalWindow.close(), (e) => { this.modalWindow.close(); } ); Services.obs.addObserver(this, "domwindowopened", false); window.open('', 'modalWindow', 'chrome,modal'); break; case "domwindowopened": Services.obs.removeObserver(this, "domwindowopened"); this.modalWindow = aSubject; }; } }; importExportBookmarks.init(); } catch(e) { Cu.reportError(e); }; // Java JNLP Start in MIME-Type Services.obs.addObserver(function observer(subject, topic, data) { var handlerSvc = Components.classes["@mozilla.org/uriloader/handler-service;1"] .getService(Components.interfaces.nsIHandlerService); var mimeService = Components.classes["@mozilla.org/mime;1"] .getService(Components.interfaces.nsIMIMEService); var realMIMEInfo = mimeService.getFromTypeAndExtension("application/x-java-jnlp-file", ""); var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile); file.initWithPath(getenv('itw_home')+"\\bin\\javaws.exe"); var localHandlerApp = Components.classes["@mozilla.org/uriloader/local-handler-app;1"].createInstance(Components.interfaces.nsILocalHandlerApp); localHandlerApp.executable = file; localHandlerApp.name = "javaws.exe"; realMIMEInfo.preferredApplicationHandler = localHandlerApp; realMIMEInfo.preferredAction = 2; realMIMEInfo.alwaysAskBeforeHandling = false; handlerSvc.store(realMIMEInfo); Services.obs.removeObserver(observer, topic); }, "final-ui-startup");
Mfg
-
Hallo Zusammen,
ich habe geschafft, mit diese Code funktioniert:
CodeChromeUtils.defineModuleGetter(this, "MigrationUtils", "resource:///modules/MigrationUtils.jsm"); ChromeUtils.defineModuleGetter(this, "BookmarkJSONUtils", "resource://gre/modules/BookmarkJSONUtils.jsm"); ChromeUtils.defineModuleGetter(this, "PlacesBackups", "resource://gre/modules/PlacesBackups.jsm"); ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs"); ChromeUtils.importESModule("resource://gre/modules/PlacesUtils.sys.mjs");
Vielen Dank für Hilfe
Mfg
-
ich habe mit diese auch geprüft, leider funktioniert nicht:
CodeChrome.importESModule("resource://gre/modules/BookmarkJSONUtils.sys.mjs"); Chrome.importESModule("resource://gre/modules/Timer.sys.mjs"); Chrome.importESModule("resource://gre/modules/PlacesBackups.sys.mjs"); Chrome.importESModule("resource://modules/MigrationUtils.sys.mjs");
Mfg
-
wenn ich diese Teil lösche und Firefox starte und beende, wird Favoriten-Ordner angelegt:
CodeChrome.importESModule("resource://gre/modules/BookmarkJSONUtils.sys.mjs"); Chrome.importESModule("resource://gre/modules/Timer.sys.mjs"); Chrome.importESModule("resource://gre/modules/PlacesBackups.sys.mjs"); Chrome.importESModule("resource:///modules/MigrationUtils.sys.mjs");
Aber wenn diese teil da ist, passiert gar nicht.
-
Moin milupo,
herzlichen Dank. Deine Code Teilweise funktioniert.
Das Teil für Favoriten funktioniert leider nicht (diese Teil):
Code
Alles anzeigentry { //Cu.import("resource://gre/modules/Services.jsm"); //Cu.import("resource://gre/modules/osfile.jsm"); Chrome.importESModule("resource://gre/modules/BookmarkJSONUtils.sys.mjs"); Chrome.importESModule("resource://gre/modules/Timer.sys.mjs"); Chrome.importESModule("resource://gre/modules/PlacesBackups.sys.mjs"); Chrome.importESModule("resource:///modules/MigrationUtils.sys.mjs"); //**** Diesen Teil erstellt in Benutzer U:\ Laufwerk, Firefox_Favoriten_BAK Ordner **** Services.obs.addObserver( { observe: () => IOUtils.makeDirectory("U:\\Firefox_Favoriten_BAK") }, "quit-application-requested", false ); const path = PathUtils.join("U:\\Firefox_Favoriten_BAK\\bookmarks.json"); let importExportBookmarks = { modalWindow: null, init: async function() { Services.obs.addObserver(this, "final-ui-startup", false); }, observe: function(aSubject, aTopic, aData) { switch (aTopic) { case "final-ui-startup": BookmarkJSONUtils.importFromFile(path, {replace: false}) .then( () => this.modalWindow.open(), (e) => { IOUtils.remove(path), this.modalWindow.open(); let window = Services.wm.getMostRecentWindow('navigator:browser'); } ); Services.obs.removeObserver(this, "final-ui-startup"); Services.obs.addObserver(this, "quit-application-requested", false); break; case "quit-application-requested": let window = Services.wm.getMostRecentWindow('navigator:browser'); BookmarkJSONUtils.exportToFile(path, {replace: false}) .then( () => this.modalWindow.close(), (e) => { this.modalWindow.close(); } ); Services.obs.addObserver(this, "domwindowopened", false); window.open('', 'modalWindow', 'chrome,modal'); break; case "domwindowopened": Services.obs.removeObserver(this, "domwindowopened"); this.modalWindow = aSubject; }; } }; importExportBookmarks.init(); } catch(e) { Cu.reportError(e); };
Mfg
-
Hallo Andreas,
vielen Dank, leider hat nicht funktioniert
Ich glaube osfile.jsm ist nicht mehr da und muss man ioutil.jsm benutzen, weil hier steht, dass osfile.jsm von services entfernt wurde.
Remove osfile.jsm from services
Mfg
-
Moin @Sören,
danke, ist so Ok?
Code
Alles anzeigenconst Cu = Components.utils; //**** Diesen Teil erstellt chrome Ordner in Benutzer Firefox Profile und kopiert alle dateien **** try { Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); Services.obs.addObserver( { observe: () => OS.File.makeDir(OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\")) }, "profile-do-change", false ); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\userChrome.css", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\userChrome.css")) }, "profile-do-change", false ); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\userContent.css", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\userContent.css")) }, "profile-do-change", false ); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\userChrome.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\userChrome.js")) }, "profile-do-change", false ); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\printpreview.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\printpreview.uc.js")) }, "profile-do-change", false ); // Java JNLP Start in MIME-Type Components.utils.import("resource://gre/modules/Services.jsm"); Services.obs.addObserver(function observer(subject, topic, data) { var handlerSvc = Components.classes["@mozilla.org/uriloader/handler-service;1"] .getService(Components.interfaces.nsIHandlerService); var mimeService = Components.classes["@mozilla.org/mime;1"] .getService(Components.interfaces.nsIMIMEService); var realMIMEInfo = mimeService.getFromTypeAndExtension("application/x-java-jnlp-file", ""); var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile); file.initWithPath(getenv('itw32_home')+"\\bin\\javaws.exe"); var localHandlerApp = Components.classes["@mozilla.org/uriloader/local-handler-app;1"].createInstance(Components.interfaces.nsILocalHandlerApp); localHandlerApp.executable = file; localHandlerApp.name = "javaws.exe"; realMIMEInfo.preferredApplicationHandler = localHandlerApp; realMIMEInfo.preferredAction = 2; // useHelperApp realMIMEInfo.alwaysAskBeforeHandling = false; handlerSvc.store(realMIMEInfo);Services.obs.removeObserver(observer, topic); }, "final-ui-startup");0 //**** Automatik Benutzer Favoriten Sicherung (als .json format) in User Home==>Documents Ordner und Datei Name ist Firefox-Favoriten.json **** //**** Wenn Firefox beendet, wird Benutzer Firefox-Favoriten.json automatisch in Pfad C:\Users\UserName\Documents\ gespeichert **** try { Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); Cu.import("resource://gre/modules/BookmarkJSONUtils.jsm"); Cu.import("resource://gre/modules/Timer.jsm"); Cu.import("resource://gre/modules/PlacesBackups.jsm"); Cu.import("resource:///modules/MigrationUtils.jsm"); //**** Diesen Teil erstellt in Benutzer U:\ Laufwerk, Firefox_Favoriten_BAK Ordner **** Services.obs.addObserver( { observe: () => OS.File.makeDir("U:\\Firefox_Favoriten_BAK") }, "quit-application-requested", false ); const path = OS.Path.join("U:\\Firefox_Favoriten_BAK\\bookmarks.json"); let importExportBookmarks = { modalWindow: null, init: async function() { Services.obs.addObserver(this, "final-ui-startup", false); }, observe: function(aSubject, aTopic, aData) { switch (aTopic) { case "final-ui-startup": BookmarkJSONUtils.importFromFile(path, {replace: false}) .then( () => this.modalWindow.open(), (e) => { OS.File.remove(path), this.modalWindow.open(); let window = Services.wm.getMostRecentWindow('navigator:browser'); } ); Services.obs.removeObserver(this, "final-ui-startup"); Services.obs.addObserver(this, "quit-application-requested", false); break; case "quit-application-requested": let window = Services.wm.getMostRecentWindow('navigator:browser'); BookmarkJSONUtils.exportToFile(path, {replace: false}) .then( () => this.modalWindow.close(), (e) => { this.modalWindow.close(); } ); Services.obs.addObserver(this, "domwindowopened", false); window.open('', 'modalWindow', 'chrome,modal'); break; case "domwindowopened": Services.obs.removeObserver(this, "domwindowopened"); this.modalWindow = aSubject; }; } }; importExportBookmarks.init(); } catch(e) { Cu.reportError(e); }; //**** Diesen Teil löscht in Benutzer Firefox Profile, Ordner storage\default **** try { Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); Cu.import("resource://gre/modules/BookmarkJSONUtils.jsm"); Cu.import("resource://gre/modules/Timer.jsm"); Services.obs.addObserver( { observe: () => OS.File.removeDir(OS.Path.join(OS.Constants.Path.profileDir + "\\storage\\default")) }, "quit-application", false ); } catch(e) { Cu.reportError(e); };
Mfg
-
Moin Andreas,
ja, habe ich schon Änderung gemacht.
Bei mir geht nicht Copy oder Delete Dateien Funktion und auch Automatik import, Export Favoriten.
Mfg
-
Moin Zusammen,
ich benutze diese Code zum löschen oder kopieren Dateien in Benutzer Profile und auch Automatik Bookmarks Backup und Restore. Leider funktioniert nicht mehr mit Firefox 115.0 ESR aber mit 102.12.0 ESR funktioniert.
Damals hat aborix geholfen.
Bestimmte Ordner in Benutzer Profile löschen
Codetry { Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/osfile.jsm"); Services.obs.addObserver( { observe: () => OS.File.makeDir(OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\userChrome.css", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\userChrome.css")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\userContent.css", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\userContent.css")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\userChrome.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\userChrome.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\printpreview.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\printpreview.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\Schnelleinstellungen.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\Schnelleinstellungen.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\PasteAndGoForms.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\PasteAndGoForms.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.remove(OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\LoadingBar.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\fixsearchEngineIcon.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\fixsearchEngineIcon.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\favicon_in_urlbar.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\favicon_in_urlbar.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\ExtendedCopy.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\ExtendedCopy.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.remove(OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\Einstellungen.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\downloadb.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\downloadb.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\ContextTranslate.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\ContextTranslate.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\bookmarks_backup_restore_button.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\bookmarks_backup_restore_button.uc.js")) }, "profile-do-change", false); Services.obs.addObserver( { observe: () => OS.File.copy("C:\\Program Files (x86)\\Mozilla Firefox\\UserChromeDIR\\bildschirm.uc.js", OS.Path.join(OS.Constants.Path.profileDir + "\\chrome\\bildschirm.uc.js")) }, "profile-do-change", false); } catch(e) { Cu.reportError(e);};//**** Automatik Benutzer Favoriten Sicherung (als .json format) in User Home==>Documents Ordner und Datei Name ist Firefox-Favoriten.json ****//**** Wenn Firefox beendet, wird Benutzer Firefox-Favoriten.json automatisch in Pfad C:\Users\UserName\Documents\ gespeichert ****try { Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); Cu.import("resource://gre/modules/BookmarkJSONUtils.jsm"); Cu.import("resource://gre/modules/Timer.jsm"); Cu.import("resource://gre/modules/PlacesBackups.jsm"); Cu.import("resource:///modules/MigrationUtils.jsm"); //**** 6.2 Diesen Teil erstellt in Benutzer U:\ Laufwerk, Firefox_Favoriten_BAK Ordner **** Services.obs.addObserver( { observe: () => OS.File.makeDir("U:\\Firefox_Favoriten_BAK") }, "quit-application-requested", false); const path = OS.Path.join("U:\\Firefox_Favoriten_BAK\\bookmarks.json"); let importExportBookmarks = { modalWindow: null, init: async function() { Services.obs.addObserver(this, "final-ui-startup", false); }, observe: function(aSubject, aTopic, aData) { switch (aTopic) { case "final-ui-startup": BookmarkJSONUtils.importFromFile(path, {replace: false}) .then( () => this.modalWindow.open(), (e) => { OS.File.remove(path), this.modalWindow.open(); let window = Services.wm.getMostRecentWindow('navigator:browser'); // window.alert("Das Importieren der Lesezeichen ist fehlgeschlagen.\n\n" + e); } ); Services.obs.removeObserver(this, "final-ui-startup"); Services.obs.addObserver(this, "quit-application-requested", false); break; case "quit-application-requested": let window = Services.wm.getMostRecentWindow('navigator:browser'); BookmarkJSONUtils.exportToFile(path, {replace: false}) .then( () => this.modalWindow.close(), (e) => { this.modalWindow.close();// window.alert("Das Exportieren der Lesezeichen ist fehlgeschlagen.\n\n" + e); } ); Services.obs.addObserver(this, "domwindowopened", false); window.open('', 'modalWindow', 'chrome,modal'); break; case "domwindowopened": Services.obs.removeObserver(this, "domwindowopened"); this.modalWindow = aSubject; }; } }; importExportBookmarks.init();} catch(e) { Cu.reportError(e);};//**** Diesen Teil löscht in Benutzer Firefox Profile, Ordner storage\default ****try { Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); Cu.import("resource://gre/modules/BookmarkJSONUtils.jsm"); Cu.import("resource://gre/modules/Timer.jsm"); Services.obs.addObserver( { observe: () => OS.File.removeDir(OS.Path.join(OS.Constants.Path.profileDir + "\\storage\\default")) }, "quit-application", false);} catch(e) { Cu.reportError(e);};
Ich bin dankbar für jede Hilfe.
Mfg
-
Hallo,
versuche es mit getenv('ENV_NAME').
Moin Sören Hentzschel,
perfekt, herzlichen Dank, das hat funktioniert.
Mfg
-
Guten Abend Zusammen,
ich habe eine Frage, kann man Windows umgebungsvariablen in Config.js benutzen?
Zumbeispiel, ich habe eine Variablename Text und in DOS Konsole hat diese Wert und brauche diese Wert/Pfad dass ich in Config.js benutzen kann (diese Wert ändert aber jede 1 Woche):
ECHO %text% ==> C:\Program Files (x86)\Ipswitch
Vielen Dank
Mfg
-
Hallo,
nur eine Frage, hast du schon
network.http.windows-sso.enabled Parameter auf true geändert?
Mehr Info:
Informationen zur Funktion „Windows SSO“
Mfg
-
vielen Dank für Info.
Viele Grüße