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

how to close a stream created with: stream = util.readFileIntoStream(path of textfile.txt)

New Here ,
Mar 16, 2023 Mar 16, 2023

- Acrobat Pro batch JavaScript

- includes the following line:  stream = util.readFileIntoStream(path of textfile.txt)

- runs and completes OK

- if I then try to open textfile.txt with TextPad, I get a sharing violation

- I have to close Acrobat Pro to release the file

Question: how do I close the stream from within the batch script? Tried "stream.close()" but got a "not a function" error.

TOPICS
JavaScript
693
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
Community Expert ,
Mar 16, 2023 Mar 16, 2023

This shouldn't be necessary. Are you trying to open the file while the Action is running, though? I'm not sure that's a good idea...

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
New Here ,
Mar 27, 2023 Mar 27, 2023
LATEST

Thanks for the response. No, the Action completes w/o problems before I try to open the text file. Maybe a little more detail may help:

- the text file contains a JSON hiearchy of directories and files that the Action processes

- the Action reads the file with util.readFileIntoStream(), then calls JSON.parse() to initialize the corresponding JS object

After the Action completes, if I try to open the JSON file in TextPad to make a quick manual change, TextPad gives me a sharing violation. I have to close Acrorbat Pro in order to make the change.

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