Quantcast
Channel: Adobe Community : Discussion List - Illustrator Scripting
Viewing all articles
Browse latest Browse all 3671

Edit TextFrame through Window'Palette' call back function

$
0
0

Hello,

 

working on Illustrator and ESTK.

I set a window to ask the user for inputs, then when he clicks OK I'd like to use the data to fill textFrames on a document.

My code seems logic to me but it dosen't work, any ideas why ?

 

Thanks !

 

#targetengine'foo';

var BAT = app.activeDocument;

 

// FUNCTIONS

function EditTextFrames (document, client) {

    var clientTextFrame = document.textFrames.getByName("client");

    clientTextFrame.contents = client;

}

 

//// WINDOW MODEL ////

function BatWindow () {

     var win = new Window ('palette', 'EditBAT');

 

    // ENTRIES

    var clientGroup = win.add ("group");

    clientGroup.add ("statictext", undefined, "Client:");

    var clientText = clientGroup.add ("edittext", undefined, "");

    clientText.characters = 30;

 

    // BUTTONS

    var myButtonGroup = win.add ("group");

    myButtonGroup.alignment = "right";

    var ok_button = myButtonGroup.add ("button", undefined, "ok");

    ok_button.onClick = function () {

        EditTextFrames (BAT, clientText.text);

    }

    var cancel_button = myButtonGroup.add ("button", undefined, "cancel");

    cancel_button.onClick = function () {

        win.close ();

    }

    clientText.active = true;

    return win;

}

 

//// INSTANTIATE WINDOW ////

 

var window = BatWindow ();

window.show ();


Viewing all articles
Browse latest Browse all 3671

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>