jobisoft / quicktext

An extension for Thunderbird that lets you create templates that can be easily inserted into your own emails.
Mozilla Public License 2.0
184 stars 52 forks source link

Scripts: No chrome package registered for chrome://cardbook/content/cardbookRepository.js #381

Closed Heliophob closed 9 months ago

Heliophob commented 11 months ago

Hello,

Unfortunately, the update version 5.14 didn't help in my case. The scripts still don't work for me. See also here: https://github.com/jobisoft/quicktext/issues/379#issuecomment-1749538512

In the console I get the following error message: No chrome package registered for chrome://cardbook/content/cardbookRepository.js CURSOR LOG failedSearchAttempts : 1 quicktext.js:609:15

Note: I don't have CardBook installed (at least not by me manually but possibly by Thunderbird at the factory?). Of course, since I don't have it installed, I can't uninstall it! The same error also occurs if I deactivate all other plugins and only leave Quicktext switched on!

See also here: https://github.com/jobisoft/quicktext/issues/379#issuecomment-1756206378

Sys-Info

Best Regards & THX!

jobisoft commented 11 months ago

Thanks for your report. Please post an example template + script, which triggers this error.

Heliophob commented 11 months ago

See also 1. Link :)

var subject = this.mQuicktext.get_orgheader(["subject"]); var pattern = /TID#([0-9]{6})/i; var tid = pattern.exec(subject); if (!tid) var pattern = /TID#([0-9]{5})/i; var tid = pattern.exec(subject); if (!tid) return ""; // gibt nichts zurück else return tid[1]; // gibt die TID zurück

jobisoft commented 11 months ago

Please also add the template, which uses this script.

Heliophob commented 11 months ago

i use it with: [[SCRIPT=TID]]

eg. template: Bitte geben Sie bei Ihren Antworten immer die Ticket-ID an: [[SCRIPT=TID]]

Name from script is "TID"

jobisoft commented 9 months ago

The error you are seeing is inside a try...catch block, so Quicktext currently cannot connect to CardBook (or CardBook is not installed), but that does not prevent the rest of the code to work properly.

Your script does not work, because some internal parts are now async. You need to put "await" before the get_orgheader call:

// We need to await the async function call, otherwise we just get
// a Promise object and not a literal value.
var subject = await this.mQuicktext.get_orgheader(["subject"]);

// Lets check what we got.
mWindow.console.log({subject});

var pattern = /TID#([0-9]{6})/i;
var tid = pattern.exec(subject);
if (!tid)
var pattern = /TID#([0-9]{5})/i;
var tid = pattern.exec(subject);
if (!tid)
return ""; // gibt nichts zurück
else
return tid[1]; // gibt die TID zurück
Heliophob commented 9 months ago

many many thanks ! It works!