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

Sequence to update the script of one function

New Here ,
Apr 06, 2016 Apr 06, 2016

Hi all

I discovered the very effective batch sequences to deal with many files.

This time I would like to update only one function of my script (that includes many other functions).

So far , I haven't found how to do that with a sequence.

I would appreciate any help.

Thanks in advance

Michel

TOPICS
Acrobat SDK and JavaScript , Windows
852
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

Community Expert , Apr 06, 2016 Apr 06, 2016

No. It's:

this.addScript("ScriptName", "ScriptCode");

Translate
Community Expert ,
Apr 06, 2016 Apr 06, 2016

You can't update a specific function. You can set the entire code to the new value, though.

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 ,
Apr 06, 2016 Apr 06, 2016

That's what I was scare of  ! so what's the way to do it ? is it this.script = a string containing the new entire script ?

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 ,
Apr 06, 2016 Apr 06, 2016

No. It's:

this.addScript("ScriptName", "ScriptCode");

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 ,
Apr 06, 2016 Apr 06, 2016

ok

many thanks fot this (once again) best response

have a nice day

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 ,
Apr 06, 2016 Apr 06, 2016

There is a trick you can use, but I don't really recommend it unless you're desperate. Document-level JavaScripts are loaded by alphabetical order when the document is opened, so if you add a new document-level JavaScript that has a name that would load after the one that contains the function you want to remove, you can use the doc.addScript method to add a function that has the same name. The one that is loaded last will be the one that's used when it's subsequently called. The problem is you can't count on this alphabetical loading, though it's always been that way with Acrobat/Reader since JavaScript was introduced in version 3.

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 ,
Apr 06, 2016 Apr 06, 2016
LATEST

interresting ! I didn't know how it works.

By the way do you know why empty lines lines are added to my scripts ?

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