• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

ConvertToButton using script

Guest
May 13, 2013 May 13, 2013

Copy link to clipboard

Copied

Hi Expert

I want to convert TextFrame or Image to Button using script But in object model I not found any method to convet it in button.

Object-->Interactive->convertToButton

http://forums.adobe.com/message/3788171

I also not found convertToObject() in  object method.

b = app.selection[0];

b.convertToObject ();

How convert TextFrame to Button using script ?

Thanks.


TOPICS
Scripting

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , May 15, 2013 May 15, 2013

Hi Bill

Have you tried this?

#target indesign

var myDocument = app.documents.add();

var myDocument = app.documents.item(0);

var myPage = myDocument.pages.item(0);

var myTextFrame = myPage.textFrames.add();

myTextFrame.geometricBounds = [72, 72, 288, 288];

myTextFrame.contents = "This is some example text."

//var myTextFrame = app.activeDocument.textFrames[0];

var myButton = convertToButton(myTextFrame);

function convertToButton(obj)

{

     app.selection = [obj];

     var maCreateButton = app.menuAction

...

Votes

Translate

Translate
Explorer ,
May 13, 2013 May 13, 2013

Copy link to clipboard

Copied

Hi Bill joy,

You can refer the following link which is  on forum:

http://forums.adobe.com/message/2773521#2773521

Suresh

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 13, 2013 May 13, 2013

Copy link to clipboard

Copied

Thanks SureshKumar for reply

I follow the link

http://forums.adobe.com/message/2773521#2773521

and try :

#target indesign

var myDocument = app.documents.add();

var myDocument = app.documents.item(0);

var myPage = myDocument.pages.item(0);

var myTextFrame = myPage.textFrames.add();

myTextFrame.geometricBounds = [72, 72, 288, 288];

myTextFrame.contents = "This is some example text."

//var myTextFrame = app.activeDocument.textFrames[0];

var myButton = convertToButton(myTextFrame);

But it give error  convertToButton is not a function.

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 13, 2013 May 13, 2013

Copy link to clipboard

Copied

Hi Bill joy,

You have to add the following defintion for the fuction convertToButton(myTextFrame)

function convertToButton(obj)

{

     app.selection = [obj];

     var maCreateButton = app.menuActions.item('$ID/$$$/Dialog/CmdName/CreateButton'),

          ret;

     if( !maCreateButton.isValid ) return false;

     maCreateButton.invoke();

     ret = app.selection[0];

     return ret;

}

Suresh

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 13, 2013 May 13, 2013

Copy link to clipboard

Copied

Hi Bill

Try this

var myTextFrame = myDocument.buttons.add(myDocument.layers);

myTextFrame.geometricBounds = [72, 72, 288, 288];

Hurix

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 15, 2013 May 15, 2013

Copy link to clipboard

Copied

Hi hurix

thanks for reply

I want to convert TextFrame to Button.

Not to create a button.

this

var myTextFrame = myDocument.buttons.add(myDocument.layers);

myTextFrame.geometricBounds = [72, 72, 288, 288];

create button not convert in button.

I want to do Object-->Interactive->convertToButton using script.

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 15, 2013 May 15, 2013

Copy link to clipboard

Copied

Hi Bill

Have you tried this?

#target indesign

var myDocument = app.documents.add();

var myDocument = app.documents.item(0);

var myPage = myDocument.pages.item(0);

var myTextFrame = myPage.textFrames.add();

myTextFrame.geometricBounds = [72, 72, 288, 288];

myTextFrame.contents = "This is some example text."

//var myTextFrame = app.activeDocument.textFrames[0];

var myButton = convertToButton(myTextFrame);

function convertToButton(obj)

{

     app.selection = [obj];

     var maCreateButton = app.menuActions.item('$ID/$$$/Dialog/CmdName/CreateButton'),

          ret;

     if( !maCreateButton.isValid ) return false;

     maCreateButton.invoke();

     ret = app.selection[0];

     return ret;

}

Suresh

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 15, 2013 May 15, 2013

Copy link to clipboard

Copied

Try the convertToButton button, that works fine.

Peter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 15, 2013 May 15, 2013

Copy link to clipboard

Copied

LATEST

Thanks Peter for reply

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines