Skip to main content
Known Participant
September 2, 2017
Answered

read XML file on network drive via script

  • September 2, 2017
  • 1 reply
  • 1313 views

Hi guys,

I am trying to write a script which starts by reading an XML file, no problem at all in a quick and dirty test:

var XMLfile = new File("D:\Shot01.xml");

XMLfile.open('r');

var str = "";

while(!XMLfile.eof)

str += XMLfile.readln();

XMLfile.close();

alert(str);

This works perfectly well, but when I try to read the same file from a network drive:

var XMLfile = new File("T:\__SharedAssets\Assets_AE\Scripts\ShotManager\Shot01.xml");

I don't get anything at all. After Effects has been set to allow network access of course ( Edit -> Parameters -> General -> Allow Scripts to Write Files and Access Network ).

Obviously we don't keep any project files on local drives so I'm stuck at the moment. Do you have any idea what might be going on?

Thanks in advance!

This topic has been closed for replies.
Correct answer Tomas Sinkunas

What would this return?

var XMLfile = new File("T:\__SharedAssets\Assets_AE\Scripts\ShotManager\Shot01.xml");

alert(XMLfile.exists);

If it returns false, witch it probably will, try escape slashes in the path: "\" to "\\":

var XMLfile = new File("T:\\__SharedAssets\\Assets_AE\\Scripts\\ShotManager\\Shot01.xml");

Or better yet, use forward slashes instead:

var XMLfile = new File("T:/__SharedAssets/Assets_AE/Scripts/ShotManager/Shot01.xml");

1 reply

Tomas Sinkunas
Tomas SinkunasCorrect answer
Legend
September 2, 2017

What would this return?

var XMLfile = new File("T:\__SharedAssets\Assets_AE\Scripts\ShotManager\Shot01.xml");

alert(XMLfile.exists);

If it returns false, witch it probably will, try escape slashes in the path: "\" to "\\":

var XMLfile = new File("T:\\__SharedAssets\\Assets_AE\\Scripts\\ShotManager\\Shot01.xml");

Or better yet, use forward slashes instead:

var XMLfile = new File("T:/__SharedAssets/Assets_AE/Scripts/ShotManager/Shot01.xml");

Known Participant
September 2, 2017

Hi Tomas,

Thanks a lot! Should have tried that myself, both options work absolutely fine