Strict Standards: Only variables should be passed by reference in /home/abeall/public_html/fireworks/download.php on line 28

Warning: Cannot modify header information - headers already sent by (output started at /home/abeall/public_html/fireworks/download.php:28) in /home/abeall/public_html/fireworks/download.php on line 44
var dom = fw.getDocumentDOM(); var sel = [].concat(fw.selection); try{ SelectSimilarObjects(); }catch(e){ alert([e, e.lineNumber, e.fileName].join("\n")+'\n\nPlease report this error to abeall.com') }; function SelectSimilarObjects(){ if(!dom) return; if(!sel.length) return alert('Select at least one object first.'); // user input var input, opts = {}; do{ input = prompt('Select similar objects by:\n[F]ill, [S]troke, [D]imensions, [P]osition, [O]pacity, [E]ffects, [N]ame, Object [T]ype. Match [A]ll Properties, Search Current [L]ayer Only',fw.SelectSimilarObjects_input||'FS A'); if(input == null) return false; }while(!validate()); function validate(){ opts.input = input.toUpperCase(); opts.fill = opts.input.indexOf('F')!=-1; opts.stroke = opts.input.indexOf('S')!=-1; opts.dimensions = opts.input.indexOf('D')!=-1; opts.position = opts.input.indexOf('P')!=-1; opts.opacity = opts.input.indexOf('O')!=-1; opts.effects = opts.input.indexOf('E')!=-1; opts.name = opts.input.indexOf('N')!=-1; opts.element = opts.input.indexOf('T')!=-1; opts.all = opts.input.indexOf('A')!=-1; opts.layer = opts.input.indexOf('L')!=-1; if(opts.all && sel.length > 1) return alert('You cannot choose to match all properties with more than one object selected, because nothing will have properties from two different objects. '); if(!opts.fill && !opts.stroke && !opts.dimensions && !opts.position && !opts.opacity && !opts.effects && !opts.name && !opts.element) return alert('Invalid input!'); return true; } fw.SelectSimilarObjects_input = input; // define similarity properties // define fills var pa; if(opts.fill){ opts.fill = []; for(var s in sel){ pa = sel[s].pathAttributes; if(pa && pa.fill){ opts.fill.push({ fillColor:pa.fillColor, name:pa.fill.name, gradient:getGradient(pa.fill.gradient), pattern:getPattern(pa.fill.pattern) }); }else if(pa){ opts.fill.push(null); } } if(!opts.fill.length) opts.fill = false; } // define strokes if(opts.stroke){ opts.stroke = []; for(var s in sel){ pa = sel[s].pathAttributes; if(pa && pa.brush){ opts.stroke.push({ brushColor:pa.brushColor, name:pa.brush.name, diameter:pa.brush.diameter }); }else if(pa){ opts.stroke.push(null); } } if(!opts.stroke.length) opts.stroke = false; } // define dimensions if(opts.dimensions){ opts.dimensions = []; for(var s in sel) opts.dimensions.push({width:sel[s].width,height:sel[s].height}); } // define positions if(opts.position){ opts.position = []; for(var s in sel) opts.position.push({left:sel[s].left,top:sel[s].top}); } // define opacities if(opts.opacity){ opts.opacity = []; for(var s in sel) opts.opacity.push(sel[s].opacity); } // define effect lists if(opts.effects){ opts.effects = []; for(var s in sel){ opts.effects.push(null); if(sel[s].effectList){ opts.effects[opts.effects.length-1] = {effects:null}; if(sel[s].effectList.effects && sel[s].effectList.effects.length){ opts.effects[opts.effects.length-1].effects = []; for(var e in sel[s].effectList.effects) opts.effects[opts.effects.length-1].effects.push({name:sel[s].effectList.effects[e].name,category:sel[s].effectList.effects[e].category}); } } } } // define names (use element type if element name is null) if(opts.name){ opts.name = []; for(var s in sel) opts.name.push(sel[s].name||String(sel[s])); } // define element types if(opts.element){ opts.element = []; for(var s in sel) opts.element.push(String(sel[s])); } // now select based on the defined properties var elem, selectElems = []; for(var l in dom.layers){ if(opts.layer && Number(l) != dom.currentLayerNum) continue; for(var e in dom.layers[l].frames[dom.currentFrameNum].elements){ elem = dom.layers[l].frames[dom.currentFrameNum].elements[e]; if(doSelectSimilar()) selectElems.push(elem); } } function doSelectSimilar(){ // select by fill if(opts.fill){ for(var i in opts.fill){ if(opts.fill[i] == null){ // no fill if(elem.pathAttributes && elem.pathAttributes.fill == null){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } }else if(opts.fill[i].gradient){ // gradient if(elem.pathAttributes && elem.pathAttributes.fill && elem.pathAttributes.fill.name == opts.fill[i].name && compareGradients(elem.pathAttributes.fill.gradient,opts.fill[i].gradient)){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } }else if(opts.fill[i].pattern){ // pattern if(elem.pathAttributes && elem.pathAttributes.fill && elem.pathAttributes.fill.pattern && comparePatterns(elem.pathAttributes.fill.pattern,opts.fill[i].pattern)){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } }else{ // solid if(elem.pathAttributes && elem.pathAttributes.fill && elem.pathAttributes.fillColor == opts.fill[i].fillColor && !elem.pathAttributes.fill.gradient && !elem.pathAttributes.fill.pattern){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } } } } // select by stroke if(opts.stroke && elem.pathAttributes){ for(var i in opts.stroke){ if(opts.stroke[i] != null){ // stroke if(elem.pathAttributes && elem.pathAttributes.brush && elem.pathAttributes.brushColor == opts.stroke[i].brushColor && compareBrushes(elem.pathAttributes.brush,opts.stroke[i])){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } }else{ // no stroke if(elem.pathAttributes && elem.pathAttributes.brush == null){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } } } } // select by size if(opts.dimensions){ for(var i in opts.dimensions){ if(elem.width == opts.dimensions[i].width && elem.height == opts.dimensions[i].height){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } } } // select by position if(opts.position){ for(var i in opts.position){ if(elem.left == opts.position[i].left && elem.top == opts.position[i].top){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } } } // select by opacity if(opts.opacity){ for(var i in opts.opacity){ if(elem.opacity == opts.opacity[i]){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } } } // select by effects if(opts.effects){ for(var i in opts.effects){ if(compareEffects(elem.effectList,opts.effects[i])){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } } } // select by name if(opts.name){ for(var i in opts.name){ if((elem.name||String(elem)) == opts.name[i]){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } } } // select by element type if(opts.element){ for(var i in opts.element){ if(String(elem) == opts.element[i]){ if(!opts.all){ return true; break; } }else if(opts.all){ return false; } } } // select if all properties matched if(opts.all) return true; } // select any found elements fw.selection = sel.concat(selectElems); } function getGradient(gradient){ if(!gradient) return false; var grad = {}; grad.nodes = []; for(var n in gradient.nodes) grad.nodes[n] = {position:gradient.nodes[n].position,color:gradient.nodes[n].color}; grad.opacityNodes = []; for(var n in gradient.opacityNodes) grad.opacityNodes[n] = {position:gradient.opacityNodes[n].position,color:gradient.opacityNodes[n].color}; return grad; } function getPattern(pattern){ if(!pattern) return false; return {name:pattern.name,image:pattern.image}; } function compareGradients(g1,g2){ for(var n in g1.nodes){ if(g1.nodes[n].color != g2.nodes[n].color || g1.nodes[n].position != g2.nodes[n].position) return false; } for(var n in g1.opacityNodes){ if(g1.opacityNodes[n].color != g2.opacityNodes[n].color || g1.opacityNodes[n].position != g2.opacityNodes[n].position) return false; } return true; } function comparePatterns(p1,p2){ return p1.name == p2.name && p1.image == p2.image; } function compareBrushes(b1,b2){ return b1.name == b2.name && b1.diameter == b2.diameter; } function compareEffects(e1,e2){ if(e1==null && e2==null) return true; if(e1 == null || e2 == null) return false; if(e1.effects == null && e2.effects == null) return true; if(e1.effects.length == e2.effects.length){ for(var e in e1.effects){ if(e1.effects[e].name != e2.effects[e].name || e1.effects[e].category != e2.effects[e].category) return false } }else{ return false; } return true; }