Dimensions of a lens hood - making your own

I want to make my own lens hoods. How do I figure out the appropriate dimensions for the hood? I assume there are different formulas for petal, round, and rectangle hoods.
MY EQUIPMENT:
EOS Rebel T4i
EF-S 18-55mm f/3.5-5.6 IS II
EF-S 55-250mm f/4-5.6 IS II
(2) B+W 5.8 010 UV - Haze 1x MRC (F - PRO Series filter)
HOYA 58mm HMC Multi-Coated ND8 Filter

Well you could do all of that but unless you already own the materials I think it's going to cost more than ready made ones that fit properly & can be reversed for storage / lens cap installation. I say this as someone with a lot of experience working with fiberglass and who has fabricated many things using it. Here's the link to a DIY project for my underwater camera.
http://plus.google.com/photos/116179596240613012497/albums/5161077059071628785?banner=pwa
And this is a slightly bigger project I'm working on (it's my day job).
http://plus.google.com/photos/116179596240613012497/albums/5352917643688876417?banner=pwa
"A skill is developed through constant practice with a passion to improve, not bought."

Similar Messages

  • Making Your Own Map Component in crystal xcelsius

    Post Author: sunbrain
    CA Forum: Xcelsius and Live Office
    http://www.liwaili.com.cn support
    http://www.liwaili.com.cn support
    http://www.liwaili.com.cn support
    Making Your Own Map Component in crystal xcelsius
    Although the Map components in Crystal Xcelsius are cool, your choice ofmaps is severely limited. This might leave you wondering how you can createyour own Map components in Crystal Xcelsius. Although there is no way totechnically make a Map component, you do have a workaround that you canuse to create interactivity based on your own maps.As an example, I created the dashboard in Figure 13-25 to report on popula-tion data for the five counties in Rhode Island. In this dashboard, movingyour mouse from county to county changes the data that displays.
    Take a closer look at this dashboard to see that the map is nothing more thanan Image component that has a few Icon Selector components on top. Hereu2019show it works:1. Import an image of the map by adding an Image component onto yourdashboard and selecting the image using the Filename property, asshown in Figure 13-26.
    2. Add Icon Selectors on each point in the map where you want interactivity.These icon selectors provide the hot spot areas on your map (seeFigure 13-27): that is, the areas that give you interactivity at run-time.
    3. Expand the selectors to ensure that you optimize the hot spots on yourmap. (See Figure 13-28.)You can expand the Icon selectors by clicking on the bounding box han-dles and dragging them until the selector is the appropriate size andshape. Expanding the size of the selectors reduces the chance of hittingdead spots that donu2019t have interactivity at run-time.
    At this point, the icon selectors can be given some functionality basedon some scenario, but thatu2019s not your focus here. The point is that afteryou configure the icon selectors with some functionality, you haveessentially added interactivity to your map.Time for smoke and mirrors.4. Make the icon selectors invisible so that only the map is showing bygoing to the Appearance tab and adjusting the Transparency propertyto 0, as shown in Figure 13-29.The final effect is a custom map that has interactivity.
    Keep in mind that you can use this technique with any image; it doesnu2019t have tobe a map per se. For instance, you can use this technique with organizationalcharts, floor plans, park maps, and various types of diagrams. Incorporatingpictures into your dashboards in this way can help you add something extrato your dashboards.
    liwaili.com.cn
    http://www.liwaili.com.cn support

    Post Author: sam pewgo
    CA Forum: Xcelsius and Live Office
    Hiit is rather disappointing that one can not import maps into crystal xcelsius as this is my main operation, the alternative approach that you so in great detail, whilst it works is not sutable for the tasks I carryout. I have access to all the maps for our operations and some are quite detailed, however I cannot use them? becuase your programme cannot import them. Is there a tool or method that you guys use to get the maps in to crystal xcelsius that you would be willing to share, as I would hate to have to find an alternative product to do that job Thnx Sam

  • Help with making your own theme... (question)

    I have a Imovie HD 6.0.3, I wanted to make my own theme. The other themes are great, but i want to create my own, so I could show to make friends. I cant find anything related with making a new theme. PLEASE, PLEASE, PLEASE help me...

    Hi
    As Klaus1 writes - or taking the full step over to FinalCut.
    Here there is no themes in Express and a few title themes in FC Pro.
    BUT - When You master it - You can make nearly anything You like.
    Except themes - ready to be imported into iMovie - This require even more skill
    and very special tools eg to make the drop zones etc.
    Your - Using FCE/P and loving it Bengt W

  • Uploading photos to other websites , like Ebay and Making your own playing cards, is not working. It was, now it is not. I have emptied cache, updated Adobe, but I really do not want to change browsers. 3 yr old MACBook Pro. Suggestions?

    The uploader that allows me to uplaod my photos from Iphoto is no longer working consistantly. WHen I have a sight that where I am supposed to " CLICK HERE TO ADD PHOTOS"   and I click, nothing happens. Sometimes after 45 seconds it might open up the IPhoto page but then the page is frozen and the cursor can't activate any thing on the page. I cannot  scroll down the photos , make a selection or close the page. Another 60 seconds may goby and then the IPhoto site will close.
    I use it for Ebay and also things like uploading  photos for making photobooks and playing cards. I have done quite a bit to try and sort this out and I am at a loss. Not really very computer smart either!  Emptied cache,restarted,checked security,looked at Java....and called Ebay for help. I really do not want to add another browser, like FireFox, as I didi that before and it interferred with the MAIL account. Any suggestions?
    I have a 3 year old MAcBook Pro...and of course my telephone assistance has expired.
    Thanks for any response.

    The uploader that allows me to uplaod my photos from Iphoto is no longer working consistantly. WHen I have a sight that where I am supposed to " CLICK HERE TO ADD PHOTOS"   and I click, nothing happens. Sometimes after 45 seconds it might open up the IPhoto page but then the page is frozen and the cursor can't activate any thing on the page. I cannot  scroll down the photos , make a selection or close the page. Another 60 seconds may goby and then the IPhoto site will close.
    I use it for Ebay and also things like uploading  photos for making photobooks and playing cards. I have done quite a bit to try and sort this out and I am at a loss. Not really very computer smart either!  Emptied cache,restarted,checked security,looked at Java....and called Ebay for help. I really do not want to add another browser, like FireFox, as I didi that before and it interferred with the MAIL account. Any suggestions?
    I have a 3 year old MAcBook Pro...and of course my telephone assistance has expired.
    Thanks for any response.

  • Making Your Own Map Component in crystal xcelsius 2008

    Post Author: sam pewgo
    CA Forum: Xcelsius and Live Office
    It was disappointing that one could not make or import users own maps into CX 4.5has this issue been resolved in CX 2008?? Thanks in advanceSam

    Post Author: sam pewgo
    CA Forum: Xcelsius and Live Office
    Thanks DHAGIts a shame that we have hundreds of our own maps that we cannot use in Xcelsius and we are reluctant to buy any more, especially when they are none proprietory types, we need to use maps such as ESRI, MAPINFO or DWG types. Business Objects already know this of course as their Crystal Reports communicates with ESRI Arcview/ArcGis mapping products.Please update this product to use these, or make piece of software that will allow us to make our own map components and import them into XcelsiusAPART from my little blast! that said its a great productSam

  • Now draw your own ScriptUIGraphics graphics! (1st testing)

    Hey everyone, I've made this little system of drawing ScriptUIGraphics from your illustrator document.  Please be advised, the graphics resulting from this are not anti-aliased and look bad at medium sizes --> terrible at small sizes, but they may help with making some dynamic icons for some really specific scriptUI purposes.
    Basically, you just draw something in an AI doc, run this window and use the function from it as well as the object resource string to recreate that drawing in your own scriptUI windows.
    This method only uses straight lines and ellipses when it detects ellipses.  After seeing the quality of these drawings, I'm thinking for the prettier icons you'd surely want to embed images into your UI, but there may come a very very rare time when there exists a need for some dynamic image with many states, so this may be what it may end up perhaps being useful for.
    Attached are screenshots with original drawing (artboard is 100x100px), the captured image drawn in window and last, pretty much the same- is the result drawn from object resource string.  The screenshots JPEGs have smoothed out the little icons, making them look actually better than they really are!
    Edit: 
         Oh yes, I did need to mention: the colors used can be any color, spot/Lab included!  They just get changed to some version of RGB for rendering.
    // ScriptUI Graphics Display by Vasily
    function graphicsDisplay(){
        function itemShape(myShape){
            // Going to test for circles.
            var shapeKind={
                isrectangle: null,
                iscircle: null,
                isellipse: null
            if(myShape.typename=='PathItem' && myShape.pathPoints.length == 4){ // RECTANGLE CHECKER
                //--------------------2 diagonals-------------------------
                var recEquaDistOne = parseInt(Math.pow((myShape.pathPoints[0].anchor[0] - myShape.pathPoints[2].anchor[0]),2) +
                Math.pow((myShape.pathPoints[0].anchor[1] - myShape.pathPoints[2].anchor[1]),2)); // diagonal
                var recEquaDistTwo = parseInt(Math.pow((myShape.pathPoints[1].anchor[0] - myShape.pathPoints[3].anchor[0]),2) +
                Math.pow((myShape.pathPoints[1].anchor[1] - myShape.pathPoints[3].anchor[1]),2)); // diagonal
                //---------------------4 sides of rectangle---------------
                var sideA = parseInt(Math.pow((myShape.pathPoints[0].anchor[0] - myShape.pathPoints[1].anchor[0]),2) +
                Math.pow((myShape.pathPoints[0].anchor[1] - myShape.pathPoints[1].anchor[1]),2)); 
                var sideB = parseInt(Math.pow((myShape.pathPoints[1].anchor[0] - myShape.pathPoints[2].anchor[0]),2) +
                Math.pow((myShape.pathPoints[1].anchor[1] - myShape.pathPoints[2].anchor[1]),2)); 
                var sideC = parseInt(Math.pow((myShape.pathPoints[2].anchor[0] - myShape.pathPoints[3].anchor[0]),2) +
                Math.pow((myShape.pathPoints[2].anchor[1] - myShape.pathPoints[3].anchor[1]),2)); 
                var sideD = parseInt(Math.pow((myShape.pathPoints[3].anchor[0] - myShape.pathPoints[0].anchor[0]),2) +
                Math.pow((myShape.pathPoints[3].anchor[1] - myShape.pathPoints[0].anchor[1]),2)); 
                if(recEquaDistOne == recEquaDistTwo){ // If two diagonals connecting opposite points are same length, it's a 90 degree box               
                    if((sideA == sideC) && (sideB == sideD)){
                        for(var j=0; j<4; j++){
                            var point = myShape.pathPoints[j];             
                                if((point.leftDirection[0] == point.anchor[0]) &&
                                    (point.anchor[0] == point.rightDirection[0]) &&
                                    (point.leftDirection[1] == point.anchor[1]) &&
                                    (point.anchor[1] == point.rightDirection[1])){                                                   
                                    shapeKind.isrectangle = true;
                                } else {
                                    shapeKind.isrectangle = false;
                                    break;
                if(myShape.pathPoints.length == 4){  // CIRCLE CHECKER
                    if(shapeKind.isrectangle == false || shapeKind.isrectangle == null){
                        var circlePts = new Array();
                        var circleSlopes = new Array();
                        for (k=0; k<4; k++){
                        var point = myShape.pathPoints[k]; 
                        var leftHandleDist = parseInt(Math.pow((point.leftDirection[0] - point.anchor[0]),2) +
                        Math.pow((point.leftDirection[1] - point.anchor[1]),2));
                        var rightHandleDist = parseInt(Math.pow((point.rightDirection[0] - point.anchor[0]),2) +
                        Math.pow((point.rightDirection[1] - point.anchor[1]),2));
                        circlePts.push(leftHandleDist, rightHandleDist);
                        var leftHandleSlope = ((point.leftDirection[0] - point.anchor[0])/(point.leftDirection[1] - point.anchor[1])).toFixed(2);
                        var rightHandleSlope = ((point.rightDirection[0] - point.anchor[0])/(point.rightDirection[1] - point.anchor[1])).toFixed(2);
                        circleSlopes.push(leftHandleSlope, rightHandleSlope);
                    for(var f=0; f<8; f++){ // Allows non-rotated circles.
                        if(circleSlopes[f] == "-0.00"){
                            circleSlopes[f] = "0.00";
                        if(circleSlopes[f] == "-Infinity"){
                            circleSlopes[f] = "Infinity";
                    var cirEquaDistOne = parseInt(Math.pow((myShape.pathPoints[0].anchor[0] - myShape.pathPoints[2].anchor[0]),2) +
                    Math.pow((myShape.pathPoints[0].anchor[1] - myShape.pathPoints[2].anchor[1]),2));
                    var cirEquaDistTwo = parseInt(Math.pow((myShape.pathPoints[1].anchor[0] - myShape.pathPoints[3].anchor[0]),2) +
                    Math.pow((myShape.pathPoints[1].anchor[1] - myShape.pathPoints[3].anchor[1]),2));
                    if(circleSlopes[0] != "NaN"){ // Filters out asymmetric rhombus  <><><>^^^^^^<><><>
                        if((circlePts[0] == circlePts[1]) && // Filters out shapes with control handles not of equal distance from anchor point.
                            (circlePts[1] == circlePts[2]) &&
                            (circlePts[2] == circlePts[3]) &&
                            (circlePts[3] == circlePts[4]) &&
                            (circlePts[4] == circlePts[5]) &&
                            (circlePts[5] == circlePts[6]) &&
                            (circlePts[6] == circlePts[7]) &&
                            (circlePts[7] == circlePts[0])){
                            if((circleSlopes[0] == circleSlopes[1]) && // Filters out the equadistant 4-pointed Star shape (dismisses negative slopes).
                                (circleSlopes[2] == circleSlopes[3]) &&
                                (circleSlopes[4] == circleSlopes[5]) &&
                                (circleSlopes[6] == circleSlopes[7])){
                                if(cirEquaDistOne == cirEquaDistTwo){ // Filters out Ellipses (non-equadistant circles).
                                    // Filters out the very RARE 4-pointed star which has all control points in its center on top of each other!
                                    if(((myShape.pathPoints[0].leftDirection[0]).toFixed(2) != (myShape.pathPoints[1].leftDirection[0]).toFixed(2)) &&
                                        ((myShape.pathPoints[0].leftDirection[1]).toFixed(2) != (myShape.pathPoints[1].leftDirection[1]).toFixed(2))){
                                        shapeKind.iscircle = true;
                                    } else {
                                        shapeKind.iscircle = false;
                        } else {
                            if((circlePts[0]==circlePts[1]) &&
                                (circlePts[2]==circlePts[3]) &&
                                ((circlePts[4]==circlePts[5]) && (circlePts[4]==circlePts[1]) && (circlePts[5]==circlePts[1])) &&
                                ((circlePts[6]==circlePts[7]) && (circlePts[6]==circlePts[2]) && (circlePts[7]==circlePts[3]))){
                                shapeKind.isellipse=true;
        //~                     $.writeln(circlePts[0]+'\r'+circlePts[1]+'\r'+circlePts[2]+'\r'+circlePts[3]+'\r'+
        //~                     circlePts[4]+'\r'+circlePts[5]+'\r'+circlePts[6]+'\r'+circlePts[7]);
            return shapeKind;
        if(app.name=='Adobe Illustrator' && app.documents.length>0){
            function round2(num){
                return Math.round(num*100)/100;
            function convertToUIRGB(color){
                if(color=='[CMYKColor]'){
                    var c=color.cyan, m=color.magenta, y=color.yellow, k=color.black;
                    return [
                        round2((1-(c/100))*(1-(k/100))),
                        round2((1-(m/100))*(1-(k/100))),
                        round2((1-(y/100))*(1-(k/100)))
                } else if(color=='[GrayColor]'){
                    var k=color.gray;
                    var grayValue=1-(Math.round(((k/100)*255)*100)/100)/255;
                    return [grayValue,grayValue,grayValue];
                } else if(color=='[GradientColor]'){
                    $.writeln('Sorry, no gradient colors please.');
                    return [0,0,0];
                } else if(color=='[PatternColor]'){
                    $.writeln('Sorry, no pattern colors please.');
                    return [0,0,0,];
                } else if(color=='[SpotColor]'){
                    var clr=color.spot.getInternalColor();
                    if(color.spot.spotKind==SpotColorKind.SPOTCMYK){
                        var c=clr[0], m=clr[1], y=clr[2], k=clr[3];
                        return [
                            round2((1-(c/100))*(1-(k/100))),
                            round2((1-(m/100))*(1-(k/100))),
                            round2((1-(y/100))*(1-(k/100)))
                    } else if(color.spot.spotKind==SpotColorKind.SPOTRGB){
                        return [round2(clr[0]/255), round2(clr[1]/255), round2(clr[2]/255)];
                    } else if(color.spot.spotKind==SpotColorKind.SPOTLAB){
                        var clr=color.spot.getInternalColor();
                        var whiteRef={
                            D65: {X: 95.047,Y: 100, Z: 108.883},
                            D50: {X: 96.422,Y: 100, Z: 82.521},
                        var illuminant='D65';
                        var Y = (clr[0]+16)/116;
                        var X = clr[1]/500+Y;
                        var Z = Y-clr[2]/200;
                        if(Math.pow(Y,3) > 0.008856){Y=Math.pow(Y,3);}
                        else {Y = (Y-16/116)/7.787;}
                        if(Math.pow(X,3) > 0.008856){X=Math.pow(X,3);}
                        else {X = (X-16/116)/7.787;}
                        if(Math.pow(Z,3) > 0.008856){Z=Math.pow(Z,3);}
                        else {Z = (Z-16/116)/7.787;}
                        X*=whiteRef[illuminant].X,Y*=whiteRef[illuminant].Y,Z*=whiteRef[illuminant].Z;
                        //alert(X+" "+Y+" "+Z);
                        X/=100,Y/=100,Z/=100;
                        R=X*3.2406+Y*-1.5372+Z*-0.4986;
                        G=X*-0.9689+Y*1.8758+Z*0.0415;
                        B=X*0.0557+Y*-0.2040+Z*1.0570;
                        //alert(R+" "+G+" "+B);
                        if(R > 0.0031308){R=(1.055*(Math.pow(R,(1/2.4))))-0.055;}
                        else {R*= 12.92;}
                        if(G > 0.0031308){G=(1.055*(Math.pow(G,(1/2.4))))-0.055;}
                        else {G*= 12.92;}
                        if(B > 0.0031308){B=(1.055*(Math.pow(B,(1/2.4))))-0.055;}
                        else {B*= 12.92;}
                        if(R<0){R=0} else if(R>1){R=1};
                        if(G<0){G=0} else if(G>1){G=1};
                        if(B<0){B=0} else if(B>1){B=1};
                        return [round2(R),round2(G),round2(B)];
                } else if(color=='[RGBColor]'){
                    return [round2(color.red/255), round2(color.green/255), round2(color.blue/255)];
            function drawFromObjString(objString, canvasArea){
               function round2(num){
                   return Math.round(num*100)/100;
                var obj=eval(objString);
                var canvas=canvasArea.graphics;
                var counter=obj.total;
                while(counter>=0){
                    for(all in obj){
                        if(all.match(/\d{1,2}$/g) && all.match(/\d{1,2}$/g)==counter){
                            var thisShp=obj[all];
                            if(thisShp.ellipsePath!=true){
                                var vectorPts=thisShp.pathPoints;
                                canvas.newPath(); canvas.moveTo(thisShp.pathPoints[0][0],thisShp.pathPoints[0][1]);
                                for(var j=0; j<vectorPts.length; j++){
                                    var thisAnchor=vectorPts[j];
                                    var x=thisAnchor[0], y=thisAnchor[1];
                                    canvas.lineTo(x,y);
                                if(thisShp.closed==true){
                                    canvas.closePath();
                            } else {
                                var cirPts=thisShp.pathPoints;
                                canvas.newPath();
                                canvas.ellipsePath(cirPts[0], cirPts[1], cirPts[2], cirPts[3]);
                                canvas.closePath();
                            if(thisShp.fillColor!=null){
                                var clr=thisShp.fillColor;
                                var myBrush=canvas.newBrush(canvas.BrushType.SOLID_COLOR,clr);
                                canvas.fillPath(myBrush);
                            if(thisShp.strokeColor!=null){
                                var clr=thisShp.strokeColor;
                                var myPen=canvas.newPen(canvas.PenType.SOLID_COLOR,[clr[0],clr[1],clr[2],1], thisShp.strokeWidth);
                                canvas.strokePath(myPen);
                    counter-=1;
            var doc=app.activeDocument;
            if(doc.height<=400 && doc.width<=600){
                doc.rulerOrigin=[0,doc.height];
                doc.coordinateSystem=CoordinateSystem.DOCUMENTCOORDINATESYSTEM;
                var wDims=function(){
                    var dims={width: '', height: ''};
                    if(doc.width>220){
                        dims.width = Math.round(doc.width);
                    } else {
                        dims.width = 220;
                    if(doc.height>20){
                        dims.height = Math.round(doc.height);
                    } else {
                        dims.height = 20;
                    return dims;
                function drawCapture(vectors, dataDisplay, graphicDisplay){
                    // draws a preview and creates a drawing data object resource.
                    var drawData={total:0}; //Put drawing shapes here.  Properties: stroke (rgb color | null), fill (rgb color | null), pathPoints
                    var canvas=graphicDisplay.graphics;
                    for(var i=vectors.length-1; i>-1; i--){
                        var thisShp=vectors[i];
                        if((thisShp.filled || thisShp.stroked) && thisShp.editable==true){
                            drawData.total++;
                            drawData['shape_'+i]={};
                            drawData['shape_'+i].fillColor=null;
                            drawData['shape_'+i].strokeColor=null;
                            drawData['shape_'+i].pathPoints=[];
                            drawData['shape_'+i].ellipsePath=false;
                            if(itemShape(thisShp).iscircle==true || itemShape(thisShp).isellipse==true || thisShp.name=='ellipse' ||
                                thisShp.name=='circle' || thisShp.name=='cir'){
                                drawData['shape_'+i].ellipsePath=true;
                                drawData['shape_'+i].pathPoints=[thisShp.left, -thisShp.top, thisShp.width, thisShp.height];
                                canvas.newPath();
                                canvas.ellipsePath(thisShp.left, -thisShp.top, thisShp.width, thisShp.height);
                            } else {
                                var vectorPts=thisShp.pathPoints;
                                canvas.newPath(); canvas.moveTo(Math.round(vectorPts[0].anchor[0]),-Math.round(vectorPts[0].anchor[1]));
                                for(var j=0; j<vectorPts.length; j++){
                                    var thisAnchor=vectorPts[j].anchor;
                                    var x=Math.round(thisAnchor[0]), y=-Math.round(thisAnchor[1]);
                                    drawData['shape_'+i].pathPoints.push([x,y]);
                                    canvas.lineTo(x,y);
                            if(thisShp.closed || drawData['shape_'+i].ellipsePath==true){
                                drawData['shape_'+i].closed=true;
                                if(drawData['shape_'+i].ellipsePath!=true){
                                    canvas.closePath();
                            } else {
                                drawData['shape_'+i].closed=false;
                            if(thisShp.filled){
                                var clr=thisShp.fillColor;
                                var colorArray=convertToUIRGB(clr);
                                var myBrush=canvas.newBrush(canvas.BrushType.SOLID_COLOR,colorArray);
                                drawData['shape_'+i].fillColor=colorArray;
                                canvas.fillPath(myBrush);
                            if(thisShp.stroked){
                                var clr=thisShp.strokeColor;
                                var colorArray=convertToUIRGB(clr);
                                var myPen=canvas.newPen(canvas.PenType.SOLID_COLOR,[colorArray[0],colorArray[1],colorArray[2],1], Math.round(thisShp.strokeWidth));
                                drawData['shape_'+i].strokeColor=colorArray;
                                drawData['shape_'+i].strokeWidth=Math.round(thisShp.strokeWidth);
                                canvas.strokePath(myPen);
                    return drawData;
                function showDrawerFunc(objStringDisplay, wDims){
                    var w2=new Window('dialog','Drawer Function');
                    var containerG=w2.add('tabbedpanel');
                        var funcG=containerG.add('tab',undefined,'Drawer Function');
                            var dispE=funcG.add('edittext',undefined,funcSrc,{multiline:true}); dispE.size=[580,200];
                            var selBtn=funcG.add('button',undefined,'Select All');
                        var drawingG=containerG.add('tab',undefined,'Drawing:');
                            var drawG=drawingG.add('group');
                                var drawP=drawG.add('panel',undefined,''); drawP.size=[wDims.width, wDims.height];
                    var msgCntr=w2.add('panel',undefined,'Message Center:');
                        var msgE=msgCntr.add('edittext',undefined,'',{multiline:true});msgE.size=[560,40];
                    var btnG=w2.add('group');
                        var okBtn=btnG.add('button',undefined,'Ok',{name: 'ok'});
                    selBtn.onClick=function(){
                        dispE.active=false; dispE.active=true;
                    drawG.onDraw=function(){
                        if(objStringDisplay.text!=''){
                            try{
                                drawFromObjString(objStringDisplay.text, this);
                            } catch(e){
                                msgE.text=("Something isn't right:\r"+e);
                        } else {
                            msgE.text=('You must first put a valid object string into the object string display area--> "Get Source Object String" button, 1st window, 1st tab.');
                    w2.show();
                function instructions(){
                    var w3=new Window('dialog','instructions');
                    var instructions=w3.add('edittext',undefined,'',{multiline:true}); instructions.size=[400,100];
                    instructions.text="1)  Have a document open, smaller than 600x400.\r\r"+
                        "2)  Draw some stuff- use paths only, straight lines or ellipses only. To have script explicitly recognize ellipse, "+
                        "label the path 'cir', 'circle', or 'ellipse'. Right now there's a function to detect ellipses, but it is coarse.\r\r"+
                        "3)  Run this script and see if your drawing was captured below this box.\r\r"+
                        "4)  Click the 'Get Object String' button and see the drawing instruction string appear.\r\r"+
                        "5)  Click the 'View Drawer Function/Drawing' button to see the function used to draw scriptUI picture from"+
                        " the object string and use other tab to see the drawing made with this function from that object string.\r\r"+
                        "6)  Edit your string to see your picture change if needed!";
                    var okBtn=w3.add('button',undefined,'OK');
                    w3.show();
                var funcSrc=drawFromObjString.toSource();
                var dispWindow=function(){
                    var drawData;
                    var w=new Window('dialog','ScriptUI Graphics Display');
                    var panel=w.add('panel',undefined,''); panel.size=[wDims.width+6,wDims.height+6];
                    var list=w.add('edittext',undefined,'',{multiline:true}); list.size=[wDims.width,150];
                    var btnsG=w.add('group');
                        var clickBtn=btnsG.add('button',undefined,'Get Source Object String');
                        var selectBtn=btnsG.add('button',undefined,'Select All');
                    var btnG2=w.add('group');
                        var funcBtn=btnG2.add('button',undefined,'See Drawer Function/Drawing');
                        funcBtn.helpTip='Uses the Object String picture info to draw using ScriptUIGraphics lineTo commands.';
                        var helpBtn=btnG2.add('button',undefined,'?'); helpBtn.size=[25,25];
                    panel.onDraw=function(){
                        drawData=drawCapture(doc.pathItems, list, this);
                    clickBtn.addEventListener('mousedown',function(){
                        list.text=drawData.toSource();
                    funcBtn.onClick=function(){
                        showDrawerFunc(list, wDims);
                    helpBtn.onClick=function(){
                        instructions();
                    selectBtn.onClick=function(){
                        list.active=false; list.active=true;
                    var okBtn=w.add('button',undefined,'OK');
                    w.show();
            } else {
                alert('Please use a document with main artboard no larger than 600x400.');
        } else {
            alert('Must run in Illustrator with at least 1 document open.');
    graphicsDisplay();

    New-er update to this:
    // ScriptUI Graphics Display by Vasily
    #target illustrator
    function graphicsDisplay(){
        function itemShape(myShape){
            // Going to test for circles.
            var shapeKind={
                isrectangle: null,
                iscircle: null,
                isellipse: null
            if(myShape.typename=='PathItem' && myShape.pathPoints.length == 4){ // RECTANGLE CHECKER
                //--------------------2 diagonals-------------------------
                var recEquaDistOne = parseInt(Math.pow((myShape.pathPoints[0].anchor[0] - myShape.pathPoints[2].anchor[0]),2) +
                Math.pow((myShape.pathPoints[0].anchor[1] - myShape.pathPoints[2].anchor[1]),2)); // diagonal
                var recEquaDistTwo = parseInt(Math.pow((myShape.pathPoints[1].anchor[0] - myShape.pathPoints[3].anchor[0]),2) +
                Math.pow((myShape.pathPoints[1].anchor[1] - myShape.pathPoints[3].anchor[1]),2)); // diagonal
                //---------------------4 sides of rectangle---------------
                var sideA = parseInt(Math.pow((myShape.pathPoints[0].anchor[0] - myShape.pathPoints[1].anchor[0]),2) +
                Math.pow((myShape.pathPoints[0].anchor[1] - myShape.pathPoints[1].anchor[1]),2)); 
                var sideB = parseInt(Math.pow((myShape.pathPoints[1].anchor[0] - myShape.pathPoints[2].anchor[0]),2) +
                Math.pow((myShape.pathPoints[1].anchor[1] - myShape.pathPoints[2].anchor[1]),2)); 
                var sideC = parseInt(Math.pow((myShape.pathPoints[2].anchor[0] - myShape.pathPoints[3].anchor[0]),2) +
                Math.pow((myShape.pathPoints[2].anchor[1] - myShape.pathPoints[3].anchor[1]),2)); 
                var sideD = parseInt(Math.pow((myShape.pathPoints[3].anchor[0] - myShape.pathPoints[0].anchor[0]),2) +
                Math.pow((myShape.pathPoints[3].anchor[1] - myShape.pathPoints[0].anchor[1]),2)); 
                if(recEquaDistOne == recEquaDistTwo){ // If two diagonals connecting opposite points are same length, it's a 90 degree box               
                    if((sideA == sideC) && (sideB == sideD)){
                        for(var j=0; j<4; j++){
                            var point = myShape.pathPoints[j];             
                                if((point.leftDirection[0] == point.anchor[0]) &&
                                    (point.anchor[0] == point.rightDirection[0]) &&
                                    (point.leftDirection[1] == point.anchor[1]) &&
                                    (point.anchor[1] == point.rightDirection[1])){
                                    shapeKind.isrectangle = true;
                                } else {
                                    shapeKind.isrectangle = false;
                                    break;
                if(myShape.pathPoints.length == 4){  // CIRCLE CHECKER
                    if(shapeKind.isrectangle == false || shapeKind.isrectangle == null){
                        var circlePts = new Array();
                        var circleSlopes = new Array();
                        for (k=0; k<4; k++){
                        var point = myShape.pathPoints[k]; 
                        var leftHandleDist = parseInt(Math.pow((point.leftDirection[0] - point.anchor[0]),2) +
                        Math.pow((point.leftDirection[1] - point.anchor[1]),2));
                        var rightHandleDist = parseInt(Math.pow((point.rightDirection[0] - point.anchor[0]),2) +
                        Math.pow((point.rightDirection[1] - point.anchor[1]),2));
                        circlePts.push(leftHandleDist, rightHandleDist);
                        var leftHandleSlope = ((point.leftDirection[0] - point.anchor[0])/(point.leftDirection[1] - point.anchor[1])).toFixed(2);
                        var rightHandleSlope = ((point.rightDirection[0] - point.anchor[0])/(point.rightDirection[1] - point.anchor[1])).toFixed(2);
                        circleSlopes.push(leftHandleSlope, rightHandleSlope);
                    for(var f=0; f<8; f++){ // Allows non-rotated circles.
                        if(circleSlopes[f] == "-0.00"){
                            circleSlopes[f] = "0.00";
                        if(circleSlopes[f] == "-Infinity"){
                            circleSlopes[f] = "Infinity";
                    var cirEquaDistOne = parseInt(Math.pow((myShape.pathPoints[0].anchor[0] - myShape.pathPoints[2].anchor[0]),2) +
                    Math.pow((myShape.pathPoints[0].anchor[1] - myShape.pathPoints[2].anchor[1]),2));
                    var cirEquaDistTwo = parseInt(Math.pow((myShape.pathPoints[1].anchor[0] - myShape.pathPoints[3].anchor[0]),2) +
                    Math.pow((myShape.pathPoints[1].anchor[1] - myShape.pathPoints[3].anchor[1]),2));
                    if(circleSlopes[0] != "NaN"){ // Filters out asymmetric rhombus  <><><>^^^^^^<><><>
                        if((circlePts[0] == circlePts[1]) && // Filters out shapes with control handles not of equal distance from anchor point.
                            (circlePts[1] == circlePts[2]) &&
                            (circlePts[2] == circlePts[3]) &&
                            (circlePts[3] == circlePts[4]) &&
                            (circlePts[4] == circlePts[5]) &&
                            (circlePts[5] == circlePts[6]) &&
                            (circlePts[6] == circlePts[7]) &&
                            (circlePts[7] == circlePts[0])){
                            if((circleSlopes[0] == circleSlopes[1]) && // Filters out the equadistant 4-pointed Star shape (dismisses negative slopes).
                                (circleSlopes[2] == circleSlopes[3]) &&
                                (circleSlopes[4] == circleSlopes[5]) &&
                                (circleSlopes[6] == circleSlopes[7])){
                                if(cirEquaDistOne == cirEquaDistTwo){ // Filters out Ellipses (non-equadistant circles).
                                    // Filters out the very RARE 4-pointed star which has all control points in its center on top of each other!
                                    if(((myShape.pathPoints[0].leftDirection[0]).toFixed(2) != (myShape.pathPoints[1].leftDirection[0]).toFixed(2)) &&
                                        ((myShape.pathPoints[0].leftDirection[1]).toFixed(2) != (myShape.pathPoints[1].leftDirection[1]).toFixed(2))){
                                        shapeKind.iscircle = true;
                                    } else {
                                        shapeKind.iscircle = false;
                        } else {
                            if((circlePts[0]==circlePts[1]) &&
                                (circlePts[2]==circlePts[3]) &&
                                ((circlePts[4]==circlePts[5]) && (circlePts[4]==circlePts[1]) && (circlePts[5]==circlePts[1])) &&
                                ((circlePts[6]==circlePts[7]) && (circlePts[6]==circlePts[2]) && (circlePts[7]==circlePts[3]))){
                                shapeKind.isellipse=true;
        //~                     $.writeln(circlePts[0]+'\r'+circlePts[1]+'\r'+circlePts[2]+'\r'+circlePts[3]+'\r'+
        //~                     circlePts[4]+'\r'+circlePts[5]+'\r'+circlePts[6]+'\r'+circlePts[7]);
            return shapeKind;
        if(app.name=='Adobe Illustrator' && app.documents.length>0){
            function round2(num){
                return Math.round(num*100)/100;
            function convertToUIRGB(color){
                if(color=='[CMYKColor]'){
                    var c=color.cyan, m=color.magenta, y=color.yellow, k=color.black;
                    return [
                        round2((1-(c/100))*(1-(k/100))),
                        round2((1-(m/100))*(1-(k/100))),
                        round2((1-(y/100))*(1-(k/100)))
                } else if(color=='[GrayColor]'){
                    var k=color.gray;
                    var grayValue=1-(Math.round(((k/100)*255)*100)/100)/255;
                    return [grayValue,grayValue,grayValue];
                } else if(color=='[GradientColor]'){
                    $.writeln('Sorry, no gradient colors please.');
                    return [0,0,0];
                } else if(color=='[PatternColor]'){
                    $.writeln('Sorry, no pattern colors please.');
                    return [0,0,0,];
                } else if(color=='[SpotColor]'){
                    var clr=color.spot.getInternalColor();
                    if(color.spot.spotKind==SpotColorKind.SPOTCMYK){
                        var c=clr[0], m=clr[1], y=clr[2], k=clr[3];
                        return [
                            round2((1-(c/100))*(1-(k/100))),
                            round2((1-(m/100))*(1-(k/100))),
                            round2((1-(y/100))*(1-(k/100)))
                    } else if(color.spot.spotKind==SpotColorKind.SPOTRGB){
                        return [round2(clr[0]/255), round2(clr[1]/255), round2(clr[2]/255)];
                    } else if(color.spot.spotKind==SpotColorKind.SPOTLAB){
                        var clr=color.spot.getInternalColor();
                        var whiteRef={
                            D65: {X: 95.047,Y: 100, Z: 108.883},
                            D50: {X: 96.422,Y: 100, Z: 82.521},
                        var illuminant='D65';
                        var Y = (clr[0]+16)/116;
                        var X = clr[1]/500+Y;
                        var Z = Y-clr[2]/200;
                        if(Math.pow(Y,3) > 0.008856){Y=Math.pow(Y,3);}
                        else {Y = (Y-16/116)/7.787;}
                        if(Math.pow(X,3) > 0.008856){X=Math.pow(X,3);}
                        else {X = (X-16/116)/7.787;}
                        if(Math.pow(Z,3) > 0.008856){Z=Math.pow(Z,3);}
                        else {Z = (Z-16/116)/7.787;}
                        X*=whiteRef[illuminant].X,Y*=whiteRef[illuminant].Y,Z*=whiteRef[illuminant].Z;
                        //alert(X+" "+Y+" "+Z);
                        X/=100,Y/=100,Z/=100;
                        R=X*3.2406+Y*-1.5372+Z*-0.4986;
                        G=X*-0.9689+Y*1.8758+Z*0.0415;
                        B=X*0.0557+Y*-0.2040+Z*1.0570;
                        //alert(R+" "+G+" "+B);
                        if(R > 0.0031308){R=(1.055*(Math.pow(R,(1/2.4))))-0.055;}
                        else {R*= 12.92;}
                        if(G > 0.0031308){G=(1.055*(Math.pow(G,(1/2.4))))-0.055;}
                        else {G*= 12.92;}
                        if(B > 0.0031308){B=(1.055*(Math.pow(B,(1/2.4))))-0.055;}
                        else {B*= 12.92;}
                        if(R<0){R=0} else if(R>1){R=1};
                        if(G<0){G=0} else if(G>1){G=1};
                        if(B<0){B=0} else if(B>1){B=1};
                        return [round2(R),round2(G),round2(B)];
                } else if(color=='[RGBColor]'){
                    return [round2(color.red/255), round2(color.green/255), round2(color.blue/255)];
            function drawFromObjString(objString, canvasArea){
                function drawPath(shp){
                    var thisShp=shp;
                    if(thisShp.ellipsePath!=true){
                        var vectorPts=thisShp.pathPoints;
                        canvas.newPath(); canvas.moveTo(thisShp.pathPoints[0][0],thisShp.pathPoints[0][1]);
                        for(var j=0; j<vectorPts.length; j++){
                            var thisAnchor=vectorPts[j];
                            var x=thisAnchor[0], y=thisAnchor[1];
                            canvas.lineTo(x,y);
                        if(thisShp.closed==true){
                            canvas.closePath();
                    } else {
                        var cirPts=thisShp.pathPoints;
                        canvas.newPath();
                        canvas.ellipsePath(round2(cirPts[0]), round2(cirPts[1]), round2(cirPts[2]), round2(cirPts[3]));
                        canvas.closePath();
                    if(thisShp.fillColor!=null){
                        var clr=thisShp.fillColor;
                        var myBrush=canvas.newBrush(canvas.BrushType.SOLID_COLOR,clr);
                        canvas.fillPath(myBrush);
                    if(thisShp.strokeColor!=null){
                        var clr=thisShp.strokeColor;
                        var myPen=canvas.newPen(canvas.PenType.SOLID_COLOR,[clr[0],clr[1],clr[2],1], thisShp.strokeWidth);
                        canvas.strokePath(myPen);
            //$.writeln(objString.replace(/'\+\n*\r*'/g,'').replace(/(^'|';$)/g,''));
                var obj=eval(objString.replace(/'\+\n*\r*'/g,'').replace(/(^'|';$)/g,''));
                var canvas=canvasArea.graphics;
                var counter=obj.total;
                while(counter>=0){
                    for(all in obj){
                        if(all.match(/\d{1,2}$/g) && all.match(/\d{1,2}$/g)==counter){
                            var thisShp=obj[all];
                            if(all.match('group')){
                                var ctr=obj[all].total;
                                while(ctr>=0){
                                    for(paths in obj[all]){
                                        if(paths.match(/\d{1,2}$/g) && paths.match(/\d{1,2}$/g)==ctr){
                                            drawPath(obj[all][paths]);
                                    ctr--;
                            } else {
                                drawPath(thisShp);
                    counter-=1;
            var doc=app.activeDocument;
            if(doc.height<=400 && doc.width<=600){
                doc.rulerOrigin=[0,doc.height];
                doc.coordinateSystem=CoordinateSystem.DOCUMENTCOORDINATESYSTEM;
                var wDims=function(){
                    var dims={width: '', height: ''};
                    if(doc.width>220){
                        dims.width = Math.round(doc.width);
                    } else {
                        dims.width = 220;
                    if(doc.height>20){
                        dims.height = Math.round(doc.height);
                    } else {
                        dims.height = 20;
                    return dims;
                function drawCapture(docArt, dataDisplay, graphicDisplay){
                    function capturePathItem(pathItem, drawObj, count){
                        var thisShp=pathItem, drawData=drawObj, i=count;
                        if((thisShp.filled || thisShp.stroked) && thisShp.editable==true){
                            drawData['shape_'+i]={};
                            drawData['shape_'+i].fillColor=null;
                            drawData['shape_'+i].name=thisShp.name;
                            drawData['shape_'+i].tag=thisShp.note;
                            drawData['shape_'+i].strokeColor=null;
                            drawData['shape_'+i].pathPoints=[];
                            drawData['shape_'+i].ellipsePath=false;
                            if(itemShape(thisShp).iscircle==true || itemShape(thisShp).isellipse==true || thisShp.name=='ellipse' ||
                                thisShp.name=='circle' || thisShp.name=='cir'){
                                drawData['shape_'+i].ellipsePath=true;
                                drawData['shape_'+i].pathPoints=[Math.round(thisShp.left), Math.round(-thisShp.top), Math.round(thisShp.width), Math.round(thisShp.height)];
                                canvas.newPath();
                                canvas.ellipsePath(Math.round(thisShp.left), Math.round(-thisShp.top), Math.round(thisShp.width), Math.round(thisShp.height));
                            } else {
                                var vectorPts=thisShp.pathPoints;
                                canvas.newPath(); canvas.moveTo(Math.round(vectorPts[0].anchor[0]),-Math.round(vectorPts[0].anchor[1]));
                                for(var j=0; j<vectorPts.length; j++){
                                    var thisAnchor=vectorPts[j].anchor;
                                    var x=Math.round(thisAnchor[0]), y=-Math.round(thisAnchor[1]);
                                    drawData['shape_'+i].pathPoints.push([x,y]);
                                    canvas.lineTo(x,y);
                            if(thisShp.closed || drawData['shape_'+i].ellipsePath==true){
                                drawData['shape_'+i].closed=true;
                                if(drawData['shape_'+i].ellipsePath!=true){
                                    canvas.closePath();
                            } else {
                                drawData['shape_'+i].closed=false;
                            if(thisShp.filled){
                                var clr=thisShp.fillColor;
                                var colorArray=convertToUIRGB(clr);
                                var myBrush=canvas.newBrush(canvas.BrushType.SOLID_COLOR,colorArray);
                                drawData['shape_'+i].fillColor=colorArray;
                                canvas.fillPath(myBrush);
                            if(thisShp.stroked){
                                var clr=thisShp.strokeColor;
                                var colorArray=convertToUIRGB(clr);
                                var myPen=canvas.newPen(canvas.PenType.SOLID_COLOR,[colorArray[0],colorArray[1],colorArray[2] ,1], Math.round(thisShp.strokeWidth));
                                drawData['shape_'+i].strokeColor=colorArray;
                                drawData['shape_'+i].strokeWidth=Math.round(thisShp.strokeWidth);
                                canvas.strokePath(myPen);
                    // docArt is lately the layers[0].pageItems
                    // draws a preview and creates a drawing data object resource.
                    var drawData={total:0}; //Put drawing shapes here.  Properties: stroke (rgb color | null), fill (rgb color | null), pathPoints
                    var canvas=graphicDisplay.graphics;
                    vectors=function(){
                        var arr=[];
                        for(var i=0; i<docArt.length; i++){
                            var thisShp=docArt[i];
                            if(thisShp.typename=='PathItem' && thisShp.parent.typename!="GroupItem"){
                                if((thisShp.filled || thisShp.stroked) && thisShp.editable==true){
                                    arr.push(thisShp);
                            } else if(thisShp.typename=='GroupItem'){
                                if(thisShp.pathItems.length>0){
                                    var smArr=[];
                                    for(var j=0; j<thisShp.pathItems.length; j++){
                                        var thisPth=thisShp.pathItems[j];
                                        if((thisPth.filled || thisPth.stroked) && thisPth.editable==true){
                                            smArr.push(thisPth);
                                    if(smArr.length>0){arr.push(smArr);};
                        return arr;
                    drawData.total=vectors.length;
                    for(var i=vectors.length-1; i>-1; i--){
                        var thisShp=vectors[i];
                        if(thisShp instanceof Array){
                            var grpObj={};
                            for(var j=thisShp.length-1; j>-1; j--){
                                var thisPth=thisShp[j];
                                capturePathItem(thisPth, grpObj, j);
                            grpObj.total=thisShp.length;
                            var grpNm=function(){
                                if(thisShp[0].parent.name!=''){
                                    return thisShp[0].parent.name+"_";
                                return '';
                            drawData['group_'+grpNm+i]=grpObj;
                        } else {
                            capturePathItem(thisShp, drawData, i);
                    return drawData;
                function showDrawerFunc(objStringDisplay, wDims){
                    var w2=new Window('dialog','Drawer Function');
                    var containerG=w2.add('tabbedpanel');
                        var funcG=containerG.add('tab',undefined,'Drawer Function');
                            var dispE=funcG.add('edittext',undefined,funcSrc,{multiline:true}); dispE.size=[580,200];
                            var selBtn=funcG.add('button',undefined,'Select All');
                        var drawingG=containerG.add('tab',undefined,'Drawing:');
                            var drawG=drawingG.add('group');
                                var drawP=drawG.add('panel',undefined,''); drawP.size=[wDims.width, wDims.height];
                    var msgCntr=w2.add('panel',undefined,'Message Center:');
                        var msgE=msgCntr.add('edittext',undefined,'',{multiline:true});msgE.size=[560,40];
                    var btnG=w2.add('group');
                        var okBtn=btnG.add('button',undefined,'Ok',{name: 'ok'});
                    selBtn.onClick=function(){
                        dispE.active=false; dispE.active=true;
                    drawG.onDraw=function(){
                        if(objStringDisplay.text!=''){
                            try{
                                drawFromObjString(objStringDisplay.text, this);
                            } catch(e){
                                msgE.text=("Something isn't right:\r"+e);
                        } else {
                            msgE.text=('You must first put a valid object string into the object string display area--> "Get Source Object String" button, 1st window, 1st tab.');
                    w2.show();
                function instructions(){
                    var w3=new Window('dialog','instructions');
                    var instructions=w3.add('edittext',undefined,'',{multiline:true}); instructions.size=[400,100];
                    instructions.text="1)  Have a document open, smaller than 600x400.\r\r"+
                        "2)  Draw some stuff- use paths only, straight lines or ellipses only. To have script explicitly recognize ellipse, "+
                        "label the path 'cir', 'circle', or 'ellipse'. Right now there's a function to detect (non-rotated) ellipses, but it is coarse.\r\r"+
                        "3)  Run this script and see if your drawing was captured in the main window.\r\r"+
                        "4)  Click the 'Get Object String' button and see the drawing instruction string appear.\r\r"+
                        "5)  Click the 'View Drawer Function/Drawing' button to see the function used to draw scriptUI picture from"+
                        " the object string and use other tab to see the drawing made with this function from that object string.\r\r"+
                        "6)  Edit your string to see your picture change if needed!";
                    var okBtn=w3.add('button',undefined,'OK');
                    w3.show();
                var funcSrc=drawFromObjString.toSource();
                var dispWindow=function(){
                    var drawData;
                    var w=new Window('dialog','ScriptUI Graphics Display');
                    var panel=w.add('panel',undefined,''); panel.size=[wDims.width+6,wDims.height+6];
                    var list=w.add('edittext',undefined,'',{multiline:true}); list.size=[wDims.width,150];
                    var formatG=w.add('group');
                        var formatH=formatG.add('statictext',undefined, 'Format:');
                        var format_returns=formatG.add('button',undefined, 'Returns before "(group|shape)_"');
                    var btnsG=w.add('group');
                        var clickBtn=btnsG.add('button',undefined,'Get Source Object String');
                        var selectBtn=btnsG.add('button',undefined,'Select All');
                    var btnG2=w.add('group');
                        var funcBtn=btnG2.add('button',undefined,'See Drawer Function/Drawing');
                        funcBtn.helpTip='Uses the Object String picture info to draw using ScriptUIGraphics lineTo commands.';
                        var helpBtn=btnG2.add('button',undefined,'?'); helpBtn.size=[25,25];
                    panel.onDraw=function(){
                        drawData=drawCapture(doc.layers[0].pageItems, list, this);
                    clickBtn.addEventListener('mousedown',function(){
                        list.text=drawData.toSource();
                    format_returns.onClick=function(){
                        var str=list.text;
                        var rx=/(group|shape)_/g;
                        if(str!=''){
                            var rx=/(group_|shape_)/g;
                            var matches=str.match(rx);
                            for(var i=0; i<matches.length; i++){
                                var instance = rx.exec(str);
                                str=str.substring(0, rx.lastIndex-instance[0].length)+str.substr(rx.lastIndex-instance[0].length,).replace(ins tance[0],"'+\r'"+instance[0]);
                        list.text="'"+str+"';";
                    funcBtn.onClick=function(){
                        showDrawerFunc(list, wDims);
                    helpBtn.onClick=function(){
                        instructions();
                    selectBtn.onClick=function(){
                        list.active=false; list.active=true;
                    var okBtn=w.add('button',undefined,'OK');
                    w.show();
            } else {
                alert('Please use a document with main artboard no larger than 600x400.');
        } else {
            alert('Must run in Illustrator with at least 1 document open.');
    graphicsDisplay();

  • Interfaces for your own classes - do you bother?

    Hi All,
    before anyone gets upset, I did post a shorter version this to the Java Prog forum a couple of days ago. I'm reposting here because the thread was pushed down the list just as comments were getting interesting, and I was tossing up which forum was most appropriate anyway...
    OK, I'd like to pose a general question on the use of interfaces with your own classes. I am totally behind the concept of using appropriate interfaces for declaration of vars, parameters etc (i.e. use "List" rather than "Vector"), but what about your own classes?
    If I have a class in my application that doesn't fit into any kind of framework or class hierarchy, subclass of object basically, should I write an interface with all the same method sigs and use that rather than the class for my vars, params etc? This would make things more flexible in future, enabling you to swap classes in and out of your app more easily.
    Taking it a step further, how's this for a design methodology: For every class you write (once again classes that don't fit into your own or somebody else�s hierarchy or framework) do the following
    1. Create an interface (MyInterface) that maps 1 to 1 to that class (MyClass), with all the same method sigs.
    2. Make the constructor private and manage all the creation of instances of MyClass through a factory that returns objects of type MyInterface.
    If you do this there will be no mention of any of your concrete classes anywhere in your app except the factories, making it easier to refactor etc. Do this for all your classes.
    A little sketchy but I hope you get idea. Is this complete overkill? Is there a down side to this? Does anyone do anything like this?
    Cheers
    Matt

    Although the pattern you describes adds flexibility, it also adds complexety.
    Imagine somebody is looking at your code and from what he sees he deducts that the next thing to look at is the concrete class which is used at a given place.
    If you used an interface, he must find out which implementing class is actually used at this place. It's not a big thing, but if every single class has its seperate interface and factory I would consider it overkill ... after all you have to write all the boring code for this.
    In the case of doubt I'd agree it's better to throw in an interface and a factory instead of refactoring thousand lines of codes afterwards. But if nothing hints toward a second implementation of the interface, or another reason for using an interface don't bother to write one.
    As a general rule I use something like: Don't use a general rule. ;-)
    Spieler

  • Rolling Your Own Script Editor

    Does anyone know if there is a way in a window you've developed on your
    own to access Forte's "compile" logic? Have a TextEditField and would
    like the stuff in it to be compiled.
    Curtis Marsden
    [email protected]

    If we are making a text-editor wish list, let me add my two cents worth --
    How about text-sensitive help - when you do f1, look up the word under the
    cursor, and if it is found, automatically position to that topic in the
    help file. And as long as we are talking about help, how about more
    example syntax, suitable for cutting and pasting?
    I do like Forte's search and replace feature, with the little check-boxes,
    but wish that it would find all references, not just those in methods. I
    got nailed once changing an attribute or method name (I forget which) that
    was also referenced in a virtual attribute. The code broke, and it was
    pretty hard to track down why.
    Beyond that, I would echo ALL of Richard's suggestions. If I were to pick
    the one or two points that I would consider most important, it would be
    these: Using color to highlight key words and comments in the methods; and
    using a treeview with projects, classes, and methods to simplify navigation
    of the project hierarchy.
    --Jeanne
    ======================================================
    Jeanne Hesler <[email protected]>
    MSF&W Software, Product Development
    (217) 698-3535 ext 207
    http://www.msfw.com
    ======================================================
    /\ Imaging Developer - the only imaging product
    \/ integrated into the Forte Development Environment
    ======================================================
    From: Richard Stobart <[email protected]>
    To: Don Nelson <[email protected]>; Thomas Mercer-Hursh, Ph.D.
    <[email protected]>
    Cc: Forte Users <[email protected]>
    Subject: Re: Rolling your own script editor
    Date: Sunday, March 29, 1998 6:45 AM
    I think the point is that the editing in Forte is archaic. Someone (andwe
    all are looking directly at Forte themselves) needs to provide a user
    friendly development environment.
    Useful features that are on all successful IDE's built in the later partof
    the century are:
    Text highlighting - This doesn't even work properly in V3F. Tryshift-down
    past a long line.
    Context highlighting or colours - Type a reserved word and it appears in
    bold would be a good start.
    Search - What is that greyed out cancel button for?
    Search - I am reading someone's code and they are calling a method on anSO.
    How do I quickly find where that method is?
    Layout - What about a tree view of Projects, Classes and
    Methods/Attributes - Double click on the method and go directly there. Take
    a look at MSVC for a useable interface.
    'How do I?' on help.
    Why is it necessary to keep going to the web to look for tech support?
    Can't that be added to Help.
    Object ID's - all or nothing. Try changing an object's name. All the
    function prototypes change - none of the code changes - brokeneverywhere.
    If there was a descent Search and Replace (Would you like to replacethis?
    And the text in your function prototype, Would you like to replace this
    too?) this would be vaguely acceptable.
    I could go on but I won't.
    Regards
    Richard Stobart
    Consultant, ECSoft, UK
    101 Wigmore Street
    London W1H 9AA
    (0171) 355 1101
    -----Original Message-----
    From: Don Nelson <[email protected]>
    To: Thomas Mercer-Hursh, Ph.D. <[email protected]>
    Cc: Forte Users <[email protected]>
    Date: 29 March 1998 01:49
    Subject: Re: Rolling your own script editor
    You probably could, but it would very likely "break" with future
    versions
    of Forte. Not recommended at this time.
    Don
    At 03:32 PM 3/27/98 -0800, Thomas Mercer-Hursh, Ph.D. wrote:
    At 09:45 PM 3/27/98 +0000, Alfred Scholldorf wrote:
    No, but Wow would that be a cool feature!
    Does anyone know if there is a way in a window you've developed on
    your
    own to access Forte's "compile" logic? Have a TextEditField andwould
    like the stuff in it to be compiled.
    [email protected]
    Also potentially quite interesting would be the option to use optional
    editors in place of any standard one. I have been very impressed, for
    example, with ED4W and its ability to recognize syntax, use color to
    highlight syntactically relevent areas, and provide typing shortcutswhich
    can pop in whole language segments in response to a few keystrokes. They
    haven't done a Forte language template yet, but they do provide all the
    tools necessary to do one and they have provided the capability withmany
    other languages to hand the current buffer to a compiler, collect the
    errors, and then return to ED4W with errors marked. I don't know howeasy
    it would be to get it to interface with the repository, but I don't seewhy
    this should be that difficult.
    =========================================================================
    Thomas Mercer-Hursh, Ph.D email:
    [email protected]
    Computing Integrity, Inc. sales: 510-233-9329
    550 Casey Drive - Cypress Point support: 510-233-9327
    Point Richmond, CA 94801-3751 fax: 510-233-6950
    ============================================
    Don Nelson
    Regional Consulting Manager - Rocky Mountain Region
    Forte Software, Inc.
    Denver, CO
    Phone: 303-265-7709
    Corporate voice mail: 510-986-3810
    aka: [email protected]
    ============================================
    "Until you learn to stalk and overrun, you can't devour anyone" - Hobbes

  • Roll Your Own - APEX 4.0 and JQuery-UI Application

    For those with a apex.oracle.com account and want to see jQeury tabs running via 4.0 in your own Workspace, use following this script to create your own version of Shijesh's (Apex_Noob) application.
    Credit also goes out to Alistair Laing for his hard work in investigating why 4.0 is requiring the use of the googleapis jquery.js... libraries.
    Application Builder - Create
    Application Type - Database
    Create Application - From Scratch
    Name - jQuery Application
    Add Page - keep default and Click Add Page
    Click CreateMy application defaulted to Theme 2, you will need to switch the theme to one of the following: If you don't the tabs will not render properly.
    8 Orange
    10 Sand
    13 Classic Blue
    14 Simple Green
    15 Light Blue
    16 Dark Blue
    18 Simple Gray
    19 Red Gray
    Message - Application created successfully.
    Click Shared ComponentsUnder User Interface Click - ThemesIf you don't see one of the above Themes, you will need to Create and switch your Theme.
    Click - CreateFrom the Repository selected Click - Next and select one of the above Themes
    Click - Switch ThemeSelect one of the above Themes and Click - Next
    Click -NextClick - Switch ThemeReturn to your newly created Application by Clicking on Application xxxxxxx Breadcrumb
    Click - Create PageSelect - Blank PageClick - NextAssign the page a name
    Click - NextAccept defaults and Click - NextClick - FinishClick - Edit PageI still work in Component View, to toggle to this View, click on the control adjacent to Page number and Go button. Hover over the ones on the far right and you will see both Component View and Tree View
    From Component View
    Click on the Page Edit Control
    In the Text Area labeled Javascript/Execute when Page Loads - paste in the following code:
    $x("tabs").appendChild( $x("tabs-1"));
    $x("tabs").appendChild( $x("tabs-2"));
    jQuery("#tabs").tabs();In the Text Area labeled HTML Header and Body Attribute/HTML Header - paste in the following code:
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/redmond/jquery-ui.css" type="text/css" />
    <script src= "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.js"> </script>Click - Apply ChangesRequired use of the Google jqueryui libraries is being questioned by recent threads created by Alistair Laing since it appears that 4.0 does not currently support jQeury tabs
    {thread:id=1083507}
    {thread:id=1083540}
    Create a Region
    Type HTML Text - accept defaults
    Provide a Title like "Tabs" and accept defaults
    Template - Reports Region
    Sequence 10
    Click - NextIn the Enter HTML Text Region Source: Text Area - paste in the following code:
    <div id="tabs">
    <ul>
    <li><a href="#tabs-1">Employees</a></li>
    <li><a href="#tabs-2">Departments</a></li>
    </ul>
    </div>Click - Create RegionCreate a second Region
    Type Report/Sql Report
    Provide a Title like "Employees" and accept defaults
    Template Reports Region
    Sequence 20
    Click - NextIn the Enter SQL Query or PL/SQL function returning a SQL Query: Text Area - paste in the following code:
    SELECT empno,
           ename,
           job,
           mgr,
           hiredate,
           sal,
           comm,
           deptno
    FROM   empClick - Create RegionEdit the newly created Report Region
    Under Attributes/Static ID - paste in the following code:
    tabs-1Click - Apply ChangesCreate a third Region
    Type Report/Sql Report
    Provide a Title like "Departments" and accept defaults
    Template Reports Region
    Sequence 30
    Click - NextIn the Enter SQL Query or PL/SQL function returning a SQL Query: Text Area - paste in the following code:
    SELECT deptno,
           dname,
           loc
    FROM   deptClick - Create RegionEdit the newly created Report Region
    Under Attributes/Static ID - paste in the following code:
    tabs-2Click - Apply ChangesRun you page and you should see you tabs.
    Jeff

    Great post Jeff,
    With regard to Jquery UI and tabs I've contacted the Apex dev team and received a reply from them.
    All the jQueryUI files are included in the APEX 4.0 distribution, but not all jQueryUI components
    are loaded by default to avoid a huge initial download. It's not necessary to load your own version of jQueryUI, just load the missing component.
    For the "Tabs" you have to add
    <link href="IMAGE_PREFIX#libraries/jquery-ui/1.8/themes/base/jquery.ui.tabs.css" rel="stylesheet" type="text/css" />
    <script src="#IMAGE_PREFIX#libraries/jquery-ui/1.8/ui/minified/jquery.ui.tabs.min.js" type="text/javascript"></script>
    to your page template or the header attribute of your page where you want to use it.They did not mention which other Jquery UI widgets were not included so people need to check to see if they get any JS errors Like "$('#tabs').tabs() is not a function" this would suggest that tabs is not being loaded. To included it in you page header directly after #HEAD# you need to place the css and js as stated above.
    If you need jquery help just post you queries here or the is some other jquery links that maybe of some use
    jQuery
    http://jquery.com/ - Official jQuery Website
    http://api.jquery.com/ - jQuery API Library
    http://plugins.jquery.com/ - jQuery Plugins (Not APEX related)|
    http://yayquery.com/ - yayQuery - jQuery Podcast
    http://jqueryui.com/ - Official jQuery UI Website
    http://jqueryui.com/demos/ - jQuery UI Demos
    Edited by: Alistair Laing on Jun 9, 2010 4:04 PM
    Add more links
    Edited by: Alistair Laing on Jun 9, 2010 4:09 PM

  • Can you save your own theme and button set up so I can use the same format

    Can you save your own theme and button set up, so I can use this same format for similar content. I want to keep the button content and the theme the same without having to create it everytime? I am trying to streamline the process for multiple dvd's with the same menu and buttons but different content. Does that make sense?

    I am only new to this caper too, but I am pretty sure you can save a theme as a favourite by pressing the "save theme as favourite" button under file. If you have edited an existing theme but don't want to lose it, make sure you untick the replace existing button.

  • How to create your own theme?

    Is it possible to create your own theme for use with iDVD?
    I know there are some commercially available (e.g. www.ithemez.com), but what tools are needed to create your own?
    Thanks,
    Pete.

    Actually, DVDSP has the ability to do everything that iDVD can do and much much more. The idea is to author your own themes in DVDSP, not use pre-made off the shelf ones... if you want cookie cutter design, go with iDVD. Even with the tutorials below, you are still limited on what you can do... that is a limitation built into the application itself. Perhaps a future version may change all that, but with added flexibility also comes added complexity. Some prefer keeping things simple.
    Here is the complete iDVD 5 tutorial list:
    Part 1: Basic Custom Button Creation
    http://www.creativemac.com/articles/viewarticle.jsp?id=31388
    Part 2: More on Custom Buttons and Highlights
    http://www.creativemac.com/articles/viewarticle.jsp?id=31517
    Part 3: Creating Motion Buttons and Motion Masks
    http://www.creativemac.com/articles/viewarticle.jsp?id=31843
    Part 4: Changing highlight colors on buttons
    http://www.digitalproducer.com/articles/viewarticle.jsp?id=32284
    Part 5: Creating custom drop zones
    http://www.digitalproducer.com/articles/viewarticle.jsp?id=32445

  • The action could not be completed because of a conflict with the original item. The conflict may have occurred when an existing item was updated on another computer or device. Open the item again and try making your changes. If the problem continues, cont

    I have a user on an iMac 10.6 connected to our domain.  She uses Outlook web access for email on our exchange server.  Last week she received the following message which is randomly preventing her from sending emails.  She claims no attachment was involved in the original email when this all started.  I have not been able to look at her account as she is out of the office but maybe someone else dealt with this issue.  I realize this may not be Mac related but thought I'd give it a try.  She did say it occurred once over two days while working on a PC but it continued over the past weekend.
    If an internal user tries to send a message with infected attachment using Outlook Web Access, it may report the following error message: The action could not be completed because of a conflict with the original item. The conflict may have occurred when an existing item was updated on another computer or device. Open the item again and try making your changes. If the problem continues, contact technical support for your organization.
    This is because F-Secure Anti-Virus for Microsoft Exchange has detected a virus in the attachment. If the user tries to send the message again, the message will be sent but without the attachment. At the same time a blank message with an attachment named "Attachment_information.txt" will remain in the user's Drafts folder. The "Attachment_information.txt" will contain information about the virus detected in the message.

    PS - have found other posts indicating that clips smaller than 2s or sometimes 5s, or "short files" can cause this. Modern style editing often uses short takes ! Good grief I cannot believe Apple. Well I deleted a half a dozen short sections and can export, but now of course the video is a ruined piiece of junk and I need to re-do the whole thing, the sound etc. which is basically taking as much time as the original. And each time I re-do it I risk again this lovely error -50 and again trying to figure out what thing bugs it via trial and error instead of a REASONABLE ERROR MESSAGE POINTING TO THE CLIP IT CAN'T PROCESS. What a mess. I HATE this iMovie application - full of BUGS BUGS BUGS which Apple will not fix obviously, since I had this product for a few years and see just hundreds of hits on Google about this error with disappointed users. Such junk I cannot believe I paid money for it and Apple does not support it with fixes !!!
    If anyone knows of a GOOD reasonably priced video editing program NOT from APPLE I am still looking for suggestions. I want to do more video in future, but obviously NOT with iMovie !!!

  • Family sharing- invitiation to your own account!?!?

    I set up a new family sharing.  I use one Apple ID and my wife is another one.
    I logged in my Iphone6 with my ID and did Family Sharing to my Wife 's ID.
    Response "Cannot send invitation"  You cannot send an invitation to your own account.
    How can I separated our account?
    Thanks

    Howdy,
    Thanks for using the Apple Support Communities.
    From your post I see that you are unable to send an invitation to your family group to your wife.  Given the error states you cannot send an invitation to your own account, it looks like you may have an alias associated with your Apple ID, of which you are sharing with your wife.  This means you are under the same Apple ID, and would not need to use Family Sharing.  I'd like you to please check your iCloud settings to check if this is indeed the case.
    Change, deactivate, reactivate, or delete an alias
    In iCloud Mail, choose Preferences from the Action pop-up menu  in the sidebar. 
    Click Accounts.
    Select the alias in the Addresses list, then do any of the following:
    To choose a new color for incoming messages, click a Label Color option. Alias labels appear only in the iCloud Mail app on iCloud.com. 
    To change the name or label, enter a new alias name and label in the fields provided. Alias names must contain between 3 and 20 characters. 
    To turn off an alias, select “Disable alias.”
    When an alias is turned off, all email messages addressed to that alias are returned to the sender.
    To turn on an alias, deselect “Disable alias.”
    To delete an alias, click Delete.
    Click Done.
    iCloud: Create or change email aliases
    Cheers,
    Alex H.

  • Use your own iOS app on your own iOS device without buying a developer program.

    This is no question; it is simply a request that you make it possible for people with the free developer program to use their own iOS apps that they built themselves without having to pay $99 a year.
    This is because loads of people want to build small apps for themselves, and can do so easily now that Xcode is free on the AppStore. The main problem with this is that they have to pay to simply do this.
    So this is in a way a petition for all you people who are the same; who have written your own iOS apps for your personal use only, apps that shall not be distributed and only serve to show what you can do or help a family game to get Apple to make this small thing possible for you (us).
    So please post here if you want the same.
    Thank you.

    As always, feel free to use Report a Bug for any samples, doc additions, feature requests or enhancements you'd like to see as well. Add your BR# to this thread for reference, thanks.
    But I wouldn't hold my breath on this one....it would only result in immediate scams.

  • Is there a way to create your own contact group

    Is there a way to create your own group contact list

    Not exactly your own app store, but close.  Apple has an App Store Volume Purchasing Program for Business > http://www.apple.com/business/vpp/
    It allows you to purchase apps in any quantity you desire and pay using a company credit card.  You will receive a spreadsheet of redeem codes which you distribute to your emloyees.  The program guide has complete information > http://images.apple.com/business/docs/VPP_Business_Guide_US.pdf

Maybe you are looking for

  • Automatic event creation in iCal

    I'd like to be able to create a standard set of events in iCal whose dates are based on another event. For a simplified example, if I have a meeting on Wednesday, I'd like to be able to run a script of some sort to add: "Confirm Appt" 2 days before,

  • Purchase Order Condition Value

    Hi, We have an issue with the Conditions in a Purchase Order raised by the client. In this purchase order, there are 151 items with PB00 or PBXX item conditions. However when these are totaled up (as a standard SAP functionality) and the values are d

  • Enabling controls on frame on MAC OSX

    I'm disbaling and enabling various controls on a frame by following code: private void disableControls( Component comp, Vector controlList ) { if ( comp instanceof Container ) { Component[] children = ( ( Container ) comp ).getComponents(); for ( int

  • Collaborating with Editors question

    Hi, I did a complete book layout in InDesign. The publisher now says he is not happy with the editing (my side of things -- the design work -- is fine) and he wants the entire book to go through another round of editing. The book has already been thr

  • Whts the signifacnce of MANDT field wid data type CLNT in DB table  ??

    nybody pls explain in details? Whts the signifacnce of MANDT field wid data type CLNT in DB table  ?? why fields ( ex- Kunnr - CUSOMER NO. ) is repeated in many tables, but not as a Primary Key , so whts d need to include dis field in many tables? we