Skip to main content
Pedro Cortez Marques
Legend
July 29, 2013
Answered

Extendscript Toolkit targeting Bridge, does'nt read text file content. Bug?

  • July 29, 2013
  • 1 reply
  • 1580 views

When I load a file xml and read its contents, it only works from Bridge on windows7

But when I run the code to Bridge from Abobe Extendscript Toolkit targeting Bridge, it does'nt read the fole content ( fileXMLtoParse.read() )

Is this a bug, or there is a work arround?

My example code that reads a xml fole from Desktop:

XML (Desktop/userCheckin.xml)

<preferences>

  <editor>Content to read here</editor>

</preferences>

Code:

var userDisk = Folder("~/Desktop");

var  xmlFile = File(userDisk + "/userCheckin.xml");

if (xmlFile.exists) {

     var fileXMLtoParse = File (xmlFile);

     fileXMLtoParse.open('r');

     var str = new XML(fileXMLtoParse.read());

     fileXMLtoParse.close();

     str.normalize();

     var field = str.elements().child(0); // That's the text I need

}

// I have a subpanel with a text field 'text_info' where I put specific xml data

tbPanel.text_info.text = field;

This topic has been closed for replies.
Correct answer Muppet Mark

What version of CS are you using…? This worked just fine here with CS5 on the mac… Paul no longer posts here so I don't know anybody that can help if its a PC issue…

#target bridge

var  xmlFile = File( Folder.desktop + '/userCheckin.xml' );

if ( xmlFile.exists ) {

 

     xmlFile.open( 'r' );

                    

     var str = new XML( xmlFile.read() );

                    

     xmlFile.close();

                    

     str.normalize();

                    

     $.writeln( str.elements().child(0) );

                    

};

Not sure why you make a file object of the same thing twice… I also make use of Folder object static properties…

1 reply

Muppet MarkCorrect answer
Inspiring
July 29, 2013

What version of CS are you using…? This worked just fine here with CS5 on the mac… Paul no longer posts here so I don't know anybody that can help if its a PC issue…

#target bridge

var  xmlFile = File( Folder.desktop + '/userCheckin.xml' );

if ( xmlFile.exists ) {

 

     xmlFile.open( 'r' );

                    

     var str = new XML( xmlFile.read() );

                    

     xmlFile.close();

                    

     str.normalize();

                    

     $.writeln( str.elements().child(0) );

                    

};

Not sure why you make a file object of the same thing twice… I also make use of Folder object static properties…

Pedro Cortez Marques
Legend
July 29, 2013

I am using PC windows 7 with CS6 (Bridge 5.0.2.4 x64)

It still runs only from/within Bridge and not on Abobe Extendscript Toolkit.

Thanks anyway.

I will have to keep testing not from ESTK