Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Opening attachment with script


Level 1


I apologize for my bad English. I have problem with openning attach in acrobat reader. I am using this script:


//insert or remove attach
var oObj = event.target;
oDate = new Date();
idAttach = String(oDate.getTime()); //create uniquely id of attach

if (this.caption.value.resolveNode("#text").value == "Insert")
//insert attach
if (oObj.importDataObject(idAttach)==1) //show dialog "Open file" for choose attach and selected fole setup "name" on value id
  attachId.rawValue = idAttach; //insert ID  value to memory field
    this.caption.value.resolveNode("#text").value = "Remove"; //setup new value for button
  paperclip.icon.presence="visible"; //setup visible
  this.assist.resolveNode("#toolTip").value="remove attach"; //setup tooltip
//remove attach
oObj.removeDataObject(attachId.rawValue); //remove attach with ID
attachId.rawValue = ""; //inicialize memory field for ID
this.caption.value.resolveNode("#text").value = "Insert"; //setup new value for button
paperclip.icon.presence="invisible"; //setup invisible
this.assist.resolveNode("#toolTip").value="insert attach"; //setup tooltip


  var oObj = event.target;
var fileName = oObj.getDataObject(attachId.rawValue).path;

ret = xfa.host.messageBox("Name of inserted file: "+fileName+"\r\n\r\nWould you like to open?", "Attach", 2, 2);

if (ret==4)
oObj.exportDataObject({ cName: attachId.rawValue, nLaunch: 2 }); //open attach

When is form not secured by password in acrobat proffesional and reader extensions are applied all is working good. But when is form secured by password a and reader extensions are applied. If i would to open attachment,  reader ask me if i would like to open attachment. I can choose yes or no. When i choose yes, nothing happen. But when i open attachment via attachment viewer, all is working good.

I don't know how fix it. Can somebody help to me ?



0 Replies