Script – Custom Commands

Save As

Purpose of this command is to save file to alternate or predefined folder.

function ShortFileName(name)
{
  local index=name.rfind("\\");
  if(!index)
    index=name.rfind("/");
  if(index){
    name=name.slice(index+1);
    return name;
  }
  return "document.priPrinter";
}

local doc=window.GetDocument();
local sub=doc.GetNumSubDocs();
if(sub)
{
  local filename;
  if(0){
    // save to predefined location
    local short= ShortFileName(sub.filename);
    filename="z:\\archive\\"+short;
  }else {
    // save to same folder
    filename=sub.filename;
  }
  filename=window.SaveFileDialog(filename,"priPrinter Documents (*.priPrinter )|*.priPrinter")
  if(filename)
    window.SaveAs(filename);
}

It’s possible to create custom button which will execute this script.

See Results:

Custom Save Button

All samples