Skip to main content
Inspiring
April 3, 2025
Answered

Abort a sequence action Button

  • April 3, 2025
  • 2 replies
  • 890 views

Thanks to all in advance.

I have a sequence action button that I want to abort after answering NO to an Alert answer generated by a script.

The problem is that every choice you make (YES or NOT) the actions button go on (it seems a known issue).

I tried to split actions in 2 button, the first with just alert script and the second (hidden) with all other action that goes in excecution by the script clicking YES.

Bur here is another problem: Acrobat seems does't permit excecution button by script.

Does anyone have a brilliant idea?

Correct answer try67

try {
this.saveAs();
} catch(e) {
console.println("⚠️ Salvataggio non eseguito: " + e.message);
}


Since you're not specifying a file-name you can replace it with this, which should work even without a trusted function:

 

app.execMenuItem("SaveAs");

2 replies

try67
Community Expert
Community Expert
April 3, 2025

Do you mean multiple commands that are associated with a button field's Mouse Up event, for example?

If so, that's not possible. You have to do the entire thing in a single script, and then you'll have control over it.

@Thom Parker's reply above relates to an Action, which is a batch process that you run via the Action Wizard tool. There you can indeed abort the entire process using the command provided, but it doesn't work with different types of commands that are under a button.

Inspiring
April 4, 2025

Thanks for answer but unfortunately I need the action manu "save as" and I can't sosbstitute it by script because the form is password protected level 3 anche the "save as" command via script isn't accepted, instead via action menu yes.

Bernd Alheit
Community Expert
Community Expert
April 4, 2025

Use a trusted function for saveAs in the script.

Thom Parker
Community Expert
Community Expert
April 3, 2025

The Action sequence will abort if event.rc is set to false in a "Run a JavaScript" command. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Inspiring
April 4, 2025

Thanks for answer but if You have multiple action in the same button the false setting abort just the script but not the next action.