How to convert textframe to button
How to convert textframe to button?
How to convert textframe to button?
I didn't find a 'clean' way to do this through the DOM. As a workaround you can emulate a "Convert to button" action, provided your script is allowed to select the textframe target:
// convertToButton for ID CS4
function convertToButton(/*PageItem*/obj, /*str*/bName, /*str*/bDesc)
if( !maCreateButton.isValid ) return false;
{
app.selection = [obj];
var maCreateButton = app.menuActions.item('$ID/$$$/Dialog/CmdName/CreateButton'),
ret;
maCreateButton.invoke();
ret = app.selection[0];
ret.name = bName||ret.name;
ret.description = bDesc||ret.description;
return ret;
};// sample code
var myTextFrame = app.activeDocument.textFrames[0];
var myButton = convertToButton(myTextFrame);
Note: this approach is used in FlyingButtons:
http://www.indiscripts.com/post/2010/03/flyingbuttons-a-script-to-automate-pdf-portfolios
@+
Marc
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.