Author Topic: ActiveXObject is not defined  (Read 8936 times)

survex

  • EA User
  • **
  • Posts: 76
  • Karma: +1/-1
    • View Profile
ActiveXObject is not defined
« on: November 19, 2014, 05:49:45 am »
Getting error "ActiveXObject is not defined" executing this script:

!INC Local Scripts.EAConstants-JScript
function main()
{
      var fso = new ActiveXObject("Scripting.FileSystemObject");
}
main();

What am I doing wrong?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: ActiveXObject is not defined
« Reply #1 on: November 19, 2014, 08:47:50 am »
At a guess, you're using the JScript syntax for an ActiveX object inside JavaScript. The example in the help for accessing an ActiveX object from JavaScript is:
Code: [Select]
this.name="Odd Even";
var logger = new COMObject("MySim.Logger");
logger.Show();
logger.Log("Simulation started");

survex

  • EA User
  • **
  • Posts: 76
  • Karma: +1/-1
    • View Profile
Re: ActiveXObject is not defined
« Reply #2 on: November 19, 2014, 06:27:03 pm »
 :-*
Quote
At a guess, you're using the JScript syntax for an ActiveX object inside JavaScript. The example in the help for accessing an ActiveX object from JavaScript is:
Code: [Select]
this.name="Odd Even";
var logger = new COMObject("MySim.Logger");
logger.Show();
logger.Log("Simulation started");

That's helped, thank you. By the way, do you know how to read file via scripting?

survex

  • EA User
  • **
  • Posts: 76
  • Karma: +1/-1
    • View Profile
Re: ActiveXObject is not defined
« Reply #3 on: November 19, 2014, 07:59:34 pm »