Help with a javascript - need the name of the document file name when exporting

When I run this script:

var myPresets = app.pdfExportPresets.everyItem () .name;

myPresets.unshift ("- select preset-");

var myWin = new window ("dialog", "PDF Export Presets'");

myWin.orientation = "row";

{with (myWin)}

myWin.sText = Add ("' statictext ', undefined, ' select PDF Export preset :');)

myWin.myPDFExport = add('dropdownlist',undefined,undefined,{items:myPresets});)

myWin.myPDFExport.selection = 10;

myWin.btnOK = Add ('button', undefined, "OK");

};

myWin.center ();

myWindow var = myWin.show ();

If (myWindow == true & & myWin.myPDFExport.selection.index! = 0) {}

var myPreset = app.pdfExportPresets.item (String (myWin.myPDFExport.selection));

myFile = lead (File.saveDialog ("save the file with preset:" + myPreset.name, "PDF files: *.pdf"));

If (myFile! = null) {}

app.activeDocument.exportFile (ExportFormat.PDF_TYPE, myFile, false, myPreset);

} else {}

Alert ("no file selected");

}

} else {}

Alert ("no predefined PDF selected");

}

I need to place the filname document automatically when the dialog box "Save as" appears:

Udklip.PNG

Can someone help me?

Use this:

myPath = app.activeDocument.filePath + '/' + app.activeDocument.name.replace (/\.indd$/, '.pdf');
myFile = File(myPath).saveDlg("Save file with preset: " + myPreset.name,"PDF files: *.pdf");

Peter

Tags: InDesign

Similar Questions

Maybe you are looking for

  • Windows keep minimizing and reopening

    I have an HP runing p2-1394 Windows 8.1 My windows mininize and reopen all few seconds, the cursor blinks constantly. In fact, it is not the slider, is the blue circle behind the cursor blinking. Can someone help me?

  • iTunes will not find any information for the CD already in the library when reuploading of lossless

    I'm downloading all my CDs to iTunes in the form of files without loss. All of them are currently in my library as mp3s. Why iTunes can't recognize and fill in all the information for me, I have more than 2000 download, many of them are collections o

  • Satellite C650 - Ripping from cd to hard drive is not possible

    Hope someone can help with my problem of not being able to extract more than 16 tracks from the cd to my satellite C650 laptop hard drive.I tried windows media player, media library and dbpoweramp cd ripper. There is no problem with ripping of CD wit

  • Problems with my windows xp pro windows setup program!

    I don't speak it at all so this is. I have windows XP Pro and Iam trying to upgrade my fedex ship manager with a new version, but after I downloaded the software update of fedex.com windows error message install stands up and says EXACTLY this: the w

  • PhotoSmart C309g-m

    Upgrade to Win7 64-bit operating system. The printer is successfully installed. Cannot find the interface software. On Vista, I had an icon on my desktop that allowed me to Setup scans, etc. Is that a another download and install the software & print