Copy link to clipboard
Copied
Hi everyone,
I posted this very same question about a month ago but I got no reply so I thought I'd try again. Even if I can't obtain a free script that will do what I need, I'm happy to look at paying for one if someone can point me in the right direction.
I'm looking for a script that will target the stroke weight in tables and change them to a lighter weight, eg. from 0.5pt to 0.3pt.
I have a script that targets the fill at the following url:
http://forums.adobe.com/thread/681944
...but I'm looking for one that targets the stroke.
Just wondering if anyone might know where I can find one?
Thanks
Copy link to clipboard
Copied
Hi Poster,
I have modifed the the Jongware JS code, I have inlcuded the Stroke weight options onto the dialog box.
Please check the below JS code.
myDialog = app.dialogs.add ({name:"Recolor Tables",canCancel:true});
swatchlist = app.activeDocument.swatches.everyItem().name;
with (myDialog)
{
with (dialogColumns.add())
{
with (borderPanels.add())
{
staticTexts.add ({staticLabel:"Find"});
swf = dropdowns.add ({stringList:swatchlist, selectedIndex:0});
tbf = percentComboboxes.add({editValue:100, largeNudge:10, stringList:["25", "50", "75", "100"] });
tbfStrk = measurementEditboxes.add({editValue:0.5});
}
with (borderPanels.add())
{
staticTexts.add ({staticLabel:"Replace"});
swr = dropdowns.add ({stringList:swatchlist, selectedIndex:0});
tbr = percentComboboxes.add({editValue:100, largeNudge:10, stringList:["25", "50", "75", "100"] });
tbrStrk = measurementEditboxes.add({editValue:0.33});
}
with (borderPanels.add())
{
dostrokes = checkboxControls.add({staticLabel:"Change strokes", checkedState:true});
dofills = checkboxControls.add({staticLabel:"Change fills", checkedState:true});
}
}
}
if (!myDialog.show() || !(dostrokes.checkedState || dofills.checkedState))
{
myDialog.destroy();
exit(0);
}
findtint = tbf.editValue;
findStrk = tbfStrk.editValue;
findswatch = app.activeDocument.swatches.item(swf.selectedIndex);
changetint = tbr.editValue;
changeStrk = tbrStrk.editValue;
changeswatch = app.activeDocument.swatches.item(swr.selectedIndex);
strokes = dostrokes.checkedState;
fills = dofills.checkedState;
fillchanges = 0;
strokechanges = 0;
st = app.activeDocument.stories;
for (s=0; s<st.length; s++)
{
tb = st
.tables;for (t=0; t<tb.length; t++)
{
tab = tb
; for (c=0; c<tab.cells.length; c++)
{
if (fills && tab.cells
.fillColor == findswatch && tab.cells .fillTint == findtint) {
fillchanges++;
tab.cells
.properties = {fillColor:changeswatch, fillTint:changetint}; }
if (strokes)
{
s = false;
if (tab.cells
.topEdgeStrokeColor == findswatch && tab.cells .topEdgeStrokeTint == findtint && tab.cells .topEdgeStrokeWeight == findStrk) {
s = true;
tab.cells
.properties = {topEdgeStrokeColor:changeswatch, topEdgeStrokeTint:changetint, topEdgeStrokeWeight:changeStrk}; }
if (tab.cells
.bottomEdgeStrokeColor == findswatch && tab.cells .bottomEdgeStrokeTint == findtint && tab.cells .bottomEdgeStrokeWeight == findStrk) {
s = true;
tab.cells
.properties = {bottomEdgeStrokeColor:changeswatch, bottomEdgeStrokeTint:changetint, bottomEdgeStrokeWeight:changeStrk}; }
if (tab.cells
.leftEdgeStrokeColor == findswatch && tab.cells .leftEdgeStrokeTint == findtint && tab.cells .leftEdgeStrokeWeight == findStrk) {
s = true;
tab.cells
.properties = {leftEdgeStrokeColor:changeswatch, leftEdgeStrokeTint:changetint, leftEdgeStrokeWeight:changeStrk}; }
if (tab.cells
.rightEdgeStrokeColor == findswatch && tab.cells .rightEdgeStrokeTint == findtint && tab.cells .rightEdgeStrokeWeight == findStrk) {
s = true;
tab.cells
.properties = {rightEdgeStrokeColor:changeswatch, rightEdgeStrokeTint:changetint, rightEdgeStrokeWeight:changeStrk}; }
if (s)
strokechanges++;
}
}
}
}
ch = "No changes made";
if (fillchanges)
{
ch = fillchanges+" fills changed";
if (strokechanges)
ch += "\n"+strokechanges+" strokes changed";
} else if (strokechanges)
ch = strokechanges+" strokes changed";
alert (ch);
thx
csm_phil
Copy link to clipboard
Copied
Hello.
I am having a little trouble with this script. I have Indesign cs 5.5 and the script work for the first 3 table then the mouse just spins for hours and never does more then 3 tables on a page no matter how long i wait. The sequence seems to be that it does the first table, skips the second then does the third then goes back and does the second then stops. Can you please tell me how to fix this or post the modified code. Thank you in advance. I really appreciate it.
Copy link to clipboard
Copied
Hi Livingmedia,
I have modified the above js code, Please check.
myDialog = app.dialogs.add ({name:"Recolor Tables",canCancel:true});
swatchlist = app.activeDocument.swatches.everyItem().name;
with (myDialog)
{
with (dialogColumns.add())
{
with (borderPanels.add())
{
staticTexts.add ({staticLabel:"Find"});
swf = dropdowns.add ({stringList:swatchlist, selectedIndex:0});
tbf = percentComboboxes.add({editValue:100, largeNudge:10, stringList:["25", "50", "75", "100"] });
tbfStrk = measurementEditboxes.add({editValue:0.5});
}
with (borderPanels.add())
{
staticTexts.add ({staticLabel:"Replace"});
swr = dropdowns.add ({stringList:swatchlist, selectedIndex:0});
tbr = percentComboboxes.add({editValue:100, largeNudge:10, stringList:["25", "50", "75", "100"] });
tbrStrk = measurementEditboxes.add({editValue:0.33});
}
with (borderPanels.add())
{
dostrokes = checkboxControls.add({staticLabel:"Change strokes", checkedState:true});
dofills = checkboxControls.add({staticLabel:"Change fills", checkedState:true});
}
}
}
if (!myDialog.show() || !(dostrokes.checkedState || dofills.checkedState))
{
myDialog.destroy();
exit(0);
}
findtint = tbf.editValue;
findStrk = tbfStrk.editValue;
findswatch = app.activeDocument.swatches.item(swf.selectedIndex);
changetint = tbr.editValue;
changeStrk = tbrStrk.editValue;
changeswatch = app.activeDocument.swatches.item(swr.selectedIndex);
strokes = dostrokes.checkedState;
fills = dofills.checkedState;
fillchanges = 0;
strokechanges = 0;
tb = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
for (t=tb.length-1; t>=0; t--)
{
tab = tb
; for (c=0; c<tab.cells.length; c++)
{
if (fills && tab.cells
.fillColor == findswatch && tab.cells .fillTint == findtint) {
fillchanges++;
tab.cells
.properties = {fillColor:changeswatch, fillTint:changetint}; }
if (strokes)
{
s = false;
if (tab.cells
.topEdgeStrokeColor == findswatch && tab.cells .topEdgeStrokeTint == findtint && tab.cells .topEdgeStrokeWeight == findStrk) {
s = true;
tab.cells
.properties = {topEdgeStrokeColor:changeswatch, topEdgeStrokeTint:changetint, topEdgeStrokeWeight:changeStrk}; }
if (tab.cells
.bottomEdgeStrokeColor == findswatch && tab.cells .bottomEdgeStrokeTint == findtint && tab.cells .bottomEdgeStrokeWeight == findStrk) {
s = true;
tab.cells
.properties = {bottomEdgeStrokeColor:changeswatch, bottomEdgeStrokeTint:changetint, bottomEdgeStrokeWeight:changeStrk}; }
if (tab.cells
.leftEdgeStrokeColor == findswatch && tab.cells .leftEdgeStrokeTint == findtint && tab.cells .leftEdgeStrokeWeight == findStrk) {
s = true;
tab.cells
.properties = {leftEdgeStrokeColor:changeswatch, leftEdgeStrokeTint:changetint, leftEdgeStrokeWeight:changeStrk}; }
if (tab.cells
.rightEdgeStrokeColor == findswatch && tab.cells .rightEdgeStrokeTint == findtint && tab.cells .rightEdgeStrokeWeight == findStrk) {
s = true;
tab.cells
.properties = {rightEdgeStrokeColor:changeswatch, rightEdgeStrokeTint:changetint, rightEdgeStrokeWeight:changeStrk}; }
if (s)
strokechanges++;
}
}
}
ch = "No changes made";
if (fillchanges)
{
ch = fillchanges+" fills changed";
if (strokechanges)
ch += "\n"+strokechanges+" strokes changed";
} else if (strokechanges)
ch = strokechanges+" strokes changed";
alert (ch);
thx,
csm_phil
Copy link to clipboard
Copied
This made my day!! You rock mister!
Copy link to clipboard
Copied
This is a great script, and have used it often, is it possible to select on stroke colour/weight
And change another parameter such as cell width or even the first cell width
Copy link to clipboard
Copied
This script worked but in some document i get this error
Copy link to clipboard
Copied
Hi tamilp60445270 ,
provide the document to the scripter so that the code can be debugged.
Also see that in the last 5 years InDesign tables were enhanced with graphic cells.
Does your table contain graphic cells?
Regards,
Uwe
Copy link to clipboard
Copied
Yes, it contain graphic cell. Sure, i can share the document https://drive.google.com/open?id=1T0U-Nvahiq0J7i4uT-bfCK8Po8Y0gZ8X