Author Topic: Scripting.FileSystemObject  (Read 4480 times)

Sebastian Schmidt

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Scripting.FileSystemObject
« on: May 29, 2013, 12:09:32 am »
Hi all,

i'd like to write some information to a simple text file using JScript, copied from the CSV example:

//      fileName="C:\test.txt";
//      fileName="C:\\test.txtl";
//      fileName="C:/test.txt";
fileName="C://test.txt";
var fsObject = new ActiveXObject( "Scripting.FileSystemObject")
exportFile = fsObject.CreateTextFile( fileName, true );
exportFile.WriteLine( "--hello world --" );

I get either "Path not found" or "access denied" with these variants.

Hints on what I'm doing wrong? Exporting Artifacts to the file system from the EA GUI is not a problem.

Kind regards,
Sebastian

VKN

  • EA User
  • **
  • Posts: 187
  • Karma: +9/-1
    • View Profile
Re: Scripting.FileSystemObject
« Reply #1 on: May 29, 2013, 09:11:16 am »
Did you check if you can create C:\test.txt manually?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Scripting.FileSystemObject
« Reply #2 on: May 29, 2013, 03:52:13 pm »
Sebastian,

Since Windows 7 (or Vista maybe?) it is no longer allowed to create files on the C: root without elevated access.
You better create a directory to do your testing such as
C:\Test, so you can test the filename "C:\\Test\\test.txt" or variants thereof.

Geert

Sebastian Schmidt

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Scripting.FileSystemObject
« Reply #3 on: May 31, 2013, 08:48:57 pm »
Thanks for your anwsers,

you were right, it was a rights management problem with the windows machine. I'm now able to write to the desktop, which is fine.

Kind regards,
Sebastian