Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

util is undefined

Explorer ,
Dec 18, 2023 Dec 18, 2023
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);
}
TOPICS
Windows
487
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Dec 19, 2023 Dec 19, 2023

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 

Translate
Adobe
LEGEND ,
Dec 18, 2023 Dec 18, 2023

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 18, 2023 Dec 18, 2023

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 18, 2023 Dec 18, 2023

Have you considered file.open()?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 19, 2023 Dec 19, 2023

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 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 19, 2023 Dec 19, 2023
LATEST

The issue didn't go away, you just hid the error.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines