Copy link to clipboard
Copied
I need to change the tabs in a paragraph via scripting. Here is what I have so far:
var oaTabs = oPgf.Tabs;
var oaNewTabs = [];
for( n = 0; n < oaTabs.length; n++ )
{
if( oaTabs[n].x < iLeft || oaTabs[n].x > iRight )
oaNewTabs.push( oaTabs[n] );
}
var oaProps = oPgf.GetProps( );
var i = GetPropIndex( oaProps, Constants.FP_Tabs );
oaProps[i].propVal.tsval = oaNewTabs;
oPgf.SetProps( oaProps );
Replacing the tsval inside the propVal for the paragaph tags does not work. I believe tsval is an alias to an array that is actually there, but what is the property name of the array that I need to replace ? Can this be done at all in this manner ?
Thanks for a quick reply
Hi Jang, instead of this:
var oaNewTabs = [];
try this:
var oaNewTabs = new Tabs ();
Let me know if that doesn't work and I will poke at it a little more. Thanks.
Copy link to clipboard
Copied
Hi Jang, instead of this:
var oaNewTabs = [];
try this:
var oaNewTabs = new Tabs ();
Let me know if that doesn't work and I will poke at it a little more. Thanks.
Copy link to clipboard
Copied
Hi Rick,
That works. Thanks. In the meantime I had also found another method. Not using the oPgf.Tabs property but going through GetProps method to assign the tsval to oaTabs. With that method, oaTabs seems to be the pointer to the right tsval structure in oaProps that I needed. Here is the working code:
var oaProps = oPgf.GetProps( );
var p = GetPropIndex( oaProps, Constants.FP_Tabs );
var oaTabs = oaProps[p].propVal.tsval;
var oaNewTabs = [];
for( n = 0; n < oaTabs.length; n++ )
if( oaTabs[n].x < iLeft + 10 || oaTabs[n].x > iRight - 10 )
oaNewTabs.push( oaTabs[n] );
while( oaTabs.length ) oaTabs.pop( );
for( n = 0; n < oaNewTabs.length; n++ ) oaTabs.push( oaNewTabs[n] );
oPgf.SetProps( oaProps );The script is kicking out the tabs at positions between iLeft and iRight (which are calculated from the label text, which might be shorter or longer depending on content and language).
Kind regards
4everJang
Find more inspiration, events, and resources on the new Adobe Community
Explore Now