@Mark91
nw.Shell.openItem() should be able to open any file on your computer, you just need to pass in the path as a string.
Note thought that in javascript backslash is used as an escape character, so you either need to escape them:
Code:
nw.Shell.openItem("C:\\Users\\dread\\Documents\\file.txt");
Convert them into forward slashes:
Code:
nw.Shell.openItem("C:/Users/dread/Documents/file.txt");
Or use String.raw:
Code:
nw.Shell.openItem(String.raw`C:\Users\dread\Documents\file.txt`);
---
If you were to distrubute your game, using absolute file paths wouldn't be good because the user likely would have the game installed somewhere different from you. That's where my previous code comes in.
Code:
path.resolve(($gameTemp._isPlaytest?'':'www/')+"test.cmd")
This code gets the full path of the file "test.cmd" in your game directory.
For me it returns "C:\Users\dread\Documents\RPG Maker\RMMV\MV3D\test.cmd"
---
If you want to get the documents folder programmatically, you can do it like this:
Code:
var os = require("os");
var documents = path.resolve(os.homedir(),"Documents");
And then to open a file in that folder,
Code:
nw.Shell.openItem(path.resolve(documents,"file.txt"));
---
The script just tells the os to open the file with whatever default file associations it has, so there shouldn't be any more lag than from opening the file normally.
However computers typically aren't good at multitasking, so it's possible your computer was running low on memory so it loaded the game's memory into a page file. Then when you switched back to the game it had to read the memory back from the page file.