Skip to main content
jamesf42245324
Inspiring
December 18, 2023
Answered

util is undefined

  • December 18, 2023
  • 1 reply
  • 566 views
I am tring to read a text file with adobe scripts I am doing it in photo shop using extend scripts in visual studio code.  When i try to launch i am getting the following error.  I am guessing it is missing the referance to the utilites but i dont know how to add them.  
 
 
function readFileToText(input) {
  //let file = input.files[0];


//Read file data into stream
var stmFileData = util.readFileIntoStream(input);

// Convert data into a String
var strTextData = util.stringFromStream(stmFileData);
alert(strTextData);
}
This topic has been closed for replies.
Correct answer jamesf42245324

Have you considered file.open()?


i ended up using info from this form Solved: Script to Open Multiple Docs from a Text File - Adobe Community - 14148443

 

but the orginial issue witht he undefinde went away once i put it in try catch 

1 reply

Legend
December 18, 2023

Where did you find this script? Its probably for Acrobat as that is an Acrobat JS function, not Photoshop.

jamesf42245324
Inspiring
December 18, 2023

What file fuction can i use to open a text file?

Legend
December 18, 2023

Have you considered file.open()?