4 Replies Latest reply on Feb 5, 2015 9:55 AM by Teetan VK

    How to Embed graphic files in a script?

    Teetan VK Level 1

      Hi everyone

       

      I learn from a pdf file, says that script can embed some type of graphic file into a script.

      but I don't really know how to do this

      and I attach pdf into this discussion

      can someone show me how?

       

      thanks

      Regard

       

      Teetan

      01.jpg

       

      02.jpg

       

      03.jpg

        • 1. Re: How to Embed graphic files in a script?
          Teetan VK Level 1

          I write a script and try to embed the icon into script

          but error

           

          my script:

           

           

           

           

           

          var w = new Window("dialog");

          var ib = w.add ('iconbutton', undefined, File ("~/Desktop/2_mac.png"));

                          ib.onClick = function() {

                          alert("you clicked me");

                          }

                      w.show();

                     

                     

                      var infile = File ("~/Desktop/2_mac.png");

                      var outfile = File ("~/Desktop/2_mac.txt");

                      infile.open ("r"); infile.encoding = "binary";

                      var temp = infile.read(); infile.close();

                      outfile.open ("w");

                      outfile.write (temp.toSource ());

                      outfile.close ();

          • 2. Re: How to Embed graphic files in a script?
            Loic.Aigon Adobe Community Professional

            Hi Teetan,

             

            Peter Karhel's book is rather explicite here. I am just restating the steps :

             

            1) copy/paste the graphic_to_text function (it does'nt have to be in your UI Code).

            2) call this function passing your image file

            3) get the generated text file

            4) open it and copy the contents inside (new String("   and "))

            5) reference that contents in your UI code like var myPic = "\XE9…";

            6) points to that referece w.add('iconbutton', undefined, myPic );

             

            Loic

            • 3. Re: How to Embed graphic files in a script?
              Teetan VK Level 1

              Thank you Loic

              thank you so much

               

              Teetan

              • 4. Re: How to Embed graphic files in a script?
                Teetan VK Level 1

                Hi Loic

                 

                Can I ask one more question?

                 

                What's .idrc stand for

                 

                What's format it was?

                 

                Teetan