Author Topic: When I use simulation, how should I read the data in the local file?  (Read 3123 times)

fy1997

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
When I use simulation, how should I read the data in the local file?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: When I use simulation, how should I read the data in the local file?
« Reply #1 on: June 15, 2020, 05:00:34 pm »
Can you be a bit more specific? This seems like a very general question with many different possible answers.

Geert

fy1997

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: When I use simulation, how should I read the data in the local file?
« Reply #2 on: June 15, 2020, 05:13:45 pm »
Can you be a bit more specific? This seems like a very general question with many different possible answers.

Geert

When I use the simulation of EA,I want to read a local json file with javascript,I try to write code in effect like this:
                var fso, ts, s ;
      var ForReading = 1;

      fso = new ActiveXObject("Scripting.FileSystemObject");
      ts = fso.OpenTextFile("D:\\EAWorkSpace\\config.json", ForReading);
      s = ts.ReadAll();
but I got a error that OpenTextFile is not a function,I don't know why,can you give me a way to do it?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: When I use simulation, how should I read the data in the local file?
« Reply #3 on: June 16, 2020, 11:02:40 am »
If you're in simulation you need Javascript, not JScript.

One of the differences is that you need new COMObject().

fy1997

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: When I use simulation, how should I read the data in the local file?
« Reply #4 on: June 17, 2020, 11:24:44 am »
If you're in simulation you need Javascript, not JScript.

One of the differences is that you need new COMObject().

I got  the same error after I changed activexobject to ComObject :'(