FJ Software Foren-Übersicht  
 Homepage   •  Suchen   •  FAQ   •  Mitgliederliste   •  Registrieren   •  Login
 MyPhoneExplorer and Thunderbird under Linux Nächstes Thema anzeigen
Vorheriges Thema anzeigen
Neues Thema eröffnenNeue Antwort erstellen
Autor Nachricht
matthias



Anmeldedatum: 08.11.2008
Beiträge: 107

BeitragVerfasst am: Sa Sep 22, 2018 21:09 Antworten mit ZitatNach oben

Unfortunately, the sync stopped working for me.it always says that the folders cannot be listed and in the logfile appears the following:

Code:
 Error in StartFritzboxSearch: 429 ActiveX component can't create object


Does anybody experience the same and probably know a workaround?

btw: I'm on Manjaro (Arch) with wine 3.15
Benutzer-Profile anzeigenPrivate Nachricht senden
matthias



Anmeldedatum: 08.11.2008
Beiträge: 107

BeitragVerfasst am: Sa Okt 06, 2018 15:53 Antworten mit ZitatNach oben

Does anybody know how to find out what could be the problem?
Benutzer-Profile anzeigenPrivate Nachricht senden
Pastim



Anmeldedatum: 17.06.2011
Beiträge: 66

BeitragVerfasst am: Di Okt 16, 2018 15:45 Antworten mit ZitatNach oben

TreeNode hat Folgendes geschrieben:
It is a it of copy an paste. I hope the instructions are clear, if not ask.

As of Thunderbird 60- these instructions (from Sat May 13, 2017) don't seem to work any more. There isn't even a directory "myphoneexplorer@fjsoft.at " under extensions.

mpe says it now can't see any of the thunderbird folders.
Benutzer-Profile anzeigenPrivate Nachricht senden
Pastim



Anmeldedatum: 17.06.2011
Beiträge: 66

BeitragVerfasst am: Di Okt 16, 2018 21:11 Antworten mit ZitatNach oben

Having found I couldn't get MPE to work with Thunderbird 60 in the way I used to, I have got it working again, on ubuntu 18.04, with MPE 1.8.11. I started with a fresh 32 bit wine directory (Windows 7).

I had been using the really neat method described by TreeNode on May 13 2017. However, I couldn't find a way to get it working with Thunderbird 60, so reverted to the old method. I'll briefly summarise what I needed to do.

0. Backup the whole linux Thunderbird directory - more than once depending on how paranoid you are, and then stop it (so no new changes get made).
1. Install Windows Thunderbird prior to version 60 (I used version 45) under wine
2. Start it, don't create an account.
3. Make sure the lightning extension is installed.
4. Open the Address book (is empty) and Calendar (also empty).
5. Close wine Thunderbird.
6. Fix the calendar access for the wine Thunderbird as follows:
◦ in the wine Thunderbird profile directory "cp prefs.js prefs.js.old" (i.e. take a backup)
◦ in the linux Thunderbird profile directory, use an editor to copy all lines in pref.js starting with "calendar."
◦ in the wine Thunderbird profile directory edit prefs.js and replace all "calendar." lines with the lines just copied
7. In the wine Thunderbird profile directory (where 'xxxxxxxx' is the profile directory id, 'me' is my home directory name, and 'abook-n.mab' is the current linux address book that I want to synchronise - I have several address books but only one to sync with my mobile):
◦ mv storage.sdb storage.sdb.old
◦ mv abook.mab abook.mab.old
◦ ln -is /home/me/.thunderbird/xxxxxxxx.default/storage.sdb storage.sdb
◦ ln -s /home/me/.thunderbird/xxxxxxxx.default/abook-n.mab abook.mab
8. Then in the calendar-data directory
◦ mv local.sqlite local.sqlite.old
◦ ln -is /home/me/.thunderbird/xxxxxxxx.default/calendar-data/local.sqlite local.sqlite
9. You have now got the wine Thunderbird to use the address book and calendar files created by the linux Thunderbird
10. Install MPE in the normal linux way, which I won't repeat.
11. Start MPE and get as far as getting it to install the MPE Thunderbird extension (to the wine Thunderbird).
12. Stop MPE for now.
13. Start the wine Thunderbird, and make sure the address book shows my linux addresses. Ditto the calendar. I had to stop and restart a few times, I'm not sure why, but eventually the wine Thunderbird was showing the addresses I want and the calendar I want.
14. Stop the wine Thunderbird.
15. Start MPE and finish setting up, making sure that it is set to ask first before making any changes to either the phone or Thunderbird data.
16. Pray.
17. Try a contact sync. If OK try calendar sync, and so on.

Treat yourself to something nice..., and say thanks to all at fjsoft for keeping this incredibly useful tool going. It's so long ago I can't now recall if I donated, but I may have to do it again just to be sure Smile
Benutzer-Profile anzeigenPrivate Nachricht senden
Pastim



Anmeldedatum: 17.06.2011
Beiträge: 66

BeitragVerfasst am: Di Okt 16, 2018 21:20 Antworten mit ZitatNach oben

And one more thing for linux Thunderbird 60 users - you need to install xul-ext-lightning to get lightning in linux Thunderbird - the old add-on extension doesn't work.
Benutzer-Profile anzeigenPrivate Nachricht senden
TreeNode



Anmeldedatum: 12.05.2017
Beiträge: 8

BeitragVerfasst am: Do Okt 25, 2018 11:34 Antworten mit ZitatNach oben

Hallo, I‘ve got it working again. This time is it a bit more difficult, because we have to modify the xpi file. Beside that it is simula to the last one. In order to make it simpler I wrote as script, that sets the link, regEntry, the bat File and creates the extensions.rdf file if they don’t exist.

0. install MyPhoneExplorer und Lightning in Thunderbird(xul-ext-lightning)
1. open the MyPhonEexplorer xpi File an copy the mpe.js file (I used xarchiver)
2. open the mpe.js and replace the RegRead and Run function with:
Code:

function RegRead(subkey,valuename)
{
var out = '';
var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()){
// um die Konstanten zu genierieren
Components.classes["@mozilla.org/net/osfileconstantsservice;1"].getService(Components.interfaces.nsIOSFileConstantsService).init();
// erzeuge ein tmp file mit dem inhalt #!/bin/bash \n\$1 \> \$2 um die rückgabe der bash in eine Datei zu schreiben
var copyFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
copyFile.append("copy.sh");
copyFile.createUnique(copyFile.nsIFile.NORMAL_FILE_TYPE, 0o700);
WriteFile(copyFile.path,"#!/bin/bash \n\$1 \> \$2");
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(copyFile);
var tmpFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
tmpFile.append("Query.tmp");
tmpFile.createUnique(tmpFile.NORMAL_FILE_TYPE, 0o600);
var args = ["wine reg Query HKCU\\"+subkey +" /v "+valuename, tmpFile.path];
process.run(true, args, args.length);
try {
var out = ReadFile(tmpFile.path);
out=out[2];
out=out.split("REG_SZ ");
out=out[1];
tmpFile.remove(false);
copyFile.remove(false);
//prüft ob es ein Systempfad ist(zweite Stelle ":")
if(out.indexOf(":")==1){
out= 'dosdevices/'+out.substr(0,1).toLowerCase()+out.substr(1,out.length-1);
out = out.split('\\').join('/');//ersetzt alle \\ durch /
out=OS.Constants.Path.homeDir+'/.wine/'+out;
}
}
catch(ex) {
Components.utils.reportError('Error reading HKCU\\' + subkey + ' : ' + valuename + ' : ' + ex);
}
}
else{
try {
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_CURRENT_USER,subkey,wrk.ACCESS_READ);
out = wrk.readStringValue(valuename);
wrk.close();
}
catch(ex) {
// Components.utils.reportError('Error reading HKCU\\' + subkey + ' : ' + valuename + ' : ' + ex);
}
}
//Components.utils.reportError(out);
return(out);
}


 
Run: function(args)
{
//var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);

args=[args];
var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS
var path = RegRead("Software\\MyPhoneExplorer", "PathToExe");
if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()){
args=[path,args[0]];
path= "/usr/bin/wine";
}
if (path.length != 0) {
try
{
//file.initWithPath(path);
var file = new FileUtils.File(path);
process.init(file);
process.run(false, args, args.length);
return;
}
catch(ex)
{
Components.utils.reportError('Could not run ' + path);
return;
}
}
Components.utils.reportError("Could not find MyPhoneExplorer.exe");
},



3. put the modified file back into the xpi (also with xarchiver)
4. install the MyPhoneExplorer-Addon in thunderbird
5. make sure all links and regEntrys and Files are in place or run the script(store it as an executable file)
Code:

#!/bin/bash
#prüfe ob wine installiert
if [ -f /usr/bin/wine ]; then
   #erzeuge RegEintrag und bat-Datei für Thunderbird
   batfilePath="$HOME/.wine/drive_c/Program Files/Mozilla Thunderbird"
   key="HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\thunderbird.exe"
   data="C:\\Program Files\\Mozilla Thunderbird\\thunderbird.bat"
   wine reg add "$key" /v "" /t REG_SZ /d "$data"
   #erzeuge .bat
   if [ ! -d "$batfilePath" ]; then
      mkdir "$batfilePath"
   fi
   echo "start /unix /usr/bin/thunderbird %1 %2" > "$batfilePath/thunderbird.bat"
   chmod 777 "$batfilePath/thunderbird.bat"

   # erzeuge softlink
   target="$HOME/.thunderbird"
   #aus REG auslesen
   key="HKEY_USERS\.Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
   data="AppData"
   position=`wine reg query "$key" /v "$data"`
   index=`expr index "$position"  ':'`
   position="${position:($index-2):(${#position}-$index-1)}"
   if [ "$position" != "" ]; then
      position="${position,}"
      #resetze \ durch /
      position="${position//\\/\/}"

      position="$HOME/.wine/dosdevices/$position/Thunderbird"

      #prüfen ob datei schon existiert
      if [ ! -e "$position" ]; then
         ln -s "$target" "$position"
      fi
   fi
   unset batfilePath
   unset key
   unset data
   unset target
   unset position
   unset index

   #erzeuge extension.rdf

   if [[ $(grep '\[Profile[^0]\]' "$HOME/.thunderbird/profiles.ini") ]]
    then echo multi user funktioniert noch nicht, schreibe in thunderbird ordner
   else target=$(grep 'Path=' "$HOME/.thunderbird/profiles.ini" | sed 's/^Path=//' | sed 's/\r//' | sed 's/\n//')
   fi
   target="$HOME/.thunderbird/$target/extensions.rdf"
   if [ ! -e "$target" ]; then
     echo "<?xml version=\"1.0\"?>" > "$target"
     echo "<RDF:RDF xmlns:NS1=\"http://www.mozilla.org/2004/em-rdf#\"" >> "$target"
     echo "         xmlns:NC=\"http://home.netscape.com/NC-rdf#\"" >> "$target"
     echo "         xmlns:RDF=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">" >> "$target"
     echo "  <RDF:Seq RDF:about=\"urn:mozilla:item:root\">" >> "$target"
     echo "    <RDF:li RDF:resource=\"urn:mozilla:item:{e2fda1a4-762b-4020-b5ad-a41df1933103}\"/>" >> "$target"
     echo "    <RDF:li RDF:resource=\"urn:mozilla:item:myphoneexplorer@fjsoft.at\"/>" >> "$target"
     echo "  </RDF:Seq>" >> "$target"
     echo "  <RDF:Description RDF:about=\"urn:mozilla:item:{e2fda1a4-762b-4020-b5ad-a41df1933103}\"" >> "$target"
     echo "                   NS1:installLocation=\"app-profile\"" >> "$target"
     echo "                   NS1:version=\"6.2.2.1\"" >> "$target"
     echo "                   NS1:optionsURL=\"chrome://messenger/content/preferences/preferences.xul\"" >> "$target"
     echo "                   NS1:iconURL=\"chrome://calendar/skin/cal-icon32.png\"" >> "$target"
     echo "                   NS1:name=\"Lightning\"" >> "$target"
     echo "                   NS1:description=\"An integrated calendar for Thunderbird\"" >> "$target"
     echo "                   NS1:creator=\"Mozilla Calendar Project\"" >> "$target"
     echo "                   NS1:homepageURL=\"http://www.mozilla.org/projects/calendar/\">" >> "$target"
     echo "    <NS1:type NC:parseType=\"Integer\">2</NS1:type>" >> "$target"
     echo "    <NS1:targetApplication RDF:resource=\"rdf:#$GqnK52\"/>" >> "$target"
     echo "  </RDF:Description>" >> "$target"
     echo "  <RDF:Description RDF:about=\"urn:mozilla:item:myphoneexplorer@fjsoft.at\"" >> "$target"
     echo "                   NS1:installLocation=\"app-profile\"" >> "$target"
     echo "                   NS1:version=\"2.0.23\"" >> "$target"
     echo "                   NS1:name=\"MyPhoneExplorer\"" >> "$target"
     echo "                   NS1:description=\"MyPhoneExplorer Synchronisation\"" >> "$target"
     echo "                   NS1:creator=\"F.J. Wechselberger, N. Pueschel\"" >> "$target"
     echo "                   NS1:homepageURL=\"http://www.fjsoft.at/\">" >> "$target"
     echo "    <NS1:type NC:parseType=\"Integer\">2</NS1:type>" >> "$target"
     echo "    <NS1:targetApplication RDF:resource=\"rdf:#$GqnK52\"/>" >> "$target"
     echo "  </RDF:Description>" >> "$target"
     echo "</RDF:RDF>" >> "$target"

   else
     echo "existiert schon"
   fi
   unset target

fi


if the file extensions.rdf file already exists make sure that the versionnummers inside match the installed add-on-versions

6. ready to use


This time I used the reg function of wine. I think this is more elegant and I added a check for OS so the add-on shut still work an a windows.
@FJ Maybe this changes could find the way in the standard version, to make the wine support easier.
Benutzer-Profile anzeigenPrivate Nachricht senden
Pastim



Anmeldedatum: 17.06.2011
Beiträge: 66

BeitragVerfasst am: Do Okt 25, 2018 12:23 Antworten mit ZitatNach oben

Thanks. I'll have a think about trying this. My MPE is currently working well with the 2nd copy of Thunderbird, so I may leave it until I need to change something else. I've copied the instructions locally so I can find them if/when I need them.
Benutzer-Profile anzeigenPrivate Nachricht senden
matthias



Anmeldedatum: 08.11.2008
Beiträge: 107

BeitragVerfasst am: So Nov 11, 2018 12:30 Antworten mit ZitatNach oben

Thank you very much, @TreeNode!

In my case I installed MPE using a wineprefix (.wine_MPE) therefore I had to modify your functions.
Also I noticed that, when reading out the "PathToExe" value from the registry, it was returned with leading spaces, which made it necessary to add the trim()-function
@FJ it would be great if this could make it into the standard version! Maybe with a way to configure the wineprefix if someone installed it to a different location as I did...

Here are my versions of these functions:
there are two occurrences of "/path/to/wineprefix/" that you need to change to your prefix.

Code:

function RegRead(subkey,valuename)
{
   var out = '';
   var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;
   if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()){
      // um die Konstanten zu genierieren
      Components.classes["@mozilla.org/net/osfileconstantsservice;1"].getService(Components.interfaces.nsIOSFileConstantsService).init();
      // erzeuge ein tmp file mit dem inhalt #!/bin/bash \n\$1 \> \$2 um die rückgabe der bash in eine Datei zu schreiben
      var copyFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
      copyFile.append("copy.sh");
      copyFile.createUnique(copyFile.nsIFile.NORMAL_FILE_TYPE, 0o700);
      WriteFile(copyFile.path,"#!/bin/bash \n\$1 \> \$2");
      var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
      process.init(copyFile);
      var tmpFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
      tmpFile.append("Query.tmp");
      tmpFile.createUnique(tmpFile.NORMAL_FILE_TYPE, 0o600);

      //modification: use the env function to pass the wineprefix to wine
      var args = ["/usr/bin/env WINEPREFIX=/path/to/wineprefix/ wine reg Query HKCU\\"+subkey +" /v "+valuename, tmpFile.path];
      process.run(true, args, args.length);
      try {

         var out = ReadFile(tmpFile.path);
         out=out[2];
         out=out.split("REG_SZ ");
         out=out[1];
         //modification: trim the output to get rid of extra spaces
         out = out.trim();
         
         tmpFile.remove(false);
         copyFile.remove(false);
         //prüft ob es ein Systempfad ist(zweite Stelle ":")
         if(out.indexOf(":")==1){
            out= 'dosdevices/'+out.substr(0,1).toLowerCase()+out.substr(1,out.length-1);
            out = out.split('\\').join('/');//ersetzt alle \\ durch /
            out=OS.Constants.Path.homeDir+'/.wine_MPE/'+out;
         }
      }
      catch(ex) {
         Components.utils.reportError('Error reading HKCU\\' + subkey + ' : ' + valuename + ' : ' + ex);
      }
   }
   else{
      try {
         var wrk = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
         wrk.open(wrk.ROOT_KEY_CURRENT_USER,subkey,wrk.ACCESS_READ);
         out = wrk.readStringValue(valuename);
         wrk.close();
      }
      catch(ex) {
         // Components.utils.reportError('Error reading HKCU\\' + subkey + ' : ' + valuename + ' : ' + ex);
      }
   }
   //Components.utils.reportError(out);
   return(out);
}



Run: function(args)
{
   //var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
   var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
   
   args=[args];
   var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS
   var path = RegRead("Software\\MyPhoneExplorer", "PathToExe");
   if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()) {
      //modification: again use the env function to pass the wineprefix to wine
      args=["WINEPREFIX=/path/to/wineprefix/ /usr/bin/wine", path, args[0]];
      path= "/usr/bin/env";
   }
   if (path.length != 0) {
      try {
         //file.initWithPath(path);
         var file = new FileUtils.File(path);
         process.init(file);
         process.run(false, args, args.length);
         return;
      }
      catch(ex) {
         Components.utils.reportError('Could not run ' + path);
         return;
      }
   }
   Components.utils.reportError("Could not find MyPhoneExplorer.exe");
},
Benutzer-Profile anzeigenPrivate Nachricht senden
TreeNode



Anmeldedatum: 12.05.2017
Beiträge: 8

BeitragVerfasst am: Mi Nov 14, 2018 14:38 Antworten mit ZitatNach oben

Hallo matthias,
I think I‘ve got a solution for this problem.
Therefore I read the preferences of thunderbird.
If you’re using a WINEPREFIX go to thunderbird and open the Config Editor(To access the config editor, go to Edit > Preferences, select the Advanced panel, select the General tab, and click Config Editor.)
With a right-click, add a new String. The Name is ”myphoneexplorer.path_to_wine” and the value is the path to your wine-installation.
I think this should work.

Here the new version of the adjusted functions:
Code:
function RegRead(subkey,valuename)
{
   var out = '';

   var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;

   if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()){
      // um die Konstanten zu genierieren
      Components.classes["@mozilla.org/net/osfileconstantsservice;1"].getService(Components.interfaces.nsIOSFileConstantsService).init();
      //Ließt die Einstellung aus, falls wine an einem anderen Ort liegt, sollte man es dort in thunderbird eintragen
      var defaultWinePath =  OS.Constants.Path.homeDir+'/.wine';
      var   PathToWine = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch).getCharPref("myphoneexplorer.path_to_wine",defaultWinePath);

      // erzeuge ein tmp file mit dem inhalt #!/bin/bash \n\$1 \> \$2 um die rückgabe der bash in eine Datei zu schreiben
      var copyFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
      copyFile.append("copy.sh");
      copyFile.createUnique(copyFile.nsIFile.NORMAL_FILE_TYPE, 0o700);
      WriteFile(copyFile.path,"#!/bin/bash \n\$1 \> \$2");

      var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
      process.init(copyFile);
      var tmpFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
      tmpFile.append("Query.tmp");
      tmpFile.createUnique(tmpFile.NORMAL_FILE_TYPE, 0o600);
      //wegen Performanceeinbußen
      if(PathToWine==defaultWinePath){
         var args = ["wine reg Query HKCU\\"+subkey +" /v "+valuename, tmpFile.path];
      }else {
         var args = ["/usr/bin/env WINEPREFIX="+PathToWine+" wine reg Query HKCU\\"+subkey +" /v "+valuename, tmpFile.path];
      }
      process.run(true, args, args.length);
      try {
         out = ReadFile(tmpFile.path);
         out=out[2];
         out=out.split("REG_SZ    ");
         out=out[1];
         out=out.trim();
         //prüft ob es ein Systempfad ist(zweite Stelle ":")
         if(out.indexOf(":")==1){
            out=out.split('\ ').join('%'); //um mit Leerzeichen umzugehen
            if(PathToWine==defaultWinePath){
               args = ["winepath "+out, tmpFile.path];
            }else {
               args = ["/usr/bin/env WINEPREFIX="+PathToWine+" winepath "+out, tmpFile.path];
            }
            process.run(true, args, args.length);
            out=ReadFile(tmpFile.path);
            out=out[0].split('%').join(' ');
         }
         tmpFile.remove(false);
         copyFile.remove(false);
      }
      catch(ex) {
          Components.utils.reportError('Error reading HKCU\\' + subkey + ' : ' + valuename + ' : ' + ex);
      }
   }
   else{
      try {
         var wrk = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
         wrk.open(wrk.ROOT_KEY_CURRENT_USER,subkey,wrk.ACCESS_READ);
         out = wrk.readStringValue(valuename);
         wrk.close();
      }
      catch(ex) {
      //    Components.utils.reportError('Error reading HKCU\\' + subkey + ' : ' + valuename + ' : ' + ex);
      }
   }
   //Components.utils.reportError(out);
   return(out);
}

Run: function(args)
{
   //var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
   var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);


   args=[args];
   var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS
   var path = RegRead("Software\\MyPhoneExplorer", "PathToExe");
   if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()){

      var defaultWinePath =  OS.Constants.Path.homeDir+'/.wine';
      var   PathToWine = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch).getCharPref("myphoneexplorer.path_to_wine",defaultWinePath);
      //wegen Performanceeinbußen
      if(PathToWine==defaultWinePath){
         args=[path,args[0]];
         path= "/usr/bin/wine";
      }else {
         args=["WINEPREFIX="+PathToWINE+" /usr/bin/wine",path,args[0]];
         path= "/usr/bin/env";
      }

   }
   if (path.length != 0) {
      try
      {
         //file.initWithPath(path);
         var file = new FileUtils.File(path);
         process.init(file);
         process.run(false, args, args.length);
         return;
      }
      catch(ex)
      {
         Components.utils.reportError('Could not run ' + path);
         return;
      }
   }
   Components.utils.reportError("Could not find MyPhoneExplorer.exe");
},
Benutzer-Profile anzeigenPrivate Nachricht senden
Pastim



Anmeldedatum: 17.06.2011
Beiträge: 66

BeitragVerfasst am: Do Mai 09, 2019 21:26 Antworten mit ZitatNach oben

I recently had problems using the method of installing a windows version of thunderbird (I could not see my Home calendar). So I thought I should try the version linking direct to the linux thunderbird.

I cannot get Thunderbird to show in the MPE sync set-up. Is there any way to diagnose what I have done wrong? I have run the latest modified script.

I have to admit I'm still confused as to why I have to set up some entries in .wine when I am using a different wine prefix, so I may have done something wrong.

You might wonder why I use a separate prefix. I have had so many problems with wine applications that I find it much simpler to have a prefix for each application. That way I can wipe out one application without removing others as well.
Benutzer-Profile anzeigenPrivate Nachricht senden
Pastim



Anmeldedatum: 17.06.2011
Beiträge: 66

BeitragVerfasst am: Fr Mai 10, 2019 15:23 Antworten mit ZitatNach oben

Pastim hat Folgendes geschrieben:
I recently had problems using the method of installing a windows version of thunderbird (I could not see my Home calendar). So I thought I should try the version linking direct to the linux thunderbird.

I cannot get Thunderbird to show in the MPE sync set-up. Is there any way to diagnose what I have done wrong? I have run the latest modified script.

I have to admit I'm still confused as to why I have to set up some entries in .wine when I am using a different wine prefix, so I may have done something wrong.

You might wonder why I use a separate prefix. I have had so many problems with wine applications that I find it much simpler to have a prefix for each application. That way I can wipe out one application without removing others as well.

I have now sorted this out, but I got quite confused for many, many, hours.

Several things caused me to set things up incorrectly. First, the installation script is for running under .wine. Working out which bits needed changing to use my prefix, and which did not, took me a while. By trial and error I eventually discovered that the only thing that must be under .wine is the link to the Thunderbird profile (under Application Data/Thunderbird). All other changes can be under my own prefix. Why that one item must be under .wine I have no idea. Does anyone know?

I also think I used the wrong path in the thunderbird configuration editor. I started with it as ~/winmpe, but eventually used the full /home... syntax.

And then I didn't make the changes to mpe.js quite correctly. Stupid of me.

Anyway, it all works now, and only the one link has to be recreated if and when my .wine gets reset.

Thanks to all.
Benutzer-Profile anzeigenPrivate Nachricht senden
Pastim



Anmeldedatum: 17.06.2011
Beiträge: 66

BeitragVerfasst am: So Jun 09, 2019 10:50 Antworten mit ZitatNach oben

It's now failed again, getting 'Loading entries from Thunderbird failed'. Is this affecting anyone else? Thunderbird is on version 60.7, MPE add-on 2.0.24.

I was hoping it's a new mpe.js which just needs re-editting, but I've done that and it still fails.

Edit: I had almost given up, but rebooted the PC, and then it worked. Something must have kept running using the old mpe.js somehow. Anyway, all is now well, and I have turned off auto-update on the MPE extension. Very Happy
Benutzer-Profile anzeigenPrivate Nachricht senden
Pastim



Anmeldedatum: 17.06.2011
Beiträge: 66

BeitragVerfasst am: Fr Nov 01, 2019 09:24 Antworten mit ZitatNach oben

This method has stopped working after an upgrade. I have updated ubuntu to 19.10 (from 19.04). I have tried clearing out mpe from wine and starting again, to no avail. I have checked that my mpe.js extension is still correct.
The problem now is that although mpe does start (or set the focus on) thunderbird correctly (so the thunderbird.bat file is working correctly) but mpe can't see the thunderbird profile. If I look at the mpe settings, and select thunderbird to sync, it waits and then reports 'Folder structure from Thunderbird could not be listed'.

The mpe log is as below. There is an activex error, but I'm not sure that's the issue. When I tried doing a sync before looking at the settings, I got "ErrMsg: Loading entries from Thunderbird failed!" before the ActiveX error message.

Can anyone helo?

Code:

Logdatei MyPhoneExplorer
************************
Programmversion: 1.8.12
Datum:   01/11/2019

08:16:10.35       Windows Version=6.1
08:16:10.35       Setting Port: 999
08:16:10.35       Setting Baud: 115200
08:16:10.35       Avaiable Ports: COM0=;
08:16:10.38       Main Load frmSplash
08:16:10.43       Load frmSplash...
08:16:10.44       Show splash...
08:16:10.44       frmSplash geladen
08:16:11.62       Hauptfenster wird geladen
08:16:11.81       Sidebar fertig geladen
08:16:11.98       UC SMS wird geladen
08:16:12.07       UC Phonebook wird geladen
08:16:12.13       UC Phonebook fertig geladen
08:16:12.13       UC Calls wird geladen
08:16:12.21       UC Organizer wird geladen
08:16:12.34       Organizer initiated
08:16:12.35       Startpage=1
08:16:12.36       UC Filebrowser wird geladen
08:16:12.51       UC Filebrowser fertig geladen
08:16:12.51       UC AppBrowser wird geladen
08:16:12.53       UC Notes wird geladen
08:16:12.56       UC Calls wird geladen
08:16:12.67       Setting Lastuser: motorola XT1039 [359290052199365]
08:16:12.69       PasswordCheck OK, check Userfolder, G_AppData=C:\users\crusty\Application Data\MyPhoneExplorer
08:16:12.69       CheckUserDirectory for: motorola XT1039 [359290052199365]
08:16:12.69       Userfolder=C:\users\crusty\Application Data\MyPhoneExplorer\motorola XT1039 [359290052199365]
08:16:12.69       ParseModell
08:16:12.70       Lade Userdatenbank: motorola XT1039 [359290052199365]
08:16:12.86       LoadGridLayout Error: 9
08:16:12.88       LoadDatafile: pb_metadata.xml(4347 Bytes)
08:16:12.91       LoadDatafile: Phonebook.dat(65131 Bytes)
08:16:13.24       Kontakte geladen
08:16:13.25       LoadDatafile: Calls.dat(1479 Bytes)
08:16:13.25       ParseDialedCalls needed 3ms
08:16:13.41       Anrufe geladen
08:16:13.41       Organizer LoadUser DefaultTimeColWidth=141
08:16:13.47       LoadDatafile: Organizer.dat(7854 Bytes)
08:16:13.48       LoadDatafile: cal_metadata.xml(725 Bytes)
08:16:13.51       Organizer geladen
08:16:13.52       LoadDatafile: Notes.dat(301 Bytes)
08:16:13.52       LoadDatafile: notes_metadata.xml(114 Bytes)
08:16:13.53       Notizen geladen
08:16:13.53       Load SMS Data...
08:16:13.53       LoadDatafile: SMS.dat(3515 Bytes)
08:16:13.53       SMS - Datenbank wird geladen...
08:16:13.53       SMS Laden  - Readfile: 2 Split: 0 Parse: 3 HandleMultiSMS: 1 Nachrichten: 16
08:16:13.56       RefreshList (Archive): Addrows=0 Sort=0 MenuUpdate=0 Redraw=0
08:16:13.58       SMS Data Loaded...
08:16:13.58       SMS geladen
08:16:13.83       Version check...
08:16:13.85       Hauptfenster fertig geladen
08:16:16.22       Refresh ComDescriptions...
08:16:16.38       Error in StartFritzboxSearch: 429 ActiveX component can't create object
08:16:21.47       fSyncContactSettings_Activate
08:16:31.67       ErrMsg: Folder structure from Thunderbird could not be listed!
08:16:42.33       Refresh ComDescriptions...
08:16:42.46       Error in StartFritzboxSearch: 429 ActiveX component can't create object
08:16:43.70       Device driver info:
Benutzer-Profile anzeigenPrivate Nachricht senden
Pastim



Anmeldedatum: 17.06.2011
Beiträge: 66

BeitragVerfasst am: Mo Nov 04, 2019 18:28 Antworten mit ZitatNach oben

Pastim hat Folgendes geschrieben:
This method has stopped working after an upgrade. I have updated ubuntu to 19.10 (from 19.04). I have tried clearing out mpe from wine and starting again, to no avail. I have checked that my mpe.js extension is still correct.
The problem now is that although mpe does start (or set the focus on) thunderbird correctly (so the thunderbird.bat file is working correctly) but mpe can't see the thunderbird profile. If I look at the mpe settings, and select thunderbird to sync, it waits and then reports 'Folder structure from Thunderbird could not be listed'.
....

I tried many things to get this to work. I re-did the mpe.js changes on a new version (2.0.25) of the mpe extension, but t-bird 68 was very reluctant to allow the extension to be installed at all. It did allow it eventually. But mpe still couldn't access the contacts or calendar. I eventually fell back on the old method of installing t-bird under wine and linking a few files to the linux t-bird. But even that initially had the same problem. After trying all sorts of things it suddenly worked! Then a bit later it didn't. I discovered that if the linux t-bird is running, mpe and the t-bird under wine cannot access the contacts or calendar. By stopping the linux t-bird it almost worked OK. I had to make one other change, which was to create a link from the wine t-bird profile folder to the whole calendar-data folder, rather than to the local.sqlite file within that folder.

So I now have:
- ubuntu 19.10
- linux t-bird 68.1.2

A wine 64 bit prefix containing:
- mpe 1.8.12
- 64 bit t-bird 68.2.1
- mpe extension 2.0.25 (I installed t-bird 60 first, so as to install the extension, then upgraded to 68 )

Links from the wine t-bird profile to the linux profile:
abook.mab linked to the abookn.mab that contains the contacts I want on my mobile
calendar-data folder
storage.sdb
Benutzer-Profile anzeigenPrivate Nachricht senden
TreeNode



Anmeldedatum: 12.05.2017
Beiträge: 8

BeitragVerfasst am: Di Nov 05, 2019 12:25 Antworten mit ZitatNach oben

Hallo finally I managed to write a little python-script to automate the process.
It should create the Registry-Entry if not existing.
It should create the Folder and the .bak file.
Most imported it should modify the installed Add-on.
After running the script, you should restart Thunderbird twice.

If you have an individual WinePrefix you have to modify the variable in line 12.
Note that python is a space sensitive language.


I tested my script on TB 68. Once the Addon is installed in TB 68 it works (only the version 2.0.25 is compatible. I took the .xpi form an other installation). Sometimes I get the Error in MPE: “Loading entries from Thunderbird failed!” if TB is not open(TB-Error: “calendar-startup-done observer registered”). Maybe it’s because I am testing in an fresh VM.

Code:

#! /bin/python3
import os
import subprocess
import zipfile
import tempfile
import configparser
import json
HOME=os.environ['HOME']


##Change WinePrefix if needed
WinePrefix=os.path.join(HOME,'.wine')




ThunderbirdPATH=os.path.join(HOME,'.thunderbird')
ThunderbirdExec_REG_KEY='HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\thunderbird.exe'
ThunderbirdExec_REG_DATA='C:\\Program Files\\Mozilla Thunderbird\\thunderbird.bat'
ThunderbirdExecPATH=os.path.join(WinePrefix,'drive_c','Program Files','Mozilla Thunderbird')
ThunderbirdData_REG_KEY='HKEY_USERS\\.Default\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders'
ThunderbirdData_RED_DATA='AppData'
###############
#changes in mpe.js

RegRead="""RegRead(subkey,valuename)
{
    var out = '';
    """+'var WINEPREFIX = "export WINEPREFIX='+WinePrefix+'";\n'+"""
    var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS;

    if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()){
        // erzeuge ein tmp file mit dem inhalt #!/bin/bash \\n\$1 \> \$2 um das Feedback der bash in eine Datei zu schreiben
        var copyFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
        copyFile.append("copy.sh");
        copyFile.createUnique(copyFile.nsIFile.NORMAL_FILE_TYPE, 0o700);
        WriteFile(copyFile.path,"#!/bin/bash \\n"+WINEPREFIX+"\\n\$@ \> \$0");

        var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
        process.init(copyFile);
        var args = ["wine","reg","Query","HKCU\\\\"+subkey +" /v "+valuename]
        process.run(true, args, args.length);
        try {
            out = ReadFile(copyFile.path);
            out=out[2];
            out=out.split("REG_SZ");
            out=out[1];
            out=out.trim();
            //prÃ\u0152ft ob es ein Systempfad ist(zweite Stelle ":")
            if(out.indexOf(":")==1){
                WriteFile(copyFile.path,"#!/bin/bash \\n"+WINEPREFIX+"\\n \$1 \\"\$2\\" \> \$0");
                args =["winepath",out]
                process.run(true, args, args.length);
                out=ReadFile(copyFile.path);
            }
            copyFile.remove(false);
        }
        catch(ex) {
             Components.utils.reportError('Error reading HKCU\\\\' + subkey + ' : ' + valuename + ' : ' + ex);
        }
    }
    else{
        try {
            var wrk = Components.classes["@mozilla.org/windows-registry-key;1"].createInstance(Components.interfaces.nsIWindowsRegKey);
            wrk.open(wrk.ROOT_KEY_CURRENT_USER,subkey,wrk.ACCESS_READ);
            out = wrk.readStringValue(valuename);
            wrk.close();
        }
        catch(ex) {
             Components.utils.reportError('Error reading HKCU\\\\' + subkey + ' : ' + valuename + ' : ' + ex);
        }
    }
    return(out);
}

// UUID-Generator inspired by http://www.scriptsearch.com/cgi-bin/jump.cgi?ID=3530

"""


Run=""" function(args)
{
    """+'var WINEPREFIX = "WINEPREFIX='+WinePrefix+'";\n'+"""
    //var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
    var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);


    args=[args];
    var os = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULRuntime).OS
    var path = RegRead("Software\\\\MyPhoneExplorer", "PathToExe");
    if (os=="Linux"||IO.getFile("/usr/bin","wine").exists()){
        args=[WINEPREFIX,"/usr/bin/wine",path,args[0]];
        path="/bin/bash";

    }
    if (path.length != 0) {
        try
        {
            //file.initWithPath(path);
            var file = new FileUtils.File(path);
            process.init(file);
            process.run(false, args, args.length);
            return;
        }
        catch(ex)
        {
            Components.utils.reportError('Could not run ' + path);
            return;
        }
    }
    Components.utils.reportError("Could not find MyPhoneExplorer.exe");
},

"""
#################################################




def linkAndCreateWineToLinuxThunderbird():
    env=os.environ.copy()
    env["WINEPREFIX"]=WinePrefix
   
    cmd=['wine','reg','query',ThunderbirdExec_REG_KEY]
    process =subprocess.Popen(cmd,env=env,stdout=subprocess.PIPE)
    process.communicate()
    returncode = process.returncode
    if returncode == 0:
        return
    cmd=['wine','reg','add',ThunderbirdExec_REG_KEY,'/v','','/t','REG_SZ','/d',ThunderbirdExec_REG_DATA]
    subprocess.Popen(cmd,env=env,stdout=subprocess.PIPE).communicate()
    os.makedirs(ThunderbirdExecPATH,exist_ok=True)
    with open(os.path.join(ThunderbirdExecPATH,'thunderbird.bat'),'w') as file:
        file.write('start /unix /usr/bin/thunderbird %1 %2')
    os.chmod(os.path.join(ThunderbirdExecPATH,'thunderbird.bat'), 777)
    cmd=['wine','reg','query',ThunderbirdData_REG_KEY,'/v',ThunderbirdData_RED_DATA]
    out,err=subprocess.Popen(cmd,env=env,stdout=subprocess.PIPE).communicate()
    result=out.decode().rstrip().split("REG_SZ")[1]
    thunderbirdwpath=result.lstrip().rstrip()
   
    cmd=['winepath',thunderbirdwpath]
    out,err=subprocess.Popen(cmd,env=env,stdout=subprocess.PIPE).communicate()
    ThunderbirdDataPATH=os.path.join(out.decode().rstrip().lstrip(),'Thunderbird')
    #Softlink
    if os.path.exists(ThunderbirdDataPATH):
        return
    cmd=['ln','-s',ThunderbirdPATH,ThunderbirdDataPATH]
    subprocess.Popen(cmd,stdout=subprocess.PIPE).communicate()

   
def modifyMPEAddOnForThunderbird(path):
    xpiPath=os.path.join(path,'extensions','myphoneexplorer@fjsoft.at.xpi')
    addonFile='components/mpe.js'
    tmpfd, tmpname = tempfile.mkstemp(dir=os.path.dirname(xpiPath))
    os.close(tmpfd)
    with zipfile.ZipFile(xpiPath) as mpe_xpi:
        with mpe_xpi.open(addonFile) as mpe_js:
            cache=mpe_js.read()
   
    #modify mpe.js
    sourcecode=cache.decode('iso-8859-1')
    runsplit=sourcecode.split('Run:')
    ssplit=runsplit[1].split('SendMessage:')
    runsplit[1]='SendMessage:'.join([Run,ssplit[1]])
    sourcecode="Run: ".join(runsplit)
   
    fsplit=sourcecode.split('function ')
    fsplit[4]=RegRead   
    sourcecode='function '.join(fsplit)
   
   
    #save in xpi
    with zipfile.ZipFile(xpiPath,'r') as zipin:
        with zipfile.ZipFile(tmpname,'w') as zipout:
            zipout.comment=zipout.comment
            for elem in zipin.infolist():
                if elem.filename != addonFile:
                    zipout.writestr(elem,zipin.read(elem.filename))

    os.remove(xpiPath)
    os.rename(tmpname,xpiPath)
    with zipfile.ZipFile(xpiPath,mode='a',compression=zipfile.ZIP_DEFLATED) as mpe_xpi:
        with mpe_xpi.open(addonFile,mode='w') as mpe_js:
            mpe_js.write(sourcecode.encode())

def createRDF(path):
    head="""<?xml version="1.0"?>
<RDF:RDF xmlns:NS1="http://www.mozilla.org/2004/em-rdf#"
         xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    """
    body=''
    tail="""
</RDF:RDF>
    """
    with open(os.path.join(path,'extensions.json')) as file:
        data = json.load(file)
    addons=data['addons']

    for addon in addons :
        body+='  <RDF:Description RDF:about="urn:mozilla:item:'
        body+=addon['id']
        body+='"\n'
        body+='                   NS1:version="'
        body+=addon['version']
        body+='">\n'
        body+='  </RDF:Description>\n'
   
    with open(os.path.join(path,'extensions.rdf'),mode='w') as file:
        file.write(''.join([head,body,tail]))

def getThunderbirdProfileFolder():
    ini = configparser.ConfigParser()
    ini.read(os.path.join(ThunderbirdPATH,'profiles.ini'))
    if ini.has_option('General', 'Version'):
        for user in ini.sections():
            if ini.has_option(user, 'Default'):
                try:
                    ini.getboolean(user, 'Default')
                except:
                    folder=os.path.join(ThunderbirdPATH,ini.get(user,'Default'))
                    break
        return folder
       
    else:
        for user in ini.sections():
            if ini.has_option(user, 'Default'):
                if ini.getboolean(user, 'Default'):
                    break
        if ini.getboolean(user, 'IsRelative'):
            folder=os.path.join(ThunderbirdPATH,ini.get(user,'Path'))
        else:
            folder=ini.get(user,'Path')
        return folder


linkAndCreateWineToLinuxThunderbird()
profilePath=getThunderbirdProfileFolder()
print(profilePath)
modifyMPEAddOnForThunderbird(profilePath)
createRDF(profilePath)

print("need to restart your Thunderbird twice")

Benutzer-Profile anzeigenPrivate Nachricht senden
Beiträge der letzten Zeit anzeigen:      
Neues Thema eröffnenNeue Antwort erstellen


 Gehe zu:   



Nächstes Thema anzeigen
Vorheriges Thema anzeigen
Du kannst keine Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum nicht antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.

Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme :: Alle Zeiten sind GMT + 1 Stunde
Deutsche Übersetzung von phpBB.de