Making tiles Script
Copy link to clipboard
Copied
I am trying to make a script that makes an image into a tile.
Like this:
But after a lot of puzzling I end up with this:
The corner images are not flipped correct, so the images in the corner are not lining up with the rest.
Can any of you amazing scripters help me out???
This is my script (sorry if this is very amateurish, but I have no clue what I am doing when it comes to scripts):
app.copy()
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_LEFT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_LEFT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_CENTER_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_CENTER_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.layoutWindows[0].transformReferencePoint = AnchorPoint.RIGHT_CENTER_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_LEFT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.layoutWindows[0].transformReferencePoint = AnchorPoint.LEFT_CENTER_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
Copy link to clipboard
Copied
Hi,
As a starter, did you check your pattern because just looking at it, it looks like that it's not perfectly aligned.
So it's possible your script just works fine but the issue is in the pattern, maybe ?
Apart from that, your script repeats a lot of similar stuff and calls some menu methods you should generally avoid (paste).
Loic
Copy link to clipboard
Copied
@Loic.Aigon Making a pattern of an image is to flip it all sides so it will look like image 2 (on the first line next to the image I start with). The end result should look like image 2, but my script makes it into image 3 (last one).
@jump_over Your script works like a charm! Although I would prefer the original image to be in the centre.
To explain the reason I want to have this script: I have to add bleed on artwork that is uploaded to our system by designers/customers that have no or little to no knowledge of how to make artwork suitable for a printer. The Simplest way to make a bleed (that would be cut away by the printer anyway) is to copy and flip the artwork around it (making it almost like the tile, but figured the tile explanation would be more easy to understand my goal)
In the meantime I kept on tweaking my script and I found the solution (yes with a ton of repeating lines, but it does work). The reason for the corner images to be in the wrong flipped way was I flipped the images "absolute". Which I think means, flip using the original image in mind. So removing "absolute" and the script does what it supposed to do for me. Maybe not a beauty like yours Jarek, but oh well, indesign seems to accept it.
Thanks again Jarek, I will save your script as well as it is a great written script and I am sure it will come in handy one day.
For those reading this thread in the future, this is my code now:
app.copy()
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_LEFT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_LEFT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_CENTER_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_CENTER_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.layoutWindows[0].transformReferencePoint = AnchorPoint.RIGHT_CENTER_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.pasteInPlace();
app.layoutWindows[0].transformReferencePoint = AnchorPoint.BOTTOM_LEFT_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
app.layoutWindows[0].transformReferencePoint = AnchorPoint.LEFT_CENTER_ANCHOR;
for ( var x = 0; x < app.selection.length; x++ ){
app.selection
}
Copy link to clipboard
Copied
Hi,
Select startObject and try this (mSize = 3 means a square 3x3):
var
cObj = app. selection[0],
hObj = cObj, vObj,
mSize = 3,
h=mSize, v,
mGB = cObj.geometricBounds,
mLine = [cObj];
while (h-->0) {
vObj = hObj;
v = mSize-1;
while (v--) {
vObj = vObj.duplicate();
vObj.move(undefined, [0, mGB[2] - mGB[0]]);
vObj.flipItem(Flip.VERTICAL, AnchorPoint.CENTER_ANCHOR);
}
if (!h) break;
hObj = hObj.duplicate();
hObj.move(undefined, [mGB[3] - mGB[1],0]);
hObj.flipItem(Flip.HORIZONTAL, AnchorPoint.CENTER_ANCHOR);
}
Jarek
Copy link to clipboard
Copied

