4

I'm currently trying to build a .bat script to autobuild my node-webkit application, and the only missing thing is changing the generated .exe icon.

I've been digging the interwebs for a while whitout finding any working solution.

So far I've tried :

  • Resource Hacker : I managed to change the icon using the application, but could not make it work with a script. Here is a screenshot of resource hacker with my exe Resource Hacker with my exe opened I tried the following commands :
    • ResHacker -modify App.exe, AppTest.exe, MyIcon.ico, Icon, 1
    • ResHacker -modify App.exe, AppTest.exe, MyIcon.ico, Icon, 1, 1033
    • ResHacker -addoverwrite App.exe, AppTest.exe, MyIcon.ico, "Icon Group", IDR_MAINFRAME, 1033
    • ResHacker -addoverwrite App.exe, AppTest.exe, MyIcon.ico, "Icon Group", IDR_MAINFRAME

Unfortunately, none of these created the AppTest.exe file neither did they print and error message.

  • RCEDIT.exe which is part of the WinRun4JS application, their home page shows an example of using RCEDIT to change the icon : RCEDIT.exe /I [YourApp].exe [YourApp].ico, this is indeed working iconwise, but it breaks the node-webkit executable and leaves me with an application running the default nodejs page. ( As a reminder, node-webkit exe are built this way

  • Various other applications worked fine but none of them seemed to propose a command line interface.

I feel like I'm quite close to the solution with Resource Hacker and I might have missed something obious while fiddling with it but right now I can't thing of anything else to try.

Thank you for reading and have a nice day !

Furzel
  • 606
  • 8
  • 18
  • 1
    I believe Nodebob uses Anolis Resourcer in its build tool. https://github.com/geo8bit/nodebob – Mar Jan 24 '14 at 00:47
  • > RCEDIT.exe ... breaks the node-webkit executable Did you run rcedit before merging nw.exe and app.nw (that is for original nw.exe)? – Denis Ryabov Feb 25 '14 at 17:39
  • Would love if you shared your script for doing this. :) – Kirk Ouimet Oct 15 '14 at 19:16
  • Here you go : https://gist.github.com/Furzel/c9102200aa54b4ab9716 I made some modifications to remove project specific lines so there might some typos but that should give you a nice base to get started. – Furzel Oct 16 '14 at 13:46

2 Answers2

4

As always, I was not trying hard enough, the right command for ResHacker was :

ResHacker -addoverwrite "App.exe", "AppTest.exe", "MyIcon.ico", ICONGROUP, IDR_MAINFRAME, 1033

Also if someone wants to dig mvanderw's solution you will need Resourcer and then run the following command :

Resourcer -op:upd -src:App.exe -type:14 -name:IDR_MAINFRAME -file:MyIncon.ico

Furzel
  • 606
  • 8
  • 18
0

I would rather not update the icon of the nw.exe, since it's what NodeWebKit provides. What my solution was to launch the application through a shortcut and setting the proper icon for the shortcut. That way we are using NW but not hacking it.

Note: context was windows and a setup creator like "Inno Setup", makes it easy to do.

UPDATE: Now that I got your question, why don't you use the WinIco options of the nw-builder.

options.winIco

Extracted from the gulp task

var nw = new NwBuilder({
    version: '0.12.0',
    files: [ bases.dist + '**'],
    platforms: ['win'],
    buildDir: bases.webkit,
    winIco: 'YourApp.ico',
    macIcns: 'YourApp.icns'
});
  • Hey there, the point was not to edit the nw.exe icon but my app binary ( which contains nw.exe ) icon. It defaults to the same as nw.exe which is pretty ugly for an app you send to customers. – Furzel Oct 23 '15 at 09:07
  • 1
    Ok it make sense if you are packaging your app into the nw.exe. In our case we also had the same model, but we added the auto update feature for the application(through NW Updater) then we ended up with NW.exe and a package.nw, which which case we didn't wanted to change the icon for the nw.exe, but still our application to have a proper custom icon. So if you are planing to support auto updates, be aware. – Chathuranga Wijeratna Oct 28 '15 at 07:36
  • Thanks for the extra info ! – Furzel Oct 28 '15 at 12:42