frage12358
frage12358

Reputation: 53

Save a file on the harddrive with javascript

I have the following problem:

We are currently using a script to export data from CAD assemblies. This script is running in the Creo browser, which is currently IE. To access the correct directory the following code is used:

var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.CreateTextFile(session.GetCurrentDirectory() + ComponentName + ".xml", true);
f.Write(iht.join("\n"));
f.Close();

The Creo bowser is going to be switched to Chrome. Because of this ActiveX is no longer going to work. Is there a way to archive the same result with different code in Chrome? Creo is not supporting Chrome Plugins, so IE Tab is not an option.

Any help is greatly appreciated!!

Upvotes: 0

Views: 348

Answers (2)

Shilly
Shilly

Reputation: 8589

No. No more ActiveX.

In the past, most (auto)CAD programs came with a builtin LISP editor you could write scripts in. Maybe that is usable to rewrite the export if you find a LISP programmer.

Myself, I would install node.js on a server so you can use their file system module, which is a good replacement for the old active x object. This probably will require you to copy the files to that server though, so your current workflow might change a bit.

Upvotes: 0

Andrew
Andrew

Reputation: 383

There is a non-standard feature: https://developer.mozilla.org/en-US/docs/Web/API/FileSystem

But again, it is non-standard.

Edit: as written in that link, "This interface will not grant you access to the users filesystem. Instead you will have a "virtual drive" within the browser sandbox."

Upvotes: 1

Related Questions