Copy link to clipboard
Copied
Is it possible to send keystrokes to InDesign in a JavaScript script? I want to invoke a menu option and then send the keystrokes for subsequent dialog boxes to automate the execution of the menu option. How can I do this?
Thanks!
Copy link to clipboard
Copied
Hi Dan-BTP,
I think it's possible in Apple Script, to Execute the Export Kindle and Save As Dialog enter "OK" button. You can try the Apple script Key Stroke methods.
thx,
csm_phil
Copy link to clipboard
Copied
Thanks for the suggestion! I'll look into it.
Dan
Copy link to clipboard
Copied
Hi if want use windows, what would be the solutions
Copy link to clipboard
Copied
Autohotkey
And send commands
@dtptutorialycz
Copy link to clipboard
Copied
What exactly are you trying to achieve?
Almost everything that you can set manually - every option in Dialog Boxes - is available directly through scripting.
Copy link to clipboard
Copied
I'm actually looking for the data merge option. For example, open a specific InDesign file, go to Data Merge, select 'Update Data Source,' and then 'Export as PDF'.
I'm familiar with VBA and Java Script only
In the 'Data source' and 'split PDF by page range', I have created a VBA
Copy link to clipboard
Copied
Then this should help you a bit:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#DataMerge.html
Copy link to clipboard
Copied
Need help this code
// Adobe InDesign CC/2020 script that exports all open documents as PDFs using text data from the latest added text frame as the file name.
// Made by Anton "Wyrax" Som, Kyiv, Ukraine, 2020
if (app.documents.length === 0) {
alert('Open documents first.');
} else {
var documentsNumber = app.documents.length;
var myPDFExportPreset = app.pdfExportPresets.item("[Press Quality]"); // Change this to the actual PDF-preset name if error message: Invalid value for parameter 'using' of method 'exportFile'. Expected PDFExportPreset, but received nothing.
var myDocument = app.activeDocument;
var myDataMerge = myDocument.dataMergeProperties;
myDataMerge.updateDataSource();
myDocument.dataMergeProperties.mergeRecords();
//var outputFolder = new Folder('D:/PDFbasket/');
/*if (!outputFolder.exists) {
outputFolder.create();
}*/
for (var i = 0; i < documentsNumber; i++) {
var textFrame = myDocument.textFrames[0];
if (textFrame) {
var fileName = textFrame.contents; // Get text frame content
textFrame.remove();
var outputFile = "C:\Users\Yaser\Desktop\Dummy.pdf"
//var outputFile = new File(outputFolder + "/" + fileName + ".pdf");
myDocument.exportFile(outputFile, myPDFExportPreset);
myDocument.close(SaveOptions.no);
} else {
alert('No text frame found in the document.');
}
}
alert("Exported into " + outputFolder.fsName);
}
Copy link to clipboard
Copied
This code doesn't make much sense...
What kind of help?