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

Disappearing script

Community Beginner ,
Jul 12, 2019 Jul 12, 2019

After entering a Custom Keystroke Script in the edit box, the script works but it disappears from the edit box when revisiting the format properties.

It is also not shown in the "Edit All Scripts" lists of scripts.

Even after saving the file and opening it again, the script is gone but still works.

Using Acrobat Pro DC 2019.012.20035

Note: There is no Custom Format Script; only a Custom Keystroke Script.

How can I view the Custom Keystroke Script again and update it?

Thanks

TOPICS
Acrobat SDK and JavaScript , Windows
1.0K
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 ,
Jul 12, 2019 Jul 12, 2019

This happens when you include specific strings that the application thinks are a part of an internal code that is used for the built-in Keystroke commands. It then attempts to display the matching option in the GUI and hides the code. I think it should still be available via Edit All JavaScripts, though...

If you didn't use an undocumented JS method then you can overcome this issue by making sure your code doesn't contain the string "AF".

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 Beginner ,
Jul 12, 2019 Jul 12, 2019

Thank you try67.

Here is the sccript.

if(!event.willCommit){ 

num=AFMergeChange(event);

num=NumToWordsInt(num);

this.getField("Output").value=num;

}

It updates the output box with converted number.

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 ,
Jul 13, 2019 Jul 13, 2019

The use of the AFMergeChange function is what's causing it to happen.

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 Beginner ,
Jul 14, 2019 Jul 14, 2019

Thank you. Is there a way to avoid using a function call within the Keystroke script and obtain the same result.

I want to call the NumToWorsInt() function on a keypress to dynamically convert the number in another box.

Thanks again.

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 ,
Jul 14, 2019 Jul 14, 2019
LATEST

Put all of that code in a function under a doc-level script and then just place a call that function from the event itself. I believe that should solve it.

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