Highlighted

Compare file Name between InDD & PDF - APPLESCRIPT

Enthusiast ,
Nov 17, 2020

Copy link to clipboard

Copied

Hi All,

 

How do we find out the different or unique file names between ".indd" and ".pdf" extensions. 

 

My request is need to popup if any file name different between InDesign and PDF.

 

Screenshot 2020-11-17 at 6.58.49 PM.png

 

Thanks

SS

TOPICS
Scripting

Views

46

Likes

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

Compare file Name between InDD & PDF - APPLESCRIPT

Enthusiast ,
Nov 17, 2020

Copy link to clipboard

Copied

Hi All,

 

How do we find out the different or unique file names between ".indd" and ".pdf" extensions. 

 

My request is need to popup if any file name different between InDesign and PDF.

 

Screenshot 2020-11-17 at 6.58.49 PM.png

 

Thanks

SS

TOPICS
Scripting

Views

47

Likes

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
Nov 17, 2020 0
Adobe Community Professional ,
Nov 17, 2020

Copy link to clipboard

Copied

Try this Javascript :

var inddFolder = "C:/Users/r.sunil/Desktop/TestNames/Indd";
var pdfFolder = "C:/Users/r.sunil/Desktop/TestNames/PDF";
var allInddFiles = Folder(inddFolder).getFiles ("*.indd");
var allPdfFiles = Folder(pdfFolder).getFiles ("*.pdf");
var inddNames = [];
var pdfNames = [];
for(var i = 0; i < allPdfFiles.length; i++){
    pdfNames.push(allPdfFiles[i].name);
    }
pdfNames = pdfNames.sort();
for(var i = 0; i < allInddFiles.length; i++){
    inddNames.push(allInddFiles[i].name);
    }
inddNames = inddNames.sort();
for(var i = 0; i < inddNames.length; i++){
    var match = false;
    for(var j = 0; j < pdfNames.length; j++){
        if(inddNames[i].replace(/\.indd/g,'').toLowerCase() == pdfNames[j].replace(/\.pdf/g,'').toLowerCase()){
            match = true;
            pdfNames.splice (j, 1);
            break;
            }
        }
    if(match){
        inddNames.splice (i, 1);
        i--;
        }
    }
if(inddNames.length > 0){
    var textMsg = "This is list of InDesign Files with no match : \r"+inddNames.toString().replace(/%20/g,' ').replace(/,|/g,'\n\t');
    }
else{
    var textMsg = "All Indd Files matched."
    }
if(pdfNames.length > 0){
    textMsg = textMsg+"\nThis is list of PDF Files with no match : \r"+pdfNames.toString().replace(/%20/g,' ').replace(/,/g,'\n\t')
    }
else{
    textMsg = textMsg+"\nAll Pdf Files matched."
    }
alert(textMsg);

Best

Sunil

Likes

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
Reply
Loading...
Nov 17, 2020 0
rob day LATEST
Adobe Community Professional ,
Nov 17, 2020

Copy link to clipboard

Copied

The Finder returns a file’s name and extension when you get the name property. This gets the name with no extension:

 

set the f to (choose file with prompt "Choose a file.")
set theName to my getName(f)

--returns the file name with no extension
on getName(f)
	tell application "Finder"
		set n to name of f --gets the name of the file including its extension
		set e to name extension of f --gets the file’s extension
		set c to (count of e) + 2
		return text 1 thru -c of n
	end tell
end getName

Likes

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
Reply
Loading...
Nov 17, 2020 0