Author Topic: Migrate from JScript to JavaScript  (Read 4366 times)

Helmut Ortmann

  • EA User
  • **
  • Posts: 967
  • Karma: +42/-1
    • View Profile
Migrate from JScript to JavaScript
« on: January 07, 2022, 10:44:58 pm »
Hello,

is there an easy way to migrate a great bunch of code from JScript to JavaScript?

Can I call JavaScript from JScript within EA?

Thanks and best regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1308
  • Karma: +120/-10
  • Its the results that count
    • View Profile
Re: Migrate from JScript to JavaScript
« Reply #1 on: January 09, 2022, 09:49:38 am »
I was looking at this problem about 6 months ago when working for another company. Came across https://support.smartbear.com/testcomplete/docs/scripting/specifics/javascript-for-jscript-users.html which provided some pointers.
The other option I considered was using regular expressions to parse the files and convert the differences between JScript and JavaScript. The two main things IIRC in my code were dealing with active x objects and enumerator for navigating collections. I ended up writing some code using regular expressions to convert using to ActiveXObject. Sorry don't have a copy as I've changed companies.
Can't remember for sure but think I might have used this. The Demo doesn't seem to work now so maybe browser dependent. Says something about  IE6. Think it worked for me with IE 10 or 11 can't remember now and don't have that available anymore at my new company nor my home machine.
https://slingfive.com/pages/code/scriptConverter/default.html
Happy to help
:)

Helmut Ortmann

  • EA User
  • **
  • Posts: 967
  • Karma: +42/-1
    • View Profile
Re: Migrate from JScript to JavaScript
« Reply #2 on: January 10, 2022, 07:46:46 am »
Hello Sunshine,

Thanks for your valuable pointers.

The address https://slingfive.com/pages/code/scriptConverter/default.html seems not to work (service is unavailable).


Best regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1308
  • Karma: +120/-10
  • Its the results that count
    • View Profile
Re: Migrate from JScript to JavaScript
« Reply #3 on: January 10, 2022, 08:09:17 pm »
You are right that link used to point to a page to run an example vbscript to jscript converter but now get 403 access denied so the admin must have removed public access.

Thought the code might help get you started.

The js code underneath can still be accessed so try these links and hurry before they deny access to these too.
https://slingfive.com/pages/code/scriptConverter/scriptConverter.js
https://slingfive.com/pages/code/scriptConverter/vbs2js_conversions.js
https://slingfive.com/pages/code/scriptConverter/js2vbs_conversions.js

Not sure if its written in JScript (proabably) or JavaScript.



Happy to help
:)