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

How to use script to open a folder on desktop?

Contributor ,
Jul 17, 2014 Jul 17, 2014

Copy link to clipboard

Copied

Hi, everyone

I want open a folder on desktop after gen PDF but error, can someone help me to fix it?


var f = new Folder(“~/Desktop/Revised_PDF put in here/”); 
f.create();

var doc = app.documents; 
app.findTextPreferences = null; 
app.findTextPreferences.underline = true; 
for(var i=0;i<doc.length;i++) 

        var found = doc.findText(); 
        var _pages = []; 
        for(var j=0;j<found.length;j++) 
        { 
                var txfms = found.texts[0].parentTextFrames; 
                for(var k=0;k<txfms.length;k++) 
                { 
                        _pages.push(txfms.parentPage.name); 
                    } 
            } 
        for(var j=0;j<_pages.length;j++) 
        { 
                if(_pages === _pages[j-1]) 
                { 
                        _pages.splice(j,1); 
                    } 
            } 
        if(_pages.length != 0) 
        { 
                app.pdfExportPreferences.pageRange = _pages.toString(); 
                doc.exportFile(ExportFormat.PDF_TYPE, new File(“~/Desktop/Revised_PDF put in here/” + doc.name.replace(/\.indd$/i,”.pdf”)), false);
            } 
        _pages = []; 
    } 
app.findTextPreferences = null;


folder.open(“~/Desktop/Revised_PDF put in here/”)  // <-----------this line error

John

TOPICS
Scripting

Views

338

Translate

Translate

Report

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

correct answers 1 Correct answer

Guru , Jul 17, 2014 Jul 17, 2014

#target indesign

var f = Folder( Folder.desktop + '/Testing' );

if ( ! f.exists ) { f.create(); };

f.execute();

Wow this thing for pasting syntax is now SHITE… CAN'T see it have to load the go back and edit C&P only works half the time…

Votes

Translate

Translate
Guru ,
Jul 17, 2014 Jul 17, 2014

Copy link to clipboard

Copied

The method to open a Folder Object as if clicked in the UI is Folder.execute();

Votes

Translate

Translate

Report

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
Contributor ,
Jul 17, 2014 Jul 17, 2014

Copy link to clipboard

Copied

Hi,

I have tried, but not work

what is the syntax?  John

Votes

Translate

Translate

Report

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
Guru ,
Jul 17, 2014 Jul 17, 2014

Copy link to clipboard

Copied

#target indesign

var f = Folder( Folder.desktop + '/Testing' );

if ( ! f.exists ) { f.create(); };

f.execute();

Wow this thing for pasting syntax is now SHITE… CAN'T see it have to load the go back and edit C&P only works half the time…

Votes

Translate

Translate

Report

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
Contributor ,
Jul 17, 2014 Jul 17, 2014

Copy link to clipboard

Copied

LATEST

Hi, Mark

thanks

John

Votes

Translate

Translate

Report

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