[JS CS5] Accessing an inline frame from an insertion point

Given an insertion point, how can I determine if it contains an inline/anchored frame? And if so, how do I reference the inline/anchored frame?
I know how to reference the surrounding paragraph, characters, etc., but can't figure out how to get to the inline/anchored graphic.
I normally would just loop through all the inline graphics in the document, but it this case I need to access the inlines via their insertion points.

As far as I know, Insertion point can't hold inline/anchored object, but character does.
If you select text and run this line
alert(app.selection[0].pageItems.length);
it will return number of anchor/inline objects inside selected text.
Another way is to check parent of object. Parent of anchor/inline object is always character.
Example script that copies all anchor/inline objects to new layer: http://bit.ly/aV9WMF
Hope that helps.
Marijan (tomaxxi)
http://indisnip.wordpress.com/
http://inditip.wordpress.com/

Similar Messages

  • Find text from current insertion point - indesign cs3 javascript

    Hi all,
    I need to find the text from the insertion point in CS3 document through javascipt. Built in indesign has this feature. I want to do this in my script.
    Anybody have the idea/solutions for ths...
    Thanks,
    Vaasu

    Thanks csm_phil for your interest... see my below code:
    if(app.documents.length>0)
        myDoc=app.activeDocument;
        var myFoundchar=new Array();
        app.findTextPreferences = NothingEnum.nothing;
        app.changeTextPreferences = NothingEnum.nothing;
        app.findGrepPreferences=     NothingEnum.nothing;
        app.findGrepPreferences.fontStyle="Italic"
        app.findGrepPreferences.findWhat ="[\\l\\u].+?( v\. ).+" //"(.+?(v\.).+)";
    var myResults = myDoc.findGrep();
    for (var i = 0; i < myResults.length; i++)
            alert(myResults[i].contents);
        app.findGrepPreferences=     NothingEnum.nothing;
        app.findGrepPreferences.findWhat =", \\d{1,}.+?\\d{4}?\\) ";
        var mySearch = myDoc.findGrep();
        app.select(mySearch[0].insertionPoints[0]);
        alert(mySearch[0].contents);
        app.findGrepPreferences = null;
    alert("Done");
    here i am trying the fetch the Table of cases, example find results are
    Sears, Roebuck & Co. v. Camp, 124 N.J. Eq. 403, 407 (E. & A. 1938)
    Sears, Roebuck & Co. v. Camp, 124 N.J. Eq. 403, 408 (E. & A. 1938)
    Gramatan Nat’l Bank & Trust Co. v. Backman, 30 N.J. Super. 349 (App. Div. 1954)
    So, the 2nd search mysearch always giving first line output above.           , 124 N.J. Eq. 403, 407 (E. & A. 1938)
    If i use the  mySearch[i].contents sometimes it doesn't give the correct result. Since, if gives if other than the case name ends with , and digits. It makes the result totally wrong.
    Thanks,
    vaasu

  • Navigating inline frames from flash

    Hi,
    I have a navigation block set up in flash. Can someone please tell what the geturl script is to control external html pages loading into an inline frame?
    Thanks.

    o.k kglad, something odd is going on.
    in my html code, I'm designating a particular file to initially load in my iframe
    <iframe name="leftframe" src="swfs/portfolio/frames/logos/logointro.html" width="431" height="506" marginwidth="0" marginheight="0" allowtransparency="true" scrolling="no" border="0" frameborder="0">
    I'm testing two buttons to make sure they are working, but each time I click them, the logointro.html file reloads instead.
    sample1btn.onRelease = function():Void {
    getURL("swfs/portfolio/frames/logos/logo1.html", "leftframe");
    gotoAndPlay("sample1");
    sample2btn.onRelease = function():Void {
    getURL("swfs/portfolio/frames/logos/logo2.html", "leftframe");
    gotoAndPlay("sample2");
    Any idea why logo1.html and logo2.html won't load?

  • Hel with modifying cs5/6 script...create anchored frames from text

    hello
    I have one great time saver script for cs5 for create anchored frames from text tagged with/or charachter style/paragraph style. This work in cs6 but have some "bugs" for me. Script need to be compatible with InDesign CS6.
    1. script in original (look bellow) create text frame which is fitted to lenght of the text. I make change and change 466 line:
    AnchoredTextFrame.fit(FitOptions.FRAME_TO_CONTENT);
    now frame is wide as I write in check box, good. But frame not resize to lenght of the text so I add after above lines 466-470:
        var FO = FitOptions.FRAME_TO_CONTENT,
        tfs = ([]).concat.apply([], app.activeDocument.stories.everyItem().textContainers),
        t, i = tfs.length;
    while( i-- ) (t=tfs[i]).overflows && ( t.locked || t.fit(FO) );
    now all is ok but is here better way to make this to work? Simply, i want to spec text frame width in dialog box, frame will resize only verticaly in direction to amount text in frame. I dont want any overset text.
    2. One "bug". For some reason script alter paragraph style of other text which is not subject to be cutted in anchored frame.
    How to resolve this?
    #targetengine "session"
              Automating anchored object creation
              Version: 2
        Script by Thomas Silkjær
              http://indesigning.net/
    Модификация Б. Кащеев, www.adobeindesign.ru
    Скрипт предназначен для создания привязанных фреймов из текста, отформатированного
    каким-либо абзацным или символьным стилем. Эти стили задаются пользователем в диалоговом
    окне скрита. Там же необходимо задать объектный стиль для привязанного фрейма, в котором
    пользователь должен заранее задать оформление и параметры привязки. Далее необходимо
    указать ширину привязанного фрейма, а его высота будет рассчитана автоматически исходя из
    объема текста. При вводе дробных значений ширины привязанного фрейма в качестве
    разделителя целой и дробной части следует использовать не запятую, а точку, следуя западным
    стандартам разработчиков программы  Adobe InDesign. Первоначально идея и скрипт по созданию
    привязанных фреймов принадлежит Thomas Silkjær для версии ID CS4. C появлением версий CS5
    и CS5.5 скрипт перестал в них выполняться, да и в версии CS4 не всегда корректно работал.
    Анализируя недочеты скрипта в данной его версии были исправлены ошибки и внесены
    функциональные дополнения исходя из понимания задачи автором модификации. Добавлена
    возможность выбора стилей, если они они находятся в группах (папках), возможность выбора
    единиц измерения из выпадающего списка, изменены GREP-выражения для поиска текста,
    область действия скрипта ограничена материалом (Story), а не документом.
    var myMeasureUnits = ["Milimeters","Centimeters","Points","Inches", "Picas", "Ciceros"];
    var selectUnits;
    var pStyleIndex = null;
    var cStyleIndex = null;
    var oStyleIndex = null;
    var myH, myW;
    function main()
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
              if (app.documents.length == 0)
                        alert ("Document is not open. Open document first");
                        return;
        var myParaStyleList = myGetParagraphStyleNames();
        var myCharStyleList = myGetCharacterStyleNames();
        var myObjStyleList = myGetObjStyleNames();
        if(app.selection.length && app.selection[0].hasOwnProperty("baseline"))
            var myStory = app.selection[0].parentStory;
            var myWin = myDialog(myParaStyleList, myCharStyleList, myObjStyleList);
            if ( myWin.show()  == 1 )
                var myDocument = app.activeDocument
                with (myDocument.viewPreferences){
                    // Сохраняем старые единицы измерения в переменных myOldXUnits, myOldYUnits
                    var myOldXUnits = horizontalMeasurementUnits;
                    var myOldYUnits = verticalMeasurementUnits;
                    // Устанавливаем новые единицы измерения
                    switch(selectUnits)
                        case 0:                   
                            horizontalMeasurementUnits = MeasurementUnits.millimeters;
                            verticalMeasurementUnits = MeasurementUnits.millimeters;
                            break;
                        case 1:
                            horizontalMeasurementUnits = MeasurementUnits.centimeters;
                            verticalMeasurementUnits = MeasurementUnits.centimeters;
                            break;
                        case 2:
                            horizontalMeasurementUnits = MeasurementUnits.points;
                            verticalMeasurementUnits = MeasurementUnits.points;
                            break;                  
                        case 3:
                            horizontalMeasurementUnits = MeasurementUnits.inches;
                            verticalMeasurementUnits = MeasurementUnits.inches;
                            break;
                        case 4:
                            horizontalMeasurementUnits = MeasurementUnits.picas;
                            verticalMeasurementUnits = MeasurementUnits.picas;
                            break;
                        case 5:
                            horizontalMeasurementUnits = MeasurementUnits.ciceros;
                            verticalMeasurementUnits = MeasurementUnits.ciceros;
                            break;
                        default: break;
                    } // switch
                if(cStyleIndex == null)
                {/*поиск по стилю абзаца*/
                    var pStyle = getParagraphStyleByName(myParaStyleList[pStyleIndex]);
                    resetGREPfindChange();
                    app.findGrepPreferences.appliedParagraphStyle = pStyle;
                    app.findGrepPreferences.findWhat = NothingEnum.nothing;
                else //
                    // поиск по стилю символов
                    var cStyle = getCharacterStyleByName(myCharStyleList[cStyleIndex]);
                    resetGREPfindChange();
                    app.findGrepPreferences.appliedCharacterStyle = cStyle;
                    //app.findGrepPreferences.findWhat = ".+";
                    app.findGrepPreferences.findWhat = NothingEnum.nothing;
                var foundItems = myStory.findGrep();
                if(!foundItems.length) {
                    alert("Found the text to be placed in a linked frames"); exit();
                //alert(foundItems.length);
                //alert (foundItems[0].contents)
                //alert (foundItems[1].contents)
                var oStyle = getObjectStyleByName(myObjStyleList[oStyleIndex]);
                for(var i = foundItems.length-1; i >=0; i--)
                    //alert (foundItems[i].contents)
                    createAnchoredFrame(foundItems[i], oStyle);
                with (myDocument.viewPreferences){
                    try{
                        horizontalMeasurementUnits = myOldXUnits;
                        verticalMeasurementUnits = myOldYUnits;
                    catch(myError){
                        alert("Unable to return to the original unit");
            } //if ( myWin.show()
        } //if(app.selection.length && app.selection[0].hasOwnProperty("baseline"))
        else
            alert("Place the cursor in the text and run the script again")
    } // main
    function myGetParagraphStyleNames()
    // Получаем список стилей абзацев
              var curGroup;
              var curGroupName;
              var curNameInGroup;
              var myParagraphStyleNames = app.activeDocument.paragraphStyles.everyItem().name;
              myParagraphStyleNames.shift(); // удаление стиля No Paragraph Style
              var paraGroups = app.activeDocument.paragraphStyleGroups;
              var paraGroupsLen = paraGroups.length;
              for(var i = 0; i < paraGroupsLen; i++) {
                        curGroup = paraGroups[i];
                        curGroupName = paraGroups[i].name;
                        curGroupStyleNames = curGroup.paragraphStyles.everyItem().name
                        for (j=0; j< curGroupStyleNames.length; j++)
                                  curNameInGroup = curGroupName +":"+ curGroupStyleNames[j];
                                  myParagraphStyleNames.push(curNameInGroup);
              return myParagraphStyleNames;
    function myGetCharacterStyleNames()
    // Получаем список символьных стилей
              var curGroup;
              var curGroupName;
              var curNameInGroup;
              var myCharacterStyleNames = app.activeDocument.characterStyles.everyItem().name;
              myCharacterStyleNames.shift(); // удаление стиля None
              var charGroups = app.activeDocument.characterStyleGroups;
              var charStyleGroupLen = charGroups.length;
              for(var i=0; i < charStyleGroupLen; i++)
                        curGroup = charGroups[i];
                        curGroupName = charGroups[i].name;
                        curGroupStyleNames = curGroup.characterStyles.everyItem().name;
                        for (j=0; j< curGroupStyleNames.length; j++)
                                  curNameInGroup = curGroupName +":"+ curGroupStyleNames[j];
                                  myCharacterStyleNames.push(curNameInGroup);
              } //for
              return myCharacterStyleNames;
    } // fnc
    function myGetObjStyleNames()
        var curGroup;
              var curGroupName;
              var curNameInGroup;
              var myObjStyleNames = app.activeDocument.objectStyles.everyItem().name;
        myObjStyleNames.shift();
        var objGroups = app.activeDocument.objectStyleGroups;
        var objStyleGroupLen = objGroups.length;
        for(var i=0; i < objStyleGroupLen; i++)
                        curGroup = objGroups[i];
                        curGroupName = objGroups[i].name;
                        curGroupStyleNames = curGroup.objectStyles.everyItem().name;
                        for (var j=0; j< curGroupStyleNames.length; j++)
                                  curNameInGroup = curGroupName +":"+ curGroupStyleNames[j];
                                  myObjStyleNames.push(curNameInGroup);
              } //for
        return myObjStyleNames;
    } // fnc
    function myDialog(myParaStyleList, myCharStyleList, myObjStyleList)
        var myDialog = new Window('dialog', 'Create anchored text frames');
        this.windowRef = myDialog;
              myDialog.orientation = "column";
        myDialog.alignChildren = ['fill', 'fill'];
        // добавляем панель 1 с элементами управления
        myDialog.Pnl1 = myDialog.add("panel", undefined, "Move the text in linked frames");
              myDialog.Pnl1.orientation = "column";
        myDialog.Pnl1.alignChildren = "left";
        myDialog.Pnl1.pstyle = myDialog.Pnl1.add('checkbox', undefined, "Text with the paragraph style");
        myDialog.Pnl1.pstyle.value = false;
        myDialog.Pnl1.dropdownParaStyle = myDialog.Pnl1.add("dropdownlist", undefined, myParaStyleList);
        myDialog.Pnl1.dropdownParaStyle.title = "Select the paragraph style ";
        myDialog.Pnl1.dropdownParaStyle.minimumSize = [250,20];
        myDialog.Pnl1.dropdownParaStyle.enabled = false;
        myDialog.Pnl1.dropdownParaStyle.selection = 0;
        if(myCharStyleList.length)
            myDialog.Pnl1.сstyle = myDialog.Pnl1.add('checkbox', undefined, "Text with character style");
            myDialog.Pnl1.сstyle.value = false;
            myDialog.Pnl1.dropdownCharStyle = myDialog.Pnl1.add("dropdownlist", undefined, myCharStyleList );
            myDialog.Pnl1.dropdownCharStyle.title = "Select the character style ";
            myDialog.Pnl1.dropdownCharStyle.minimumSize = [250,20];
            myDialog.Pnl1.dropdownCharStyle.enabled = false;
            myDialog.Pnl1.dropdownCharStyle.selection = 0;
            myDialog.Pnl1.pstyle.onClick = function()
                if(this.value) {
                    myDialog.Pnl1.dropdownParaStyle.enabled = true;
                    myDialog.Pnl1.dropdownCharStyle.enabled = false;
                    myDialog.Pnl1.сstyle.value = false;
                else
                    myDialog.Pnl1.dropdownParaStyle.enabled = false;
                    myDialog.Pnl1.dropdownCharStyle.enabled = true ;
                    myDialog.Pnl1.сstyle.value = true;
            }// fnc
            myDialog.Pnl1.сstyle.onClick = function()
                if(this.value)
                    myDialog.Pnl1.dropdownCharStyle.enabled = true;
                    myDialog.Pnl1.dropdownParaStyle.enabled = false;
                    myDialog.Pnl1.pstyle.value = false;
                else
                    myDialog.Pnl1.dropdownCharStyle.enabled = false;
                    myDialog.Pnl1.dropdownParaStyle.enabled = true ;
                    myDialog.Pnl1.pstyle.value = true;
            }// fnc
        }//  if(myCharStyleList.length)
        else
            myDialog.Pnl1.pstyle.onClick = function()
                if(this.value)
                    myDialog.Pnl1.dropdownParaStyle.enabled = true;
                else
                    myDialog.Pnl1.dropdownParaStyle.enabled = false;
    //  Вторая панель
        myDialog.Pnl2 = myDialog.add("panel", undefined, "Parameters of the text frame");
              myDialog.Pnl2.orientation = "column";
        myDialog.Pnl2.alignChildren = "left"; 
        myDialog.Pnl2.dropdownObjStyle = myDialog.Pnl2.add("dropdownlist", undefined, myObjStyleList );
        myDialog.Pnl2.dropdownObjStyle.title = "Select an object style ";
        myDialog.Pnl2.dropdownObjStyle.minimumSize = [250,20];
        myDialog.Pnl2.dropdownObjStyle.enabled = true;
        myDialog.Pnl2.dropdownObjStyle.selection = 0;
        myDialog.Pnl2.Group1 = myDialog.Pnl2.add( "group" );
        myDialog.Pnl2.Group1.stxt1 = myDialog.Pnl2.Group1.add("statictext", undefined, "The width of the text frame");
        myDialog.Pnl2.Group1.etxt = myDialog.Pnl2.Group1.add("edittext", undefined, "40");
        myDialog.Pnl2.Group1.etxt.characters = 10;
        myDialog.Pnl2.Group1.dropdownMeasurementUnits = myDialog.Pnl2.Group1.add("dropdownlist", undefined, myMeasureUnits );
        myDialog.Pnl2.Group1.dropdownMeasurementUnits.maximumSize = [80,20];
        myDialog.Pnl2.Group1.dropdownMeasurementUnits.selection = 0;
        //myDialog.Pnl2.Group1.stxt2 = myDialog.Pnl2.Group1.add("statictext", undefined, "mm ");
        /*myDialog.Pnl2.Group2 = myDialog.Pnl2.add( "group" );
        myDialog.Pnl2.Group2.stxt1 = myDialog.Pnl2.Group2.add("statictext", undefined, "Высота привязанного фрейма  ");
        myDialog.Pnl2.Group2.etxt = myDialog.Pnl2.Group2.add("edittext", undefined, "30");
        myDialog.Pnl2.Group2.etxt.characters = 10;
        //myDialog.Pnl2.Group2.stxt2 = myDialog.Pnl2.Group2.add("statictext", undefined, "mm ");*/
        myDialog.Pnl2.stxt1 = myDialog.Pnl2.add("statictext", undefined, "Attention! When you enter fractional values as");
        myDialog.Pnl2.stxt2 = myDialog.Pnl2.add("statictext", undefined, "the decimal part, should be used");
        myDialog.Pnl2.stxt3 = myDialog.Pnl2.add("statictext", undefined, "point, not comma.");
        myDialog.Pnl2.stxt1.graphics.foregroundColor = myDialog.Pnl2.stxt1.graphics.newPen (myDialog.Pnl2.stxt1.graphics.PenType.SOLID_COLOR, [1, 0, 0, 1], 1);
        myDialog.Pnl2.stxt2.graphics.foregroundColor = myDialog.Pnl2.stxt2.graphics.newPen (myDialog.Pnl2.stxt2.graphics.PenType.SOLID_COLOR, [1, 0, 0, 1], 1);
        myDialog.Pnl2.stxt3.graphics.foregroundColor = myDialog.Pnl2.stxt3.graphics.newPen (myDialog.Pnl2.stxt3.graphics.PenType.SOLID_COLOR, [1, 0, 0, 1], 1);
        // --------- кнопки --------------
        var myGroup = myDialog.add( "group" );
        myGroup.orientation = 'row';
        myGroup.alignChildren = ['fill', 'fill']; 
        myGroup.okButton = myGroup.add( "button", undefined, "OK" );
        myGroup.okButton.onClick = function()
            if(myCharStyleList.length) // есть символьные стили в документе
                if(!myDialog.Pnl1.pstyle.value && !myDialog.Pnl1.сstyle.value)
                    alert("You must select a paragraph style or character style");
                    return ;
                if(myDialog.Pnl1.pstyle.value) { pStyleIndex= myDialog.Pnl1.dropdownParaStyle.selection.index; cStyleIndex = null;}
                else {cStyleIndex = myDialog.Pnl1.dropdownCharStyle.selection.index; pStyleIndex=null; }
            else // нет символьных стилей
                if(!myDialog.Pnl1.pstyle.value)
                    alert("You must select a paragraph style");
                    return;
                pStyleIndex = myDialog.Pnl1.dropdownParaStyle.selection.index;
                cStyleIndex = null;
            } //  else // нет символьных стилей
           oStyleIndex = myDialog.Pnl2.dropdownObjStyle.selection.index;
           if(myDialog.Pnl2.Group1.etxt.text =="")
               alert("Enter the width of the text frame");
               return;
            else
                myW = myDialog.Pnl2.Group1.etxt.text;
                myH = myW;
            /*if(myDialog.Pnl2.Group2.etxt.text == "")
                alert("Введите высоту привязанного фрейма");
                return;
            else
                myH = myDialog.Pnl2.Group2.etxt.text;
           selectUnits = myDialog.Pnl2.Group1.dropdownMeasurementUnits.selection.index;
            myDialog= this.window.close( 1 );
        myGroup.cancelButton = myGroup.add( "button", undefined, "Cancel" );
        myGroup.cancelButton.onClick = function() { myDialog = this.window.close( 0 ); }
        myDialog.Pnl3 = myDialog.add("panel", undefined, "");
        myDialog.Pnl2.alignChildren = "left";
        myDialog.Pnl3.stxt = myDialog.Pnl3.add("statictext", undefined, "(с) Thomas Silkjær        (с) Борис Кащеев, www.adobeindesign.ru ");
        return myDialog;   
    } // fnc
    function getParagraphStyleByName(myStyleName)
              var DocParaStyles = app.activeDocument.paragraphStyles;
              var DocParaGroups = app.activeDocument.paragraphStyleGroups;
              myStyleName = ""+myStyleName;
              var pos = myStyleName.indexOf(":")
              if(pos == -1)
              // стиль не в группе
              var myStyle = DocParaStyles.item(myStyleName);
                        return myStyle;
              } //if
              else
                        var myGroupAndStyleNames = myStyleName.split(":")
                        var myGroupName = myGroupAndStyleNames[0];
                        var myStyleName = myGroupAndStyleNames[1];
                        var myGroup =DocParaGroups.item(myGroupName);
                        return myGroup.paragraphStyles.item(myStyleName);
    } // fnc
    function getCharacterStyleByName(myStyleName)
              var DocChStyles = app.activeDocument.characterStyles;
              var DocCharGroups = app.activeDocument.characterStyleGroups;
              // Есть ли в имени полученного символьного стиля двоеточие? (двоеточие разделяет название группы стилей и название стиля)
              myStyleName = String (myStyleName);
              var pos = myStyleName.indexOf(":");
              if(pos == -1)
              // стиль не в группе
                        return DocChStyles.item(myStyleName)
              } //if...
              else
              {// Стиль в какой-то группе
                        var myGroupAndStyleNames = myStyleName.split(":")
                        var myGroupName = myGroupAndStyleNames[0];
                        var myStyleName = myGroupAndStyleNames[1];
                        var myGroup = DocCharGroups.item(myGroupName);
                        return myGroup.characterStyles.itemByName(myStyleName);
              } // else
    } // fnc()+
    function getObjectStyleByName(myStyleName)
        var DocObjStyles = app.activeDocument.objectStyles;
        var DocCObjGroups = app.activeDocument.objectStyleGroups;
        myStyleName = String (myStyleName);
        var pos = myStyleName.indexOf(":");
        if(pos == -1)
              // стиль не в группе
                        return DocObjStyles.item(myStyleName);
              } //if...
        var myGroupAndStyleNames = myStyleName.split(":");
        var myGroupName = myGroupAndStyleNames[0];
        var myStyleName = myGroupAndStyleNames[1];
        var myGroup = DocObjGroups.item(myGroupName);
                        return myGroup.objectStyles.itemByName(myStyleName);
    } //fnc
    function resetGREPfindChange()
        app.changeGrepPreferences = NothingEnum.nothing;
        app.findGrepPreferences = NothingEnum.nothing;
        app.findChangeGrepOptions.includeFootnotes = false;
        app.findChangeGrepOptions.includeHiddenLayers = false;
        app.findChangeGrepOptions.includeLockedLayersForFind = false;
        app.findChangeGrepOptions.includeLockedStoriesForFind = false;
        app.findChangeGrepOptions.includeMasterPages = false;
    function createAnchoredFrame(myText, myObjStyle)
        var myGeometricBounds = [];
        var myInsertionPoint = myText.insertionPoints[0];
        myInsertionPoint.select;
        var AnchoredTextFrame = myInsertionPoint.textFrames.add();
        myGeometricBounds = AnchoredTextFrame.geometricBounds;
        //alert(parseFloat(myH) + " " + parseFloat(myW))
        myGeometricBounds[2] = myGeometricBounds[0] + parseFloat(myH);
        myGeometricBounds[3] = myGeometricBounds[1] + parseFloat(myW);
        AnchoredTextFrame.geometricBounds = myGeometricBounds;
        AnchoredTextFrame.anchoredObjectSettings.anchoredPosition = AnchorPosition.anchored;
        myText.move(LocationOptions.before, AnchoredTextFrame.texts[0]);
        AnchoredTextFrame.appliedObjectStyle = myObjStyle;
        AnchoredTextFrame.fit(FitOptions.CONTENT_TO_FRAME);
        var FO = FitOptions.FRAME_TO_CONTENT,
        tfs = ([]).concat.apply([], app.activeDocument.stories.everyItem().textContainers),
        t, i = tfs.length;
    while( i-- ) (t=tfs[i]).overflows && ( t.locked || t.fit(FO) );
    } //fnc
    main();

    Hi Cari,
    I did create a new user account (admin level) and InDesign works like a charm.
    When I went back to the other account, plug-ins gone, I deleted the prefs and caches, restarted and still everything is crashing as before.
    At least I am working on one account and I will contiue to troubleshoot on the other account. And at some point either the new account will crash or the old account will work and I will go from there.
    Thanks for the info about Mac remembering info. Always trying to be helpful these Macs.
    And thanks for getting at least into a workable space!!! I am supremely grateful!

  • Can I Extract a Frame from a Video (in Lightroom 3 or Photoshop CS5)?

    I'm running Windows 7 and have Lightroom 3 and Photoshop CS5.  Extracting a frame from a .MOV file is way over my head, but I want to try.  Right now the file is in Lightroom, but the "Open in" options are grayed out.  I have exported the file to my desktop, and  I can play the video with Windows Media Player.  I bet somewhere, somehow there is a way to do what I want.  Any help, ideas or references would be much appreciated!

    When you say "Extract a frame", do you mean saving one of the frames as an image from Photoshop?
    Here's what you can do:
    1. Open the video in Photoshop, File > Open, and choose the .mov file.
    2. Once the video opens in Photoshop, open the Animation panel, Window > Animation
    3. In the Animation panel move the playhead to the desired frame, and save it as an image, File > Save As.
    and Voila!
    Any questions, just ask. I'll be more than happy to help.
    Marek Mularczyk
    http://SaiTraining.co.uk
    http://PhotoshopLightroomBridge.co.uk
    http://PhotoshopLightroomTV.com

  • Selecting text from insertion point

    I want to select all of the text from the insertion point to the end of the file. The instructions I can find for this say to shift-click. I insert the cursor in the text and hold down the shift key and click, and nothing happens. Any suggestions?

    You must shift+click at the position you want to select to. If your cursor is here | and you shift+click here ->, everything from "and" to "here" is selected. So to select from your current position up to the end of a story, set your cursor to the start, scroll to the last visible character of that story (it only works with one continuous story, in multiple connected text frames) and shift+click there. The end of the current story is marked by a # -- visible with "Show Invisible Characters".
    It's easier to use the keyboard for this particular task. Cmd (or Ctrl) + End moves the cursor to the end of the current story, even if it's not visible on screen! (If that's the case, the last text frame has a bright red + on its lower right.) To select from the current position to the end, hold down Shift as well.
    These are the usual mouse operations and keystrokes for selecting text in any text editing app I could think of, on both Windows and Mac.

  • Re: how to capture a frame from a video file and save it as a jpeg

    package com.snn.multimedia;
    * @(#)FrameAccess.java     1.5 01/03/13
    * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
    * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
    * modify and redistribute this software in source and binary code form,
    * provided that i) this copyright notice and license appear on all copies of
    * the software; and ii) Licensee does not utilize the software in a manner
    * which is disparaging to Sun.
    * This software is provided "AS IS," without a warranty of any kind. ALL
    * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
    * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
    * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
    * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
    * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
    * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
    * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
    * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
    * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
    * POSSIBILITY OF SUCH DAMAGES.
    * This software is not designed or intended for use in on-line control of
    * aircraft, air traffic, aircraft navigation or aircraft communications; or in
    * the design, construction, operation or maintenance of any nuclear
    * facility. Licensee represents and warrants that it will not use or
    * redistribute the Software for such purposes.
    import java.util.Date;
    import java.util.Arrays;
    import java.util.Iterator;
    import javax.imageio.ImageIO;
    import javax.imageio.stream.ImageOutputStream;
    import javax.imageio.ImageWriter;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.image.DataBufferByte;
    import javax.media.*;
    import javax.media.control.FramePositioningControl;
    import javax.media.control.TrackControl;
    import javax.media.Format;
    import javax.media.format.*;
    import javax.media.util.BufferToImage;
    import javax.media.util.ImageToBuffer;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import com.sun.image.codec.jpeg.*;
    * Sample program to access individual video frames by using a
    * "pass-thru" codec. The codec is inserted into the data flow
    * path. As data pass through this codec, a callback is invoked
    * for each frame of video data.
    public class FrameAccess extends java.awt.Frame implements ControllerListener
    Processor p;
    Object waitSync = new Object();
    boolean stateTransitionOK = true;
    * Given a media locator, create a processor and use that processor
    * as a player to playback the media.
    * During the processor's Configured state, two "pass-thru" codecs,
    * PreAccessCodec and PostAccessCodec, are set on the video track.
    * These codecs are used to get access to individual video frames
    * of the media.
    * Much of the code is just standard code to present media in JMF.
    public boolean open(MediaLocator ml)
    try
    p = Manager.createProcessor(ml);
    catch (Exception e)
    System.err.println("Failed to create a processor from the given url: "
    + e);
    return false;
    p.addControllerListener(this);
    // Put the Processor into configured state.
    p.configure();
    if (!waitForState(p.Configured))
    System.err.println("Failed to configure the processor.");
    return false;
    // So I can use it as a player.
    p.setContentDescriptor(null);
    // Obtain the track controls.
    TrackControl tc[] = p.getTrackControls();
    if (tc == null)
    System.err.println("Failed to obtain track controls from the processor.");
    return false;
    // Search for the track control for the video track.
    TrackControl videoTrack = null;
    for (int i = 0; i < tc.length; i++)
    if (tc.getFormat() instanceof VideoFormat)
    videoTrack = tc[i];
    break;
    if (videoTrack == null)
    System.err.println("The input media does not contain a video track.");
    return false;
    VideoFormat currentFormat = (VideoFormat)videoTrack.getFormat();
    System.err.println("Video format: " + videoTrack.getFormat() );
    videoTrack.setFormat(new VideoFormat("RGB", currentFormat.getSize(), currentFormat.getMaxDataLength(), currentFormat.getDataType(), currentFormat.getFrameRate()));
    // Instantiate and set the frame access codec to the data flow path.
    try
    // Try to retrieve a FramePositioningControl from the player.
    FramePositioningControl fpc = (FramePositioningControl) p.getControl("javax.media.control.FramePositioningControl");
    if (fpc == null)
    System.err.println("The player does not support FramePositioningControl.");
    System.err.println("There's no reason to go on for the purpose of this demo.");
    return false;
    Time duration = p.getStopTime();
    long totalFrames = 0;
    if (duration != Duration.DURATION_UNKNOWN)
    System.err.println("Movie duration: " + duration.getSeconds());
    totalFrames = fpc.mapTimeToFrame(duration);
    if (totalFrames != FramePositioningControl.FRAME_UNKNOWN)
    System.err.println("Total # of video frames in the movies: "
    + totalFrames);
    } else
    System.err.println("The FramePositiongControl does not support mapTimeToFrame.");
    } else
    System.err.println("Movie duration: unknown");
    long[] frames;
    if (totalFrames > 0L)
    double intervalDouble = Math.floor(totalFrames / 5.0);
    long interval = new Double(intervalDouble).longValue();
    frames = new long[5];
    frames[0] = 1;
    frames[1] = frames[0] + interval;
    frames[2] = frames[1] + interval;
    frames[3] = frames[2] + interval;
    frames[4] = frames[3] + interval;
    } else
    frames = new long[1];
    frames[0] = 1;
    // Codec codec[] = { new PreAccessCodec(), new PostAccessCodec()};
    Codec codec[] = { new OverlayCodec(frames)};
    videoTrack.setCodecChain(codec);
    catch (UnsupportedPlugInException e)
    System.err.println("The process does not support effects.");
    // Realize the processor.
    p.prefetch();
    if (!waitForState(p.Prefetched))
    System.err.println("Failed to realize the processor.");
    return false;
    // Display the visual & control component if there's one.
    setLayout(new BorderLayout());
    Component cc;
    Component vc;
    if ((vc = p.getVisualComponent()) != null)
    add("Center", vc);
    if ((cc = p.getControlPanelComponent()) != null)
    add("South", cc);
    // Start the processor.
    p.start();
    setVisible(true);
    return true;
    public void addNotify()
    super.addNotify();
    pack();
    * Block until the processor has transitioned to the given state.
    * Return false if the transition failed.
    boolean waitForState(int state)
    synchronized (waitSync)
    try
    while (p.getState() != state && stateTransitionOK)
    waitSync.wait();
    catch (Exception e)
    return stateTransitionOK;
    * Controller Listener.
    public void controllerUpdate(ControllerEvent evt)
    if (evt instanceof ConfigureCompleteEvent
    || evt instanceof RealizeCompleteEvent
    || evt instanceof PrefetchCompleteEvent)
    synchronized (waitSync)
    stateTransitionOK = true;
    waitSync.notifyAll();
    } else
    if (evt instanceof ResourceUnavailableEvent)
    synchronized (waitSync)
    stateTransitionOK = false;
    waitSync.notifyAll();
    } else
    if (evt instanceof EndOfMediaEvent)
    p.close();
    System.exit(0);
    * Main program
    public static void main(String[] args)
    if (args.length == 0)
    prUsage();
    System.exit(0);
    String url = args[0];
    if (url.indexOf(":") < 0)
    prUsage();
    System.exit(0);
    MediaLocator ml;
    if ((ml = new MediaLocator(url)) == null)
    System.err.println("Cannot build media locator from: " + url);
    System.exit(0);
    FrameAccess fa = new FrameAccess();
    if (!fa.open(ml))
    System.exit(0);
    static void prUsage()
    System.err.println("Usage: java FrameAccess <url>");
    * Inner class.
    * A pass-through codec to access to individual frames.
    public class PreAccessCodec implements Codec
    * Callback to access individual video frames.
    void accessFrame(Buffer frame)
    // For demo, we'll just print out the frame #, time &
    // data length.
    long t = (long) (frame.getTimeStamp() / 10000000f);
    System.err.println("Pre: frame #: " + frame.getSequenceNumber()
    + ", time: " + ((float) t) / 100f + ", len: "
    + frame.getLength());
    * The code for a pass through codec.
    // We'll advertize as supporting all video formats.
    protected Format supportedIns[] = new Format[] {
    new VideoFormat(null)
    // We'll advertize as supporting all video formats.
    protected Format supportedOuts[] = new Format[] {
    new VideoFormat(null)
    Format input = null, output = null;
    public String getName()
    return "Pre-Access Codec";
    // No op.
    public void open()
    // No op.
    public void close()
    // No op.
    public void reset()
    public Format[] getSupportedInputFormats()
    return supportedIns;
    public Format[] getSupportedOutputFormats(Format in)
    if (in == null)
    return supportedOuts;
    } else
    // If an input format is given, we use that input format
    // as the output since we are not modifying the bit stream
    // at all.
    Format outs[] = new Format[1];
    outs[0] = in;
    return outs;
    public Format setInputFormat(Format format)
    input = format;
    return input;
    public Format setOutputFormat(Format format)
    output = format;
    return output;
    public int process(Buffer in, Buffer out)
    // This is the "Callback" to access individual frames.
    accessFrame(in);
    // Swap the data between the input & output.
    Object data = in.getData();
    in.setData(out.getData());
    out.setData(data);
    // Copy the input attributes to the output
    out.setFormat(in.getFormat());
    out.setLength(in.getLength());
    out.setOffset(in.getOffset());
    return BUFFER_PROCESSED_OK;
    public Object[] getControls()
    return new Object[0];
    public Object getControl(String type)
    return null;
    public class OverlayCodec extends PreAccessCodec
    long[] myFrames;
    BufferedImage work;
    byte[] workData;
    int width;
    int height;
    int dataLen;
    RGBFormat supportedRGB = new RGBFormat(null, // size
    Format.NOT_SPECIFIED, // maxDataLength
    Format.byteArray, // dataType
    Format.NOT_SPECIFIED, // frameRate
    24, // bitsPerPixel
    3, 2, 1, // red/green/blue masks
    3, // pixelStride
    Format.NOT_SPECIFIED, // lineStride
    Format.FALSE, // flipped
    Format.NOT_SPECIFIED); // endian
    public OverlayCodec(long[] frames)
    // force specific input format
    supportedIns = new Format[] {
    supportedRGB};
    myFrames = new long[frames.length];
    System.arraycopy(frames, 0, myFrames, 0, frames.length);
    public String getName()
    return "Capture Codec";
    public Format setInputFormat(Format format)
    if ((format != null) && (format instanceof RGBFormat)
    && format.matches(supportedRGB))
    // set up working image if valid type
    // (it should be since we insisted!)
    Dimension size = ((RGBFormat) format).getSize();
    width = size.width;
    height = size.height;
    dataLen = width * height * 3;
    if ((dataLen > 0)
    && ((work == null) || (work.getWidth() != width)
    || (work.getHeight() != height)))
    // working image - same 3-byte format as buffer
    work = new BufferedImage(width, height,
    BufferedImage.TYPE_3BYTE_BGR);
    // reference to pixel data
    workData = ((DataBufferByte) work.getRaster().getDataBuffer()).getData();
    return format;
    * Callback to access individual video frames.
    void accessFrame(Buffer in)
    try
    if (Arrays.binarySearch(myFrames, in.getSequenceNumber()) >= 0)
    BufferToImage stopBuffer = new BufferToImage((VideoFormat) in.getFormat());
    Image stopImage = stopBuffer.createImage(in);
    BufferedImage outImage = new BufferedImage(140, 96,
    BufferedImage.TYPE_INT_RGB);
    Graphics og = outImage.getGraphics();
    og.drawImage(stopImage, 0, 0, 140, 96, null);
    FileOutputStream fout = new FileOutputStream("image"
    + in.getSequenceNumber() + ".jpg");
    writeImage(outImage, fout);
    catch (Exception e)
    e.printStackTrace();
    public int process(Buffer in, Buffer out)
    try
    accessFrame(in);
    BufferToImage stopBuffer = new BufferToImage((VideoFormat) in.getFormat());
    Image stopImage = stopBuffer.createImage(in);
    ImageToBuffer outImagebuffer = new ImageToBuffer();
    out = outImagebuffer.createBuffer(stopImage, p.getRate());
    // Swap the data between the input & output.
    in.copy(out, true);
    catch (Exception e)
    e.printStackTrace();
    return BUFFER_PROCESSED_OK;
    void writeImage(BufferedImage outImage, OutputStream os) throws Exception
    Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
    ImageWriter writer = (ImageWriter) writers.next();
    ImageOutputStream ios = ImageIO.createImageOutputStream(os);
    writer.setOutput(ios);
    writer.write(outImage);
    ios.close();

    Hi,
    I have a jpeg movie file 60 mins long and a text file tell me five time-lines for breaking the movie. For example, break the movie at 10:21, 16:05�
    The final output should be five small jpeg movie files. Each file contains a 90 sec (30 sec before the break time and 60 sec after the break time).
    Do you know any java library (jar) contain the library that can help me on programming this? Any existing source code? Any SDK for a movie editor can do that?
    Please help.
    Thanks
    Kenny

  • This is how you extract frames from video

    right then, in answer to many posts about how to get the individual frames from video, here is my solution. it seems to work with mpg files but it doesnt seem to work with any of the avi files i tried. not sure why it doesnt work with those. i have modified javas frame access.
    nothing is displayed except it prints which frame it is doing.
    if anyone wants to improve it, please do. i still dont understand fully how it works so i probably wont be able to answer many questions about it. anyway here it is:
    * @(#)FrameAccess.java 1.5 01/03/13
    * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
    * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
    * modify and redistribute this software in source and binary code form,
    * provided that i) this copyright notice and license appear on all copies of
    * the software; and ii) Licensee does not utilize the software in a manner
    * which is disparaging to Sun.
    * This software is provided "AS IS," without a warranty of any kind. ALL
    * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
    * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
    * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
    * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
    * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
    * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
    * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
    * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
    * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
    * POSSIBILITY OF SUCH DAMAGES.
    * This software is not designed or intended for use in on-line control of
    * aircraft, air traffic, aircraft navigation or aircraft communications; or in
    * the design, construction, operation or maintenance of any nuclear
    * facility. Licensee represents and warrants that it will not use or
    * redistribute the Software for such purposes.
    import java.awt.*;
    import javax.media.*;
    import javax.media.control.TrackControl;
    import javax.media.Format;
    import javax.media.format.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import java.awt.image.*;
    import java.util.*;
    import javax.media.util.*;
    * Sample program to access individual video frames by using a
    * "pass-thru" codec. The codec is inserted into the data flow
    * path. As data pass through this codec, a callback is invoked
    * for each frame of video data.
    public class FrameAccess implements ControllerListener {
         Processor p;
         Object waitSync = new Object();
         boolean stateTransitionOK = true;
         public boolean alreadyPrnt = false;
         * Given a media locator, create a processor and use that processor
         * as a player to playback the media.
         * During the processor's Configured state, two "pass-thru" codecs,
         * PreAccessCodec and PostAccessCodec, are set on the video track.
         * These codecs are used to get access to individual video frames
         * of the media.
         * Much of the code is just standard code to present media in JMF.
         public boolean open(MediaLocator ml) {
              try {
                   p = Manager.createProcessor(ml);
              } catch (Exception e) {
                   System.err.println(
                        "Failed to create a processor from the given url: " + e);
                   return false;
              p.addControllerListener(this);
              // Put the Processor into configured state.
              p.configure();
              if (!waitForState(Processor.Configured)) {
                   System.err.println("Failed to configure the processor.");
                   return false;
              // So I can use it as a player.
              p.setContentDescriptor(null);
              // Obtain the track controls.
              TrackControl tc[] = p.getTrackControls();
              if (tc == null) {
                   System.err.println(
                        "Failed to obtain track controls from the processor.");
                   return false;
              // Search for the track control for the video track.
              TrackControl videoTrack = null;
              for (int i = 0; i < tc.length; i++) {
                   if (tc.getFormat() instanceof VideoFormat) videoTrack = tc[i];
                   else     tc[i].setEnabled(false);
              if (videoTrack == null) {
                   System.err.println("The input media does not contain a video track.");
                   return false;
              String videoFormat = videoTrack.getFormat().toString();
              Dimension videoSize = parseVideoSize(videoFormat);
              System.err.println("Video format: " + videoFormat);
              // Instantiate and set the frame access codec to the data flow path.
              try {
                   Codec codec[] = { new PostAccessCodec(videoSize)};
                   videoTrack.setCodecChain(codec);
              } catch (UnsupportedPlugInException e) {
                   System.err.println("The process does not support effects.");
              // Realize the processor.
              p.prefetch();
              if (!waitForState(Processor.Prefetched)) {
                   System.err.println("Failed to realise the processor.");
                   return false;
              p.start();
              return true;
         /**parse the size of the video from the string videoformat*/
         public Dimension parseVideoSize(String videoSize){
              int x=300, y=200;
              StringTokenizer strtok = new StringTokenizer(videoSize, ", ");
              strtok.nextToken();
              String size = strtok.nextToken();
              StringTokenizer sizeStrtok = new StringTokenizer(size, "x");
              try{
                   x = Integer.parseInt(sizeStrtok.nextToken());
                   y = Integer.parseInt(sizeStrtok.nextToken());
              } catch (NumberFormatException e){
                   System.out.println("unable to find video size, assuming default of 300x200");
              System.out.println("Image width = " + String.valueOf(x) +"\nImage height = "+ String.valueOf(y));
              return new Dimension(x, y);
         * Block until the processor has transitioned to the given state.
         * Return false if the transition failed.
         boolean waitForState(int state) {
              synchronized (waitSync) {
                   try {
                        while (p.getState() != state && stateTransitionOK)
                             waitSync.wait();
                   } catch (Exception e) {
              return stateTransitionOK;
         * Controller Listener.
         public void controllerUpdate(ControllerEvent evt) {
              if (evt instanceof ConfigureCompleteEvent
                   || evt instanceof RealizeCompleteEvent
                   || evt instanceof PrefetchCompleteEvent) {
                   synchronized (waitSync) {
                        stateTransitionOK = true;
                        waitSync.notifyAll();
              } else if (evt instanceof ResourceUnavailableEvent) {
                   synchronized (waitSync) {
                        stateTransitionOK = false;
                        waitSync.notifyAll();
              } else if (evt instanceof EndOfMediaEvent) {
                   p.close();
                   System.exit(0);
         * Main program
         public static void main(String[] args) {
              if (args.length == 0) {
                   prUsage();
                   System.exit(0);
              String url = args[0];
              if (url.indexOf(":") < 0) {
                   prUsage();
                   System.exit(0);
              MediaLocator ml;
              if ((ml = new MediaLocator(url)) == null) {
                   System.err.println("Cannot build media locator from: " + url);
                   System.exit(0);
              FrameAccess fa = new FrameAccess();
              if (!fa.open(ml))
                   System.exit(0);
         static void prUsage() {
              System.err.println("Usage: java FrameAccess <url>");
         * Inner class.
         * A pass-through codec to access to individual frames.
         public class PreAccessCodec implements Codec {
              * Callback to access individual video frames.
              void accessFrame(Buffer frame) {
                   // For demo, we'll just print out the frame #, time &
                   // data length.
                   long t = (long) (frame.getTimeStamp() / 10000000f);
                   System.err.println(
                        "Pre: frame #: "
                             + frame.getSequenceNumber()
                             + ", time: "
                             + ((float) t) / 100f
                             + ", len: "
                             + frame.getLength());
              * The code for a pass through codec.
              // We'll advertize as supporting all video formats.
              protected Format supportedIns[] = new Format[] { new VideoFormat(null)};
              // We'll advertize as supporting all video formats.
              protected Format supportedOuts[] = new Format[] { new VideoFormat(null)};
              Format input = null, output = null;
              public String getName() {
                   return "Pre-Access Codec";
              //these dont do anything
              public void open() {}
              public void close() {}
              public void reset() {}
              public Format[] getSupportedInputFormats() {
                   return supportedIns;
              public Format[] getSupportedOutputFormats(Format in) {
                   if (in == null)
                        return supportedOuts;
                   else {
                        // If an input format is given, we use that input format
                        // as the output since we are not modifying the bit stream
                        // at all.
                        Format outs[] = new Format[1];
                        outs[0] = in;
                        return outs;
              public Format setInputFormat(Format format) {
                   input = format;
                   return input;
              public Format setOutputFormat(Format format) {
                   output = format;
                   return output;
              public int process(Buffer in, Buffer out) {
                   // This is the "Callback" to access individual frames.
                   accessFrame(in);
                   // Swap the data between the input & output.
                   Object data = in.getData();
                   in.setData(out.getData());
                   out.setData(data);
                   // Copy the input attributes to the output
                   out.setFlags(Buffer.FLAG_NO_SYNC);
                   out.setFormat(in.getFormat());
                   out.setLength(in.getLength());
                   out.setOffset(in.getOffset());
                   return BUFFER_PROCESSED_OK;
              public Object[] getControls() {
                   return new Object[0];
              public Object getControl(String type) {
                   return null;
         public class PostAccessCodec extends PreAccessCodec {
              // We'll advertize as supporting all video formats.
              public PostAccessCodec(Dimension size) {
                   supportedIns = new Format[] { new RGBFormat()};
                   this.size = size;
              * Callback to access individual video frames.
              void accessFrame(Buffer frame) {
                   // For demo, we'll just print out the frame #, time &
                   // data length.
                   if (!alreadyPrnt) {
                        BufferToImage stopBuffer = new BufferToImage((VideoFormat) frame.getFormat());
                        Image stopImage = stopBuffer.createImage(frame);
                        try {
                             BufferedImage outImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
                             Graphics og = outImage.getGraphics();
                             og.drawImage(stopImage, 0, 0, size.width, size.height, null);
                             //prepareImage(outImage,rheight,rheight, null);
                             Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
                             ImageWriter writer = (ImageWriter) writers.next();
                             //Once an ImageWriter has been obtained, its destination must be set to an ImageOutputStream:
                             File f = new File(frame.getSequenceNumber() + ".jpg");
                             ImageOutputStream ios = ImageIO.createImageOutputStream(f);
                             writer.setOutput(ios);
                             //Finally, the image may be written to the output stream:
                             //BufferedImage bi;
                             //writer.write(imagebi);
                             writer.write(outImage);
                             ios.close();
                        } catch (IOException e) {
                             System.out.println("Error :" + e);
                   //alreadyPrnt = true;
                   long t = (long) (frame.getTimeStamp() / 10000000f);
                   System.err.println(
                        "Post: frame #: "
                             + frame.getSequenceNumber()
                             + ", time: "
                             + ((float) t) / 100f
                             + ", len: "
                             + frame.getLength());
              public String getName() {
                   return "Post-Access Codec";
              private Dimension size;

    The quality of the produced video from this example is very poor.
    It comes to huuuuge surprise the following fact.
    If you comment the line where you set the PostAccessCodec, the chain of the codecs is:
    MPEG-1 decoder -> YUV2RGB -> Direct Draw Renderer. ( The one used from the system to decode and render)
    If you run the example purely as is above you get the following sequence(as long with the poor quality):
    MPEG-1 decoder -> YUV2RGB -> Windows GDI Renderer.
    So you say lets set another Renderer. So
    you add the following line videoTracker.setRenderer( new DDRenderer() )
    What comes to a surprise is the following chain of codecs:
    MPEG-1 decoder -> YUV2RGB -> Post Codec -> Java RGB Converter - > DDRenderer
    The quality now may be perfect but video runs to slow. The surprising thing here is that even though we have set the outputFormat of the PostAccessFrame codec to RGBFormat the system converts it again to RGB through codec Java RGB Format.
    After searching a lot and reaching the conclusion that the deference between the 2 RGB's is their sizes I sudently was brought in front of a method called grabFrame(). Bels started ringing inside my head. Starts were comming up. Looking at the definition of the class com.sun.media.renderer.video.DDRenderer I descovered that this damn class implements the FrameGrabbingControl Interface. What the f.....? The problem that consumed 4 days of my life and multiplied with 10 to give hours has finally come to an and.
    Summing up the solution for grabbing frames is this!!!!!
    DDRenderer renderer = new DDRenderer();
    videoTrack.setRenderer( renderer );
    and in your actionPerformed implementation
    FrameGrabbingControl fr = (FrameGrabbingControl)renderer.getControl( "javax.media.control.FrameGrabbingControl");
    Buffer frame = fr.grabFrame();
    The following stuff ...are stated in FrameAccess
    --Sniper

  • [JS][CS3-CS5] anchored objects/inline back to text

    g'day there.
    been handed a reformatting job where the client has supplied text in word with additional textframes (they have made callouts next to their body text), meaning when the text is imported into indesign, the text has hundreds of anchored objects containing the callouts. is it possible to take these anchored objects and convert them back into the actual main textframe? ATM, the only way to do this would be to cut and paste.
    i have done a search on the forums and elsewhere to remedy this and there are plenty of threads advising on how to take text and make anchored objects out of them, but what i want to do is the reverse.
    thank you.
    colly

    i feel strange answering my own question, but i stumbled across this older applescript and it seemed to do the trick, so thought i'd put it out there.
    tell application "InDesign CS5"
        tell document 1
          set thetextframes to text frames
          repeat with aframe in thetextframes
             set theCount to count of (text frames of aframe)
             tell aframe
                 repeat with i from theCount to 1 by -1
                   set boxContents to paragraphs of text frame i of aframe as string
                   set contents of first insertion point of parent of text frame i to boxContents
                   delete text frame i of aframe
                 end repeat
             end tell
          end repeat
       end tell
    end tell
    full credit to peter kincaid who wrote the script. all i did to make it work was just to tell the application CS5 rather than CS1 which was in the original script.
    the actual site i found the script at was:
    http://olivier.berquin.free.fr/indesign/indesign_cs1.html

  • [JS CS3] Modify geometricBounds of Inline Frames in Overset Text

    Hello,
    I have the following setting:
    I recieve a XML file , which contains <image href="..."> tags. InDesign automatically inserts the correct images as an inline frame.
    The layout column are too small for the large images, so when placing the XML into the layout, the whole content is in the overset.
    Inline frames in the overset do not have any geometricBounds. Can I modify width & height of frames in overset text? And how do I do that?
    Thanks
    Tobias

    Thanks Robin!
    I helped myself with the following:
    with(myElement){
         // get img objects
         var theImage = myElement.xmlContent;
         var theImageFrame = theImage.parent;
         theImageFrame.appliedObjectStyle = myDocument.objectStyles.item("Img_free");
    The objectStyle "Img_free" sets the image frame from "inline" to "anchored frame". So the size of the image doesn't matter any more because its outside ("free") of the text. So everything flows into visibility and I can change whatever I want. (Yes, I must not do this with a object style, but it felt right to do so.)
    It's basically a similar way to your description. But I had hoped that there would be a somewhat "cleaner" way to do that. In my eyes it is more a workaround ...
    Any further suggestions?
    (How do people scripting InDesign Server do such things?)
    Thanks
    Tobias

  • Close ADF Popup Dialog with html button in Inline Frame

    hi,
    I'm using jdev 11.1.1.2,
    I have a adf popup dialog which contains an Inline Frame(source is a jsp file).I want to close the dialog with a html submit button in the frame page. when the submit button is clicked, auto close the dialog.
    can anyone help in this.
    Thanks

    Try to close the popup from Javascript using a sciptlet similar to the following one:
    var popup = AdfPage.PAGE.findComponent('<yourPopupClientId>');
    if (popup.isPopupVisible()) {
      popup.hide();
    }where <tt><yourPopupClientId></tt> should be replaced with the popup's client ID. The client ID is composed of the popup's ID from the <af:popup> tag preceded with IDs of the eventual parent naming containers where the popup has been declared.
    For example, if the tag is <tt><af:popup id="myPopup"></tt>, then the clientId might be:
    <tt>  myPopup
      container1:myPopup
      container1:container2:myPopup</tt>
    ... and so on, depending on where you have defined the popup in your JSF page (i.e. within which naming containers), you should determine it first.

  • Extraction Key Frames from a video

    Hi all,
    I would like to know what is the best way to extract keyframe from a video.
    My Status (butr I can cahnge it)
    I'm Marco and I'm using JMF; I need for an help because I don't know how to extract keyframes from AVI and MPG files.
    I'm using the code posted in this forum for extracting all frame in a video with the adding of an if expression that in the accessFrame method that I report below:
    void accessFrame(Buffer frame) {
    BufferToImage stopBuffer = new BufferToImage((VideoFormat) frame.getFormat());
    Image stopImage = stopBuffer.createImage(frame);
    try {
    BufferedImage outImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
    Graphics og = outImage.getGraphics();
    og.drawImage(stopImage, 0, 0, size.width, size.height, null);
    Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
    ImageWriter writer = (ImageWriter) writers.next();
    File f = new File(frame.getSequenceNumber() + ".jpg");
    if ((frame.getFlags() & Buffer.FLAG_KEY_FRAME) != 0){{color}
    {color:#ff9900}
    ImageOutputStream ios = ImageIO.createImageOutputStream(f);
    writer.setOutput(ios);
    {color:#ff9900}
    writer.write(outImage);
    ios.close();}
    } catch (IOException e) {{color}
    System.out.println("Error :" + e);
    So, I'm able to extract some keyframe, but i'm not sure it is the correct way and my dubt grows out of the fact that without the if expression highlighted in red, it seems that I have more keyframes (those ones with flag ==1040). Another problem is that it works only with AVI because MPG instead of 1040, they have alternate sequence of 32 and 1056.
    Cheers and thank u
    Marco

    >
    With the code yoodleyee posted, frames can be extracted and converted from the raw decoded format into images, but no guarantee that the frame extracted is a key frame, isnt it?Actually, there is such a guarantee...because the FrameGrabbingControl isn't implemented in any video format that uses keyframes. So, if it works, then every frame of the video is a keyframe, and it won't work otherwise.
    How can key frames be detected with JMF and then extracted with the code provided? Any tutorial or sample code about that?They can't be. You can write a custom codec that will give you access to every frame, regardless of the format, if you're wanting to get all of the frames.
    Example: [http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/FrameAccess.html]
    But JMF doesn't have any way of dealing with key frames directly, at least that I am aware of.

  • Print Out Still Frames From HD Video

    I am importing HD video into iMovie 08. I have made a few still frames from the video for printing. I could not export them to iPhoto or Photoshop Elements 2.
    How can I make HD video prints? Do I need new software?

    I have made a few still frames from the video for printing. I could not export them to iPhoto or Photoshop Elements 2.
    Select the "still frame" sequence and use the "Reveal in Finder" option to take you to the saved "still image" in the named_Project package. If you then double-click the image, it will open in Preview. Using Preview, you can print the image or save it to any of the available image formats in any "visible" location for later access by whatever graphic application you wish to use.

  • Match frame from subclip to original full clip?

    Can anybody tell me if it is possible to match frame from a subclip to the original full clip?  When I match frame from a clip in my timeline that came from a subclip, the subclip loads into the source monitor.  I can't find how to then match frame from that back to the original.  I am relatively new to Premiere Pro, and this is a very very useful feature over in Avid land.
    Thanks.

    Thanks for elaborating.
    You can achieve at least part of what you describe by making your subclips "soft." To do so at creation-time, in the Make Subclip dialog, uncheck the option "Restrict Trims to Subclip Boundaries." To convert an existing "hard" subclip, access the Edit Subclip dialog (Clip>Edit Subclip, or right-click>Edit Subclip, or define a keyboard shortcut and use that) and uncheck the option.
    Soft and hard subclips behave differently in two notable ways:
    when you doubleclick a soft subclip in the Timeline, the Source Monitor loads the whole clip. The zoom/scrub bar is zoomed in to the In/Out range of what's used in the sequence, but you can zoom out to view the whole thing. Note that Match Frame does not load the clip in the same way--you're not able to zoom out. However, double-clicking a clip automatic matches frame (if the playhead is over the clip you clicked).
    You can trim out beyond the defined Subclip Boundaries, either in the Timeline or Source Monitor.
    Now, if you want to create a completely new subclip for a different segment, there's no direct command for that, but it's achievable through a series of steps that you may find easier than restarting from the original master clip. (Almost all of the following commands can be executed via keyboard shortcuts.)
    Reveal in Project (from Timeline or Source Mon)
    Duplicate
    Load the dupe in the Source Monitor
    Edit Subclip
    Select the option "Convert to Master Clip" checkbox and click OK.
    At this point, the whole clip will be loaded in the Source Monitor, zoomed to the subclip's In/Out range but without In/Out points set. You can set new In/Out points, then save a new subclip.
    As to why PPro does not maintain a master/sub relationship, I'm afraid I have no clue. I'd say it merits a feature request--both to maintain the link and, naturally, to provide a way to jump from the subclip to the master. You can submit such a request here: http://www.adobe.com/go/wish

  • For a wesite I get this error in firefox, "Sorry, Netscape 4 cannot show inline frames", other browsers are able to open it.

    For a wesite I get this error in firefox, "Sorry, Netscape 4 cannot show inline frames", other browsers are able to open it.

    I uninstalled all the old flash players and installed the flash player v16.0.0.235 from the Adobe website posted.
    And Firefox is still the same. It takes forever to web search, It takes a long time to get on Youtube, and a longer time now to open a video..
    It's actual worse since I upgraded to the newer flash player.
    I'll do one more fifefox reset (this is the 8th one in a week)
    and it works for a few hrs, and goes back to the slowww way of working...
    Many of my friends I talked to about this, told me to switch over to Chrome like they had to do..
    I guess that's the only alternative now..
    Thankyou all for your help and suggestions anyway.. :)

Maybe you are looking for