Copy link to clipboard
Copied
Our Design department is having a permissions problem with InDesign not creating Lock files on our AFP Server.
I am looking to use an InDesign script that checks if the current file is already in use.
Any help would be appreciated.
Copy link to clipboard
Copied
Is this help?
var doc1=File.openDialog ("Choose your file",true)
try{
app.open(doc1);
}
catch(e){alert("File already opened")}
Copy link to clipboard
Copied
I think you don't need to provoke an error to achieve that.
function checkIfSomeFileIsOpened ( someUrl ) {
var docs = app.documents.everyItem().getElements(),
n = docs.length, docUrl, doc, checkFileUrl = File (someUrl).absoluteURI ;
if ( !n) return false;
while ( n-- ) {
doc = docs
; url = doc.properties.fullName;
if ( File ( url ).absoluteURI == checkFileUrl ) {
return true;
}
}
return false;
}
var url = "/Users/ozalto/Desktop/test1.indd";
checkIfSomeFileIsOpened ( url );