cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Write to file using JavaScript

SOLVED
Highlighted
Aquamarine

Write to file using JavaScript

Hello everyone,

 

is possible to open file and write text into? I am trying something like this, but of course it does not work:

 

$scope.writeToLogFile = function (text){
var txtFile = "Uploaded/log.html";
var file = new File([''], txtFile);
file.open('w'); // open file with write access
file.writeln(text);
file.close();
}

My idea is about creating a log file for viewing changes.

 

Thanks for every tip Smiley Happy

 

Tomas

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Write to file using JavaScript

I have not tried this but given other things i have tried and run into security restrictions i don't think this is going to be possible. It doesn't seem there is any persistent storage available.

 

I have used a text area 2D widget as a debugger window in the past when i needed debugging on a device.

 

I more elaborate solution would be to push your messages out to a server with a POST call.

View solution in original post

3 REPLIES 3
Highlighted

Re: Write to file using JavaScript

I have not tried this but given other things i have tried and run into security restrictions i don't think this is going to be possible. It doesn't seem there is any persistent storage available.

 

I have used a text area 2D widget as a debugger window in the past when i needed debugging on a device.

 

I more elaborate solution would be to push your messages out to a server with a POST call.

View solution in original post

Highlighted

Re: Write to file using JavaScript

Thank you jmikesell,

 

The Text Area is the best way for me. It enable use tabs \t end of line and  \r\n for creating a structure in "log console".

 

Tomas

Highlighted

Re: Write to file using JavaScript

We have done some capturing of info from an AR experience by writing this back into ThingWorx as it's kind of designed to work this way.  From there we could then display this data in a mashup or export it out to disk.  Obviously this way adds more components to the system (and $) but it works quite well just using some of the services that you create in ThingWorx.

 

In our example we were capturing the time taken for each step as a user follows an AR service instruction to generate a report on how long they took.

Announcements
Join an
AR Working Group!

Topics available:
AR/VR for Data Optimization AR/VR for Security and Control AR/VR for Inspection