Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ConvertToButton using script

Guest
May 13, 2013 May 13, 2013

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
1.8K
Translate
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

...
Translate
Explorer ,
May 13, 2013 May 13, 2013

Hi Bill joy,

You can refer the following link which is  on forum:

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

Suresh

Translate
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

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

Translate
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

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

Translate
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

Hi Bill

Try this

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

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

Hurix

Translate
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

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

Translate
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

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

Translate
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

Try the convertToButton button, that works fine.

Peter

Translate
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
LATEST

Thanks Peter for reply

Translate
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