Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Keystrokes to InDesign via script

Explorer ,
Oct 31, 2013 Oct 31, 2013

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!

TOPICS
Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 31, 2013 Oct 31, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 01, 2013 Nov 01, 2013

Thanks for the suggestion! I'll look into it.

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Hi if want use windows, what would be the solutions

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 29, 2023 Nov 29, 2023

Autohotkey

And send commands

@dtptutorialycz

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2023 Nov 29, 2023

What exactly are you trying to achieve? 

 

Almost everything that you can set manually - every option in Dialog Boxes - is available directly through scripting. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 29, 2023 Nov 29, 2023

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2023 Nov 30, 2023
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 30, 2023 Nov 30, 2023

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);
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2023 Dec 01, 2023
LATEST

This code doesn't make much sense... 

 

What kind of help? 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines