To lock text Frame through CSV file input
i want to lock the lock the textframe even wise. But i input will be getting from csv file. ex if i enter 3;9 that particular page textFrame only lock.
How to do. pls could anyone tell me.
i want to lock the lock the textframe even wise. But i input will be getting from csv file. ex if i enter 3;9 that particular page textFrame only lock.
How to do. pls could anyone tell me.
The following should do the trick:
if (app.documents.length > 0) {
var myDocument = app.activeDocument;
main();
} else {
alert("Please open a document");
}
function main () {
var myFile = File.openDialog("Choose the file containing the semicolon separeted page list");
var myResult = myFile.open("r", undefined, undefined);
if(myResult == true){
var myFileContent = myFile.read();
var myPageLockArray = myFileContent.split(";");
alert(myPageLockArray);
for (i = 0; i < myPageLockArray.length; i++) {
var myPageNum = myPageLockArray - 1;
try {
var myPage = myDocument.pages[myPageNum];
var myTextFrame = myPage.textFrames[0]; // Assuming there is only one textframe on the page
myTextFrame.locked = true;
} catch (e) {
alert(e);
}
}
myFile.close();
}
}
--
Thomas B. Nielsen
http://www.nobrainer.dk
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.