Article View: adobe.scripting.indesign
Article #307help jsx -> VB
From: oblok
Date: Wed, 25 Mar 2009 19:12
Date: Wed, 25 Mar 2009 19:12
112 lines
3703 bytes
3703 bytes
hi,
how this script remake to vb language ??
f (app.documents.length != 0) {
result = buildBooklet(app.documents[0]);
if (result != null) {
alert(result);
}
}
function buildBooklet() {
var myPages = app.documents[0].pages;
if (myPages.length % 4 != 0) {
return("Document length isn't a multiple of four.");
}
if (app.documents[0].modified) {
if (confirm("Document has unsaved changes. Click OK to save them and proceed.")){
app.documents[0].save(app.documents[0].fullName);
} else {
return null;
}
}
if (app.version == 3) {
app.userInteractionLevel = UserInteractionLevels.neverInteract;
} else {
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
}
var myFN = app.documents[0].fullName;
var myName = app.documents[0].name;
var n = 0;
var myTN = app.documents[0].filePath + "/" + myName.split(".indd")[0] + n + ".indt";
while (File(myTN).exists) {
n++;
myTN = app.documents[0].filePath + "/" + myName.split(".indd")[0] + n+ ".indt";
}
app.documents[0].save(File(myTN),true);
app.documents[0].close();
app.open(File(myTN));
File(myTN).remove();
if (app.version == 3) {
app.userInteractionLevel = UserInteractionLevels.interactWithAll;
} else {
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
}
app.documents[0].documentPreferences.allowPageShuffle = false;
for (i=0; myPages.length > i; i++) {
var origSection = myPages[i].appliedSection;
var origNumbering = origSection.pageNumberStyle;
origSection.pageNumberStyle = PageNumberStyle.arabic;
var pageName = myPages[i].name;
var sectName = origSection.name;
if (sectName != "") {
var testPageName = pageName.split(sectName)[1];
if (testPageName != null) {
pageName = testPageName;
}
}
var pageNo = Number(pageName);
if (app.version == 3){
newSection = app.documents[0].sections.add(undefined, undefined, {
pageStart:app.documents[0].pages[i],
continueNumbering:false,
pageNumberStart:pageNo,
pageNumberStyle:origNumbering,
marker: origSection.marker,
name: origSection.name
});
origSection.pageNumberStyle = origNumbering;
} else {
newSection = app.documents[0].sections.add({
pageStart:app.documents[0].pages[i],
continueNumbering:false,
pageNumberStart:pageNo,
pageNumberStyle:origNumbering,
marker: origSection.marker,
name: origSection.name
});
origSection.pageNumberStyle = origNumbering;
}
}
app.documents[0].documentPreferences.allowPageShuffle = true;
for (i=0; (myPages.length/2)>i; i++){
if (i % 2 == 0) {
app.documents[0].pages[myPages.length - 1].move(LocationOptions.before,app.documents[0].pages[i*2],BindingOptions.leftAlign);
} else {
app.documents[0].pages[myPages.length - 1].move(LocationOptions.after,app.documents[0].pages[i*2],BindingOptions.rightAlign);
}
}
app.activeDocument.textPreferences.zOrderTextWrap = !app.activeDocument.textPreferences.zOrderTextWrap;
app.activeDocument.textPreferences.zOrderTextWrap = !app.activeDocument.textPreferences.zOrderTextWrap;
}
thx
Technical Details
Message-ID:
<59b8686c.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,ca7d0bf35bea6b4a,start X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: oblok@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: help jsx -> VB Message-ID: <59b8686c.-1@webcrossing.la2eafNXanI> Date: Wed, 25 Mar 2009 12:12:55 -0700 Lines: 117 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit