Jazz-y is very good at Photoshop scripting. However the code he posted is missing a comma and did not include the Paint Bucket Tool. So I added the missing comma and added the Paint Bucket Tool and code to make the script a toggle. However, For some reason the Rectangle Marquee Tool's Ant-a;ias is not toggling???
"ToggleAntiAlias.jsx"
#target photoshop;
var s2t = stringIDToTypeID,
c2t = charIDToTypeID,
tools = {
marqueeRectTool: 'MrqA',
marqueeEllipTool: 'MrqA',
lassoTool: 'DrwA',
polySelTool: 'DrwA',
magneticLassoTool: 'DrwA',
magicWandTool: 'WndA',
bucketTool: 'BckA',
},
antiAlias = true;
var desc = new ActionDescriptor(); // Set up Photoshop to remember variables
try {var desc = app.getCustomOptions('antiAlias Toggle');} // Try to get CustomOption for Toggling
catch(e) {
desc.putInteger(0,1); // 1 true
app.putCustomOptions('antiAlias Toggle',desc,false); // Initialize CustomOption for Toggling
}
var Toggle = desc.getInteger(0); // get CustomOption for Toggling
if (Toggle) {
antiAlias = false;
desc.putInteger(0,0);
}
else {
antiAlias = true;
desc.putInteger(0,1);
}
app.putCustomOptions('antiAlias Toggle',desc,false); // CustomOption for Toggling
for (t in tools) {
(d = new ActionDescriptor()).putBoolean(c2t(tools[t]), antiAlias);
(r = new ActionReference()).putClass(s2t(t));
(d1 = new ActionDescriptor()).putReference(s2t('target'), r);
d1.putObject(s2t('to'), s2t('target'), d);
executeAction(s2t('set'), d1, DialogModes.NO);
}