Disappearing script

New Here ,
Jul 12, 2019

Copy link to clipboard

Copied

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

Views

110

Likes

Translate

Translate

Report

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

Disappearing script

New Here ,
Jul 12, 2019

Copy link to clipboard

Copied

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

Views

111

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 12, 2019 0
Most Valuable Participant ,
Jul 12, 2019

Copy link to clipboard

Copied

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".

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 12, 2019 0
New Here ,
Jul 12, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 12, 2019 0
Most Valuable Participant ,
Jul 13, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 13, 2019 0
New Here ,
Jul 14, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 14, 2019 0
try67 LATEST
Most Valuable Participant ,
Jul 14, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 14, 2019 0