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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Write to file using JavaScript

TomasCharvat
14-Alexandrite

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

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

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.

TomasCharvat
14-Alexandrite
(To:jmikesell)

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

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.

Top Tags