Select all objects with font-size between two sizes in illustrator?

China☆狼群 提交于 2019-12-04 14:39:39
Loic Aigon

This seems to be the candidate for a script. Try this:

function selectTextWhosePointSizeIs ( minPointSize, maxPointSize )
{
    var doc, tfs, i = 0, n = 0, selectionArray = [];

    if ( !app.documents.length ) { return; }

    doc = app.activeDocument;
    tfs = doc.textFrames;
    n = tfs.length;

    if ( !n ){ return; }

    if ( isNaN ( minPointSize ) )
    {
        alert(minPointSize + " is not a valid number" );
        return;
    }
    else if ( isNaN ( maxPointSize ) )
    {
        alert(maxPointSize + " is not a valid number" );
        return;
    }
    else if ( minPointSize > maxPointSize )
    {
        alert(minPointSize + " can't be greater than "+ maxPointSize);
        return;
    }

    for ( i = 0 ; i < n ; i++ )
    {
        if ( tfs[i].textRange.size >= minPointSize && tfs[i].textRange.size <= maxPointSize )
        {
            selectionArray [ selectionArray.length ] = tfs[i];
        }
    }

    if ( selectionArray.length )
    {
        app.selection = selectionArray;
    }
    else
    {
        alert("Nothing found in this range.");
    }
}

selectTextWhosePointSizeIs ( 12, 14 );

Hope it helps,

Loic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!