Browser: invoke download on desktop (NW.js)???

Get help using Construct 2

Post » Thu Sep 03, 2015 1:10 pm

Helo,

Since browser: invoke download is not working on desktop NW.js how can i save my snapshot image?

BR
Irina
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Thu Sep 03, 2015 2:51 pm

In theory, NW.js should allow you to write data in binary format, but the plugin doesn't seem to expose this functionality.
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Thu Sep 03, 2015 3:57 pm

B
66
S
24
G
7
Posts: 1,514
Reputation: 11,039

Post » Thu Sep 03, 2015 4:17 pm

@korbaach

thanx, iw seen that but i can't get how it's done... :(
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Thu Sep 03, 2015 4:51 pm

Probably... something like this:

On canvas shapshot....Browser Execute javascript
Code: Select all
"var fs = require('fs');fs['writeFileSync']('" &replace(NWjs.UserFolder&"\Desktop\"&"Screnshot"& ".png","\","\\")& "','" &CanvasSnapshot& "'.split(',')[1], {'encoding': 'base64'});"
B
66
S
24
G
7
Posts: 1,514
Reputation: 11,039

Post » Thu Sep 03, 2015 4:57 pm

NW.js should expose a "WriteBase64Image" function or something. It's far less clunky than having to use the Browser's ExecJs...
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Thu Sep 03, 2015 6:30 pm

its not working... i guess Browser object is not working under NWjs... :(
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Thu Sep 03, 2015 6:40 pm

It is working, it's just very clunky and easy to mess up. Show us your attempts, and we'll help you get it in working order.
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Thu Sep 03, 2015 7:53 pm

this is what i have so far:
https://dl.dropboxusercontent.com/u/169390986/PUB/test.capx

its small images editor that i need for my project.
it loads image and you can drag it, scale it and finaly cut part of it using canvassnapshot.

it works from browser... but there i have following problem... i want my images to be saved in 320*427 size
when i export as HTML5 images get increased in size :?:

and if i want to make it desktop app (as i would like it) NWjs wont save my images.. :(
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Thu Sep 03, 2015 8:57 pm

Here's a modified version. I hacked here and there in the existing code and plugged the ExecJS on a "Save Dialogue". It worked correctly when I tested it.

https://www.dropbox.com/s/2b7mgmlayk4c1 ... .capx?dl=0
Last edited by Magistross on Sat Aug 19, 2017 4:25 am, edited 1 time in total.
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 36 guests