Author Topic: Migrate from JScript to JavaScript  (Read 5780 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: 1309
  • 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: 1309
  • 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
:)

shimon

  • EA User
  • **
  • Posts: 125
  • Karma: +5/-0
    • View Profile
Re: Migrate from JScript to JavaScript
« Reply #4 on: January 22, 2025, 02:06:29 am »
Hi,

Does anybody have experience using ChatGPT for these conversions?

Thanks,
Shimon

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13251
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Migrate from JScript to JavaScript
« Reply #5 on: January 22, 2025, 02:17:55 am »
Does anybody have experience using ChatGPT for these conversions?
I've done some experiments (mainly to translate vbscripts to javascript) and using an AI works mostly, but you'll still need some manual work.
The downside is that the code generated by such an AI always looks plausable, so it's hard to spot the errors.

I also tried https://www.codeporting.ai/ and I was very happy with the results, especially since you can include additional instructions (like leaving the "as EA.Element" and the likes)

Geert

shimon

  • EA User
  • **
  • Posts: 125
  • Karma: +5/-0
    • View Profile
Re: Migrate from JScript to JavaScript
« Reply #6 on: January 22, 2025, 02:21:50 am »
Thanks Geert,
Have a great day,
Shimon