Help me to convert or Complete the below CODE

Closed
SANBOOLY Posts 8 Registration date Wednesday March 26, 2014 Status Member Last seen August 21, 2015 - Aug 17, 2015 at 11:01 AM
 Blocked Profile - Aug 21, 2015 at 05:44 PM
Dear All,
kindly i need your help in the below code to convert it from MAC Platform to run this script on windows Platform

the CODE


tell application "Adobe InDesign CS6"
    set myAllPageItems to every text frame of every page of
active document whose overflows is true
    repeat with theItem in myAllPageItems
        tell text frame preferences of theItem
            set auto sizing reference point to top left point
            set use minimum height for auto sizing to true
            set use no line breaks for auto sizing to true
            set auto sizing type to width only
        end tell
    end repeat
end tell
display dialog "Done!"


or of the code has missing tags or something.

waiting your fast reply please.
Related:

3 responses

Blocked Profile
Aug 17, 2015 at 04:59 PM
So, what are running the code in? Build a macro!
0
SANBOOLY Posts 8 Registration date Wednesday March 26, 2014 Status Member Last seen August 21, 2015
Aug 18, 2015 at 05:05 AM
the code is script on Adobe Indesign
0
Blocked Profile
Aug 18, 2015 at 04:47 PM
Ok, well I found this, have a go at it!

https://console.adobe.io/downloads/id

Have FUN!
0
SANBOOLY Posts 8 Registration date Wednesday March 26, 2014 Status Member Last seen August 21, 2015
Aug 19, 2015 at 03:44 AM
it's not helping. as i don't JS development

please could anyone help me to convert this code to work as JS file ?
0
Blocked Profile
Aug 19, 2015 at 04:45 PM
Well, if you do not do JS, then don't! You either do or don't. There is no cut and paste turn key solutions placed here. Besides,,. the scope of your work isn't even mentioned. What are you trying to do? You know, like take a graphic, and make it different size, or cut up or what?
0
SANBOOLY Posts 8 Registration date Wednesday March 26, 2014 Status Member Last seen August 21, 2015
Aug 20, 2015 at 03:11 AM
Dear @ac3mark,
i will explain in more details what i want to be done here.
the code i posted is for MAC platform to run as script on Indesign, the code is working on the text frames in Indesign to expand it to fit the width and height of the text frame with content text.

I Need: to convert this code, to be run as Javascript code or Adobe script (Which the extension of it is .JSX) on windows Platform...

Could this be Done here or anyone helping me. or i should cut the road and stops here and search in somewhere else...!?
0
Blocked Profile
Aug 20, 2015 at 05:25 PM
Once again, no cut and paste turn key solution. We are volunteers, who on our own FREE time, come to help those who are stuck. If you wish to "cut-and-paste" the solution, then yes, you may want to find another Organization that will build your solution for you (certainly not going to be free!). Good luck with that, and HAVE FUN!
0
SANBOOLY Posts 8 Registration date Wednesday March 26, 2014 Status Member Last seen August 21, 2015
Aug 21, 2015 at 03:09 AM
dear @ac3mark,
i knew that we are all volunteers, and we have a gold time. what i'm asked is if anyone can HELP. not to MAKE it for me.
there is wide difference between the 2 words in meaning. any way. i can search in another place to fix this or they can TRY to HELP.
0
Blocked Profile
Aug 21, 2015 at 05:44 PM
to be honest, there is no javascript equivelant to a HOOK into another application, unless that application has AN API! Have you read the adobe documentation on the javascript API for INDESIGN YET?
I hope this helps!
//Set the application default margin preferences.
with (app.marginPreferences){
//Save the current application default margin preferences.
var myY1 = top;
var myX1 = left;
var myY2 = bottom;
var myX2 = right;
//Set the application default margin preferences.
//Document baseline grid will be based on 14 points, and
//all margins are set in increments of 14 points.
top = 14 * 4 + "pt";
left = 14 * 4 + "pt";
bottom = "74pt";
right = 14 * 5 + "pt";
}
//Make a new document.
var myDocument = app.documents.add();
myDocument.documentPreferences.pageWidth = "7i";
myDocument.documentPreferences.pageHeight = "9i";
myDocument.documentPreferences.pageOrientation = PageOrientation.portrait;
//At this point, we can reset the application default margins to their original state.
with (app.marginPreferences){
top = myY1;
left = myX1;
bottom = myY2;
right = myX2;
}
//Set up the bleed and slug areas.
with(myDocument.documentPreferences){
//Bleed
documentBleedBottomOffset = "3p";
documentBleedTopOffset = "3p";
documentBleedInsideOrLeftOffset = "3p";
documentBleedOutsideOrRightOffset = "3p";
//Slug
slugBottomOffset = "18p";
slugTopOffset = "3p";
slugInsideOrLeftOffset = "3p";
slugRightOrOutsideOffset = "3p";
}
//Create a color.
try{
myDocument.colors.item("PageNumberRed").name;
}
catch (myError){
myDocument.colors.add({name:"PageNumberRed", model:ColorModel.process,
colorValue:[20, 100, 80, 10]});
}
//Next, set up some default styles.
//Create up a character style for the page numbers.
try{
myDocument.characterStyles.item("page_number").name;
}
catch (myError){
myDocument.characterStyles.add({name:"page_number"});
}
myDocument.characterStyles.item("page_number").fillColor =
myDocument.colors.item("PageNumberRed");
//Create up a pair of paragraph styles for the page footer text.
//These styles have only basic formatting.
CHAPTER 3: Documents Basic Page Layout 37
try{
myDocument.paragraphStyles.item("footer_left").name;
}
catch (myError){
myDocument.paragraphStyles.add({name:"footer_left", pointSize:11, leading:14});
}
//Create up a pair of paragraph styles for the page footer text.
try{
myDocument.paragraphStyles.item("footer_right").name;
}
catch (myError){
myDocument.paragraphStyles.add({name:"footer_right",
basedOn:myDocument.paragraphStyles.item("footer_left"),
justification:Justification.rightAlign, pointSize:11, leading:14});
}
//Create a layer for guides.
try{
myDocument.layers.item("GuideLayer").name;
}
catch (myError){
myDocument.layers.add({name:"GuideLayer"});
}
//Create a layer for the footer items.
try{
myDocument.layers.item("Footer").name;
}
catch (myError){
myDocument.layers.add({name:"Footer"});
}
//Create a layer for the slug items.
try{
myDocument.layers.item("Slug").name;
}
catch (myError){
myDocument.layers.add({name:"Slug"});
}
//Create a layer for the body text.
try{
myDocument.layers.item("BodyText").name;
}
catch (myError){
myDocument.layers.add({name:"BodyText"});
}
with(myDocument.viewPreferences){
rulerOrigin = RulerOrigin.pageOrigin;
horizontalMeasurementUnits = MeasurementUnits.points;
verticalMeasurementUnits = MeasurementUnits.points;
}
//Document baseline grid and document grid
with(myDocument.gridPreferences){
baselineStart = 56;
baselineDivision = 14;
baselineShown = false;
horizontalGridlineDivision = 14;
horizontalGridSubdivision = 5
verticalGridlineDivision = 14;
verticalGridSubdivision = 5
documentGridShown = false;
}

//Document XMP information.
with (myDocument.metadataPreferences){
author = "Olav Martin Kvern";
copyrightInfoURL = "https://www.adobe.com/";
copyrightNotice = "This document is not copyrighted.";
copyrightStatus = CopyrightStatus.no;
description = "Example 7 x 9 book layout";
documentTitle = "Example";
jobName = "7 x 9 book layout template";
keywords = ["7 x 9", "book", "template"];
var myNewContainer = createContainerItem("http://ns.adobe.com/xap/1.0/", "email");
setProperty("http://ns.adobe.com/xap/1.0/", "email/*[1]", "okvern@adobe.com");
}
//Set up the master spread.
with(myDocument.masterSpreads.item(0)){
with(pages.item(0)){
//Left and right are reversed for left-hand pages (becoming "inside" and
"outside"--
//this is also true in the InDesign user interface).
var myBottomMargin = myDocument.documentPreferences.pageHeight -
marginPreferences.bottom;
var myRightMargin = myDocument.documentPreferences.pageWidth -
marginPreferences.left;
guides.add(myDocument.layers.item("GuideLayer"),
{orientation:HorizontalOrVertical.vertical,location:marginPreferences.right});
guides.add(myDocument.layers.item("GuideLayer"),
{orientation:HorizontalOrVertical.vertical, location:myRightMargin});
guides.add(myDocument.layers.item("GuideLayer"),
{orientation:HorizontalOrVertical.horizontal, location:marginPreferences.top,
fitToPage:false});
guides.add(myDocument.layers.item("GuideLayer"),
{orientation:HorizontalOrVertical.horizontal, location:myBottomMargin,
fitToPage:false});
guides.add(myDocument.layers.item("GuideLayer"),
{orientation:HorizontalOrVertical.horizontal, location:myBottomMargin + 14,
fitToPage:false});
guides.add(myDocument.layers.item("GuideLayer"),
{orientation:HorizontalOrVertical.horizontal, location:myBottomMargin + 28,
fitToPage:false});
var myLeftFooter = textFrames.add(myDocument.layers.item("Footer"), undefined,
undefined, {geometricBounds:[myBottomMargin+14, marginPreferences.right,
myBottomMargin+28, myRightMargin]})
myLeftFooter.parentStory.insertionPoints.item(0).contents =
SpecialCharacters.sectionMarker;
myLeftFooter.parentStory.insertionPoints.item(0).contents =
SpecialCharacters.emSpace;
myLeftFooter.parentStory.insertionPoints.item(0).contents =
SpecialCharacters.autoPageNumber;
myLeftFooter.parentStory.characters.item(0).appliedCharacterStyle =
myDocument.characterStyles.item("page_number");
myLeftFooter.parentStory.paragraphs.item(0).applyStyle(myDocument.paragraphStyles.ite
m("footer_left", false));
//Slug information.
with(myDocument.metadataPreferences){
var myString = "Author:\t" + author + "\tDescription:\t" + description +
"\rCreation Date:\t" + new Date +
"\tEmail Contact\t" + getProperty("http://ns.adobe.com/xap/1.0/",
"email/*[1]");
}

var myLeftSlug = textFrames.add(myDocument.layers.item("Slug"), undefined,
undefined, {geometricBounds:[myDocument.documentPreferences.pageHeight+36,
marginPreferences.right, myDocument.documentPreferences.pageHeight + 144,
myRightMargin], contents:myString});
myLeftSlug.parentStory.tables.add();
//Body text master text frame.
var myLeftFrame = textFrames.add(myDocument.layers.item("BodyText"), undefined,
undefined, {geometricBounds:[marginPreferences.top, marginPreferences.right,
myBottomMargin, myRightMargin]});
}
with(pages.item(1)){
var myBottomMargin = myDocument.documentPreferences.pageHeight -
marginPreferences.bottom;
var myRightMargin = myDocument.documentPreferences.pageWidth -
marginPreferences.right;
guides.add(myDocument.layers.item("GuideLayer"),
{orientation:HorizontalOrVertical.vertical,location:marginPreferences.left});
guides.add(myDocument.layers.item("GuideLayer"),
{orientation:HorizontalOrVertical.vertical, location:myRightMargin});
var myRightFooter = textFrames.add(myDocument.layers.item("Footer"), undefined,
undefined, {geometricBounds:[myBottomMargin+14, marginPreferences.left,
myBottomMargin+28, myRightMargin]})
myRightFooter.parentStory.insertionPoints.item(0).contents =
SpecialCharacters.autoPageNumber;
myRightFooter.parentStory.insertionPoints.item(0).contents =
SpecialCharacters.emSpace;
myRightFooter.parentStory.insertionPoints.item(0).contents =
SpecialCharacters.sectionMarker;
myRightFooter.parentStory.characters.item(-1).appliedCharacterStyle =
myDocument.characterStyles.item("page_number");
myRightFooter.parentStory.paragraphs.item(0).applyStyle(myDocument.paragraphStyles.it
em("footer_right", false));
//Slug information.
var myRightSlug = textFrames.add(myDocument.layers.item("Slug"), undefined,
undefined, {geometricBounds:[myDocument.documentPreferences.pageHeight+36,
marginPreferences.left, myDocument.documentPreferences.pageHeight + 144,
myRightMargin], contents:myString});
myRightSlug.parentStory.tables.add();
//Body text master text frame.
var myRightFrame = textFrames.add(myDocument.layers.item("BodyText"),
undefined, undefined, {geometricBounds:[marginPreferences.top, marginPreferences.left,
myBottomMargin, myRightMargin], previousTextFrame:myLeftFrame});
}
}
//Add section marker text--this text will appear in the footer.
myDocument.sections.item(0).marker = "Section 1";
//When you link the master page text frames, one of the frames sometimes becomes
selected. Deselect it.
app.select(NothingEnum.nothing, undefined);


Is that what you were looking for, as you still have never clearly defined the SCOPE of your project. I understand you wish to convert, but what is the FINAL product you wish to have produced! Something like: "I have a picture. I want to load it, and then shrink it by 50% on both axis."

You have never clearly defined what you wish the code to do! SO, I hope the coding above helps with the syntax and format of javascript. Then go here when you wish to really LEARN it: https://wwwimages2.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/scripting/InDesign_ScriptingGuide_JS.pdf

Have FUN!
0