-1

enter image description hereI am trying to assign registry value to 1 or 0. Electron packager and electron behaves differently. I set the value of registry to 0 and 1 on click of anchor tags. I am able to achieve this before the application has packaged but after application has packaged, I get error:vbscript process reported unknown error code 1 and registry doesn't set to 1 or 0.

Please note: I am using regedit with regedit.putvalue here to update the values

This question below has info about what I tried. link to the question

What I tried

dropDownBtn=`

   <button id="dropDown" class="dropdown" data-toggle="off">Set/Unset Registry</button>
     <div id="dropDowncontent" class="content" data-state="closed">
        <ul>
            <p> <b>Set or Unset Registry</b></p>
            <li><a href="#" onclick="setRegistryValue()">Set</a></li>
            <li><a href="#" onclick="unsetRegistryValue()" >Unset</a></li>
        </ul>
      </div>

update on this question I use npm builder "electron-packager --out winx64 --no-prune --asar" with asar enabled this doesn't work.

The registry doesn't have access from asar package, I guess

karansys
  • 2,449
  • 7
  • 40
  • 78

1 Answers1

0

First, set the following code in package.json in build

"extraResources": [
  {
    "from": "node_modules/regedit/vbs",
    "to": "regedit/vbs",
    "filter": [
      "**/*"
    ]
  }
]

Second, set the following code where you use regedit

let regedit = require('regedit'); regedit.setExternalVBSLocation('resources/regedit/vbs');

For more info, refer:

  1. https://www.npmjs.com/package/regedit#a-note-about-electron
  2. https://github.com/ironSource/node-regedit/issues/60