0 Replies Latest reply on Jan 27, 2015 7:39 AM by Teetan VK

    Script UI set background image

    Teetan VK Level 1

      Hi everyone

       

      Is that possible for script UI to set a background image.

      like a image in the background.

       

      I got this script,

       

       

       

      function mDialog()

      { // user choice

        var

        w = new Window("dialog","Change paragraphs' Indents", undefined, {closeButton: false}),  

               stringList = [ "01   indent (00, 00)",//0

                                     "02   indent (08, 00)",//1

                                     "03   indent (16, 00)",//2

                                     "04   indent (24, 00)",//3

                                     "05   indent (32, 00)",//4

                                     "06   indent (40, 00)",//5

                                     "-",                            //6

                                     "07   indent (00, 08)",//7

                                     "08   indent (08, 08)",//8

                                     "09   indent (16, 08)",//9

                                     "10   indent (24, 08)",//10

                                     "11   indent (32, 08)",//11

                                     "12   indent (40, 08)",//12

                                     "-",                            //13

                                     "21   indent (08, -8)",//14

                                     "22   indent (16, -8)",//15

                                     "23   indent (24, -8)",//16

                                     "24   indent (32, -8)",//17

                                     "25   indent (40, -8)",//18

                                     "26   indent (48, -8)"],//19

        mReminderString = "Script made by Wong Siu Ping.\rAll rights reserved.",

        lastSelected = Number(app.extractLabel("dialogIndents") ),

        p = w.add("panel", undefined, "Choose a version of indent"),

        mDD = p.add("dropdownlist", undefined, stringList),

        mRem = p.add("statictext", undefined, mReminderString, {multiline: true} ),

        p1 = w.add("image", undefined, File ("~/Desktop/runner.jpg"));

        p1 .size = [230,160];

        b = w.add("group");

       

           mDD.preferredSize = [200,23];

           if ( !lastSelected ) mDD.items[0].selected = true;

            else mDD.items[lastSelected].selected = true;

       

               w.graphics.backgroundColor = w.graphics.newBrush (w.graphics.BrushType.SOLID_COLOR, [0.3, 0.5, 0.8]);

           mRem.alignment = "left";

          mRem.graphics.font = ScriptUI.newFont ("Arial", "Bold", 10);

           mRem.graphics.foregroundColor = mRem.graphics.newPen (w.graphics.PenType.SOLID_COLOR, [1, 1, 1], 1);

          p.graphics.font = ScriptUI.newFont ("Arial", "Bold", 13);

           p.graphics.foregroundColor = mRem.graphics.newPen (w.graphics.PenType.SOLID_COLOR, [1, 1, 1], 1);

          mDD.graphics.font = ScriptUI.newFont ("Arial", "Bold", 12);

           mDD.graphics.foregroundColor = mRem.graphics.newPen (w.graphics.PenType.SOLID_COLOR, [0.3, 0.5, 0.8], 1);

       

       

           b.add ('button', undefined, "OK", {name: "OK"}); 

           b.add ('button', undefined, "ยกเลิก ", {name: "Cancel"}); 

       

        if (w.show() ==1 ) {

        app.insertLabel("dialogIndents", String(mDD.selection.index) );

        return mDD.selection.index;

        }

        else exit();

      }

      function checkSelection()

      { // alert if wrong selection, set target

          var mMsg = "Can't do any job\rSelect some text as a target or place cursor inside target paragraph";

          if ( !app.documents.length || !app.selection.length) {

              alert (mMsg);

              exit();

              }

          var curObj = app.selection[0];

          do {

              if (app.selection[0].hasOwnProperty ("contents") ) return curObj;

              curObj = curObj.parent;

              }

          while (curObj.constructor.name != "Spread")

       

       

          alert (mMsg);

          exit();

          }

       

       

       

       

         

       

       

      function main()

      { // starter

        indents( checkSelection(), mDialog() ); 

      }

      function indents(myObject, myChoice)

      { // job function

        switch (myChoice) {

        case 0:

       

       

       

                    break;

       

      if it is possible, can someone tell me how to set the image into background

       

      thanks

       

      Regard

      Teetan