Book a Demo

Author Topic: open output file in javascript  (Read 5510 times)

jarnold30

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
open output file in javascript
« on: July 09, 2022, 07:46:43 pm »
Hi.
I am scripting using javascript.
I want to open an output file to write to.
How???

J

jarnold30

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: open output file in javascript
« Reply #1 on: July 10, 2022, 05:25:28 am »
Hi, there doesn't seem to be any way to do it in Javascript.  I have rewritten my code in vbscript.  >:(

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: open output file in javascript
« Reply #2 on: July 10, 2022, 09:11:02 am »
Did you not look into the EA Script Library where you see JavaScript-CSV and in there an example showing writing to a file?
Code: [Select]
function CSVEExportInitialize( fileName /* : String */, columns /* : Array */,
exportColumnHeadings /* : boolean */ ) /* : void */
{
if ( !exportIsExporting )
{
// Switch into exporting mode
exportIsExporting = true;

// Setup file object and column array
var fsObject = new COMObject( "Scripting.FileSystemObject" );
exportFile = fsObject.CreateTextFile( fileName, true );
...
Happy to help
:)

jarnold30

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: open output file in javascript
« Reply #3 on: July 10, 2022, 10:48:34 pm »
Many thanks.  Just after I translated everything into vbscript...

John :-[

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: open output file in javascript
« Reply #4 on: July 11, 2022, 05:05:38 pm »
Oh dear, didn't seem like much work if it took less than a day. At least you now have two languages.
Happy to help
:)

jarnold30

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: open output file in javascript
« Reply #5 on: July 12, 2022, 01:16:50 am »
look on the bright side...