Skip to main content
Pedro Cortez Marques
Legend
Jul 29, 2013 9:09 AM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
Muppet MarkCorrect answer
Inspiring
Jul 29, 2013 11:27 AM UTC

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…

2 replies

Muppet MarkCorrect answer
Inspiring
Jul 29, 2013 11:27 AM UTC

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…

Translate
Pedro Cortez Marques
Legend
Jul 29, 2013 3:14 PM UTC

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

Translate