Disable addon script

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
CVH
Premier Member
Posts: 3468
Joined: Wed Sep 27, 2017 4:17 pm

Disable addon script

Post by CVH » Tue May 26, 2020 12:10 am

Andrew,
I have two tools in the pipeline.
eg.:https://qcad.org/rsforum/viewtopic.php?f=76&t=7092
Both use PRO resources.
I was looking fore a method to disable the loading of the script addon in CE.

This was not the answer:
https://qcad.org/rsforum/viewtopic.php? ... ript#p9106
Quite Strange topic because what is mentioned here:
It's not possible to 'override' scripts that are shipped with QCAD.
Is what I do while putting a copy of the script at its appropriate place.

In short: as your adviced here:
https://qcad.org/rsforum/viewtopic.php? ... ols#p25034

Can I combine
hasPlugin("PROTOOLS"))
In the function init section so it doesn't create the RGuiAction?

Or is there another method to avoid loading?

Thanks,
CVH

User avatar
andrew
Site Admin
Posts: 9058
Joined: Fri Mar 30, 2007 6:07 am

Re: Disable addon script

Post by andrew » Tue May 26, 2020 7:36 am

Easiest is probably to preventing the GUI action from being created or showing up anywhere:

MyActionInit.js

Code: Select all

function init(basePath) {
    if (!hasPlugin("PROTOOLS")) {
        return;
    }
    
    var action = new ...
    ...
}

CVH
Premier Member
Posts: 3468
Joined: Wed Sep 27, 2017 4:17 pm

Re: Disable addon script

Post by CVH » Tue May 26, 2020 10:08 am

Thanks,
just what I was thinking reading other replies regarding the init phase.

Further:
I suppose the TRIAL version loads the PROTOOLS too and disengage them at a certain point.
If true, I will need to test for the PROTOOLS again when the addon is loaded in trial and gets activated later on.
Or is there another way? Or is this completely wrong?

Come to think of it.
I am not pleased with the idea that in trial mode one could create hatch patterns with the Tile2Hatch addon.
Simply by restarting the application over and over again as temporally freeware.
Too much effort is put into it.

Kind regards,
CVH

User avatar
andrew
Site Admin
Posts: 9058
Joined: Fri Mar 30, 2007 6:07 am

Re: Disable addon script

Post by andrew » Tue May 26, 2020 12:20 pm

CVH wrote:
Tue May 26, 2020 10:08 am
I suppose the TRIAL version loads the PROTOOLS too and disengage them at a certain point.
The trial shuts down when expired. The only way to turn a trial package into CE is by removing the QCAD Professional plugins (i.e. removing plugin "PROTOOLS", "DWG", etc.).
CVH wrote:
Tue May 26, 2020 10:08 am
I am not pleased with the idea that in trial mode one could create hatch patterns with the Tile2Hatch addon.
Simply by restarting the application over and over again as temporally freeware.
You can check if a given plugin runs in trial mode with:

Code: Select all

var pluginInfo = RPluginLoader.getPluginInfo("PROTOOLS");
var exp = pluginInfo.get("TrialExpired");
if (isNull(exp)) {
    // compiled in full version mode
}
if (exp===true) {
    // trial has expired, QCAD will shut down
}
if (exp===false) {
    // running in trial mode
}
If you are planning to distribute those scripts / plugins through your own channels, you can build in other means to limit / disable the script when run in trial mode or even create a plugin that can be "activated" somehow, etc.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”