11 Replies Latest reply on Mar 16, 2012 10:35 PM by John Hawkinson

    (Slightly OT): Convert ExtendScript to .exe?

    TᴀW Adobe Community Professional & MVP

      Hi,

       

      Long shot here: I would like to write a little application that uses

      ScriptUI and JScript. It doesn't actually need to use the DOM of any CS

      apps, just ScriptUI.

       

      Do you know of any way of converting such an application into a

      standalone Windows executable (.exe)?

       

      Thanks,

      Ariel

       

        • 1. Re: (Slightly OT): Convert ExtendScript to .exe?
          Bob Stucky Adobe Employee

          That's a longshot all right...

           

          Nope.

           

          Your best approach to that would be to create an Air app. Even then, you'd need to use sockets to communicate to the host app. There is a cookbook for that, tho-

           

          http://cookbooks.adobe.com/post_Inter_Application_Communication_with_the_Creative-18456.ht ml

           

          Regards

          • 2. Re: (Slightly OT): Convert ExtendScript to .exe?
            TᴀW Adobe Community Professional & MVP

            Thanks Bob.

             

            This is a simple thing -- I won't be needing any host apps. Just

            collecting user input and writing files.

             

            I was looking at AIR this afternoon but it seemed a steep learning

            curve. Does AIR have ScriptUI?

             

            (Otherwise I'm thinking of an HTML app (HTA).

             

            Ariel

            • 3. Re: (Slightly OT): Convert ExtendScript to .exe?
              Bob Stucky Adobe Employee

              There's lots of ways to create a simple exe to do stuff like that. Air is one. Air uses FlashBuilder, for UI, it would be a Flash/Flex based UI that is far more flexible and robust than ScriptUI. That said, there's a learning curve!

               

              Bob

              • 4. Re: (Slightly OT): Convert ExtendScript to .exe?
                TᴀW Adobe Community Professional & MVP

                What setup would I use to script and debug Air? I've got Dreamweaver 5.

                Would that do it?

                 

                What other ways can you think of apart from Air for a simple exe? Do you

                think an HTA is a dead-end?

                 

                Thanks for your feedback. I've been searching around extensively without

                coming to a clearcut answer. I'm beginning to wonder if Dev C++ with

                Win32 API calls mightn't be the simplest in the long run!

                 

                Ariel

                • 5. Re: (Slightly OT): Convert ExtendScript to .exe?
                  [Jongware] Most Valuable Participant

                  Arïel, neither "Extendscript" (which is an extension of Javascript) nor ScriptUI (which uses InDesign's -- and other CS-related -- own graphical interface) can 'run' outside InDesign (or Illustrator, Bridge, Photoshop ... oh wait, that's it).

                   

                  If you want to create a stand-alone application that incorporates a GUI, try Java. As a bonus, it ought to be platform independent as well (hey, just like a good written Javascript for InDesign ).

                   

                  Make no mistake: Java is not Javascript. Javascript is a fairly simple programming language (as such a thing exists), and I have no idea what syntax it originally was based on. Perhaps it grew organically -- I remember Days Gone when every single browser had its own version, with bugs to circumvent for each and all.

                   

                  Java is a full programming language and has nothing to do with 'scripting' of any kind. You might as well compare it to C++ in all of its complexity. However, if you know how to program to begin with (and Javascript is a great language to "step in"), you should be able to find your way around class definitions and whatnot. Learning to program in Java is in my list of to-do's (then again, so are Python and Objective-C).

                  • 6. Re: (Slightly OT): Convert ExtendScript to .exe?
                    TᴀW Adobe Community Professional & MVP

                    I know you "can't" run an ExtendScript outside of the CS context. I was

                    just hoping you "can" somehow, if you get my drift.

                     

                    I have a smattering of C++ so I could try and create a little something

                    with that. But it seems like overkill for a small, non-intensive app.

                     

                    That's why I thought maybe HTA.

                     

                    As Bob mentioned, AIR is also a possibility.

                     

                    The disadvantage of Java is that it has a hefty runtime that makes

                    deployment that little bit less straightforward.

                     

                    At least an HTA can be done in JScript, plus the IE DOM (which is

                    probably worthwhile getting familiar with).

                     

                    The problem with that is that the UI that is available is minimal. So

                    every dialog box would have to be a web page, which is a bit of a pain.

                     

                    Does AIR have a future? Is it worth learning?

                     

                    Ariel

                    • 7. Re: (Slightly OT): Convert ExtendScript to .exe?
                      John Hawkinson Level 5

                      Bob is very much convinced that AS3 and Flash are easier to do development work in than ExtendScript. I am not really sure why he thinks that, so I'm not prepared to disagree, per se, but I will say that my experience has not shown that to be the case.

                       

                      But I think the point here was that you can create a .EXE file with AIR, and AIR/AS3 can execute ExtendScript. So you can, for instance, write an AIR/AS3/CSXS/CSAW app that writes out a JSXBIN file from inside itself to a temporary directory and then calls app.doScript() on that via the CSAW API.

                       

                      You mentioned JScript. Did you really mean that? Remember that JScript is not an abbreviation for JavaScript, it is something else (a Microsoft clone).

                      • 8. Re: (Slightly OT): Convert ExtendScript to .exe?
                        TᴀW Adobe Community Professional & MVP

                        I'm completely ignorant about AIR, Flash, and ActionScript.

                         

                        So John, when you run a ScriptUI dialog with AIR, do you get the AIR

                        implementation of that (just as you get different dialogs if you run

                        ScriptUI via InDesign vs ExtendScript Toolkit?)

                         

                        I mention JScript because the (offline) .chm help files I use when I

                        want to look up something are Microsoft's JScript help. When running a

                        script on a Windows machine, are we using the InDesign DOM + JScript, or

                        is it actually proper JavaScript?

                         

                        Anyway, I'm still unsure what the best way to write a small standalone

                        app on Windows would be. When I say small, I mean something that

                        wouldn't need to go beyond what ExtendScript + ScriptUI provides. I

                        realise that this is way off-topic for this board, but if you have any

                        thoughts on the subject I'd be very interested to know. So far HTA seems

                        likes my best bet (you probably haven't heard of that -- I hadn't until

                        I searched around. HTA is an HTML application -- i.e. anything you can

                        do on Internet Explorer you can do in exactly the same way in an HTA --

                        except that an HTA circumvents the browser's security model, so there's

                        no problems (no warning popups) when writing files to the harddisk, etc.

                        plus you can create a window that looks like a regular app window, with

                        no vestiges of being in a browser. Also, there is nothing that needs to

                        be installed for the user to run this -- I think not even Internet

                        Explorer, though I'm not sure about that yet.)

                         

                        Thanks,

                        Ariel

                        • 9. Re: (Slightly OT): Convert ExtendScript to .exe?
                          John Hawkinson Level 5

                          So John, when you run a ScriptUI dialog with AIR, do you get the AIR

                          implementation of that (just as you get different dialogs if you run

                          ScriptUI via InDesign vs ExtendScript Toolkit?)

                          You don't run ScriptUI via AIR.

                          You could use Flash/AS3's rich API and create a dialog that way, but we're not really talking about that, at least I'm not. (I thought other people weren't either, but upon re-rereading, I think I may have been wrong.)

                           

                          I suggested you use AIR to call InDesign's ExtendScript. At which point it is ExtendScript in InDesign. AIR is just a wrapper here, in this proposal.

                           

                          Different dialogs in ScriptUI via InDesign versus the ESTK? I am not aware of this!

                          Do you mean, (a) A given script that targets InDesign (#target indesign, or just running from InDesign's scripts panel, or targetting "Adobe InDesign CS5" when run from the dropdown in the ESTK) gives a different appearance of ScriptUI dialogs when run from the ESTK versus run from InDesign? Or (b) A script that targets InDesign gives different dialog appearances than a script that targets the ESTK ("ExtendScript Toolkit CS5" when run from the ESTK)?

                           

                          (a) would be very surprising to me. And (b) not so surprising but much less interesting (who writes scripts for the ESTK? I run scripts that target it all the time -- but it's always an accident! And then I reset the dropdown.)

                          I mention JScript because the (offline) .chm help files I use when I

                          want to look up something are Microsoft's JScript help. When running a

                          script on a Windows machine, are we using the InDesign DOM + JScript, or

                          is it actually proper JavaScript?

                          When you run an InDesign Javascript on any machine, it is always Adobe ExtendScript, and it is absolutely never Microsoft JScript. Because ExtendScript is JavaScript plus a few very small extensions, it's OK to use a reference for regular JavaScript. And since Microsoft JScript is almost like JavaScript, it's probably OK to use their JavaScript reference. But you should definitely be aware that you are using the "wrong" documentation for the thing you are writing, and you could very easily encounter discrepancies or outright falsehoods.

                           

                          So definitely you are not getting Microsoft's JScript implemention, no. At least not unless you're using Visual Studio or IE or something. And then you wouldn't have access to the ID DOM, so you'd notice pretty darn quick.

                           

                          Anyway, I'm still unsure what the best way to write a small standalone

                          app on Windows would be. When I say small, I mean something that

                          Yeah, I don't know what to tell you. Knuckle under and use a JSXBIN file?

                          Windows is not my OS of choice and what seems simple here is apparently quite tricky.

                          • 10. Re: (Slightly OT): Convert ExtendScript to .exe?
                            TᴀW Adobe Community Professional & MVP

                            "You could use Flash/AS3's rich API and create a dialog that way"

                             

                            I wonder how complicated that is. Where is a good place to find more

                            information about programming AIR apps? Do I need to have Flash to do

                            it, or is Dreamweaver enough, or something else?

                             

                            "I suggested you use AIR to call InDesign's ExtendScript. At which point

                            it is ExtendScript in InDesign. AIR is just a wrapper here, in this

                            proposal."

                             

                            This implies you need InDesign installed to run the app. I'm really

                            looking for a standalone way to create an app that does not rely on

                            having anything installed except Windows (and maybe IE).

                             

                            "Do you mean, (a) A given script that targets InDesign (#target

                            indesign, or just running from InDesign's scripts panel, or targetting

                            "Adobe InDesign CS5" when run from the dropdown in the ESTK) gives a

                            different appearance of ScriptUI dialogs when run from the ESTK versus

                            run from InDesign? Or (b) A script that targets InDesign gives different

                            dialog appearances than a script that targets the ESTK ("ExtendScript

                            Toolkit CS5" when run from the ESTK)?"

                             

                            I meant (b). And it's because I noticed that you can actually run a

                            complete script with just ESTK, and no use of InDesign or any other CS

                            app that it made me wonder whether somehow one could package a runtime

                            ESTK and get a standalone .exe app. Long shot, as I said!

                             

                            "ExtendScript is JavaScript plus a few very small extensions"

                             

                            Like the dollar-sign operator to write to the console, you mean?

                             

                            "But you should definitely be aware that you are using the "wrong"

                            documentation for the thing you are writing, and you could very easily

                            encounter discrepancies or outright falsehoods"

                             

                            Are there any suggestions for a nice, offline complete Javascript

                            reference? What I'm using is a file called script56.chm (probably

                            Googelable) which is a really nice succinct reference but of JScript. If

                            there's something equivalent, what would it be?

                             

                            "Knuckle under and use a JSXBIN file?"

                             

                            ...which would require an InDesign installation (or at least ESTK).

                             

                            My question (moving on from the title of the thread, which Bob Stucky

                            assures is not possible) is what method do people recommend to program a

                            simple standalone Windows app (that has nothing to do with InDesign [and

                            hence nothing to do with this board, so this is really off-topic, for

                            which apologies -- I'm just trying to take advantage of the extensive

                            expertise of the people who frequent this board to get some pointers]).

                            C++ seems overkill. Java requires the usre installing Java runtime,

                            ditto any .NET framework, JScript has no UI whatsoever beyond MsgBox and

                            Alert. HTA seems a possible answer.

                             

                            It's almost Shabbat here, so I've got to go, and I wish anyone who is

                            reading this a nice weekend!

                             

                            Ariel

                            • 11. Re: (Slightly OT): Convert ExtendScript to .exe?
                              John Hawkinson Level 5

                              "You could use Flash/AS3's rich API and create a dialog that way"

                               

                              I wonder how complicated that is. Where is a good place to find more

                              information about programming AIR apps? Do I need to have Flash to do

                              it, or is Dreamweaver enough, or something else?

                              I would say it is fairly complicated.

                              AIR applications are programmed in ActionScript3. I don't believe Dreamweaver has anything to do with that, but I think I've spent a grand total of 45 seconds with Dreamweaver.

                              You can start by reading Adobe's documentation on ActionScript3, Flash, AIR, and Flex.

                               

                              As Bob suggests, the thing to use to write AIR apps is Flash Builder. If you don't have it or Master Collection poking around, err, well, this is probably not the way to go. I think, in theory, you could use the open source Flex compiler to build AIR apps. But I think you would not really like the experience.

                               

                              This implies you need InDesign installed to run the app. I'm really

                              looking for a standalone way to create an app that does not rely on

                              having anything installed except Windows (and maybe IE).

                              Oh, sorry, I didn't understand that.

                              Yes, my suggestion of using ScriptUI inside AIR is hopelessly dependent on InDesign (or a related product).

                               

                               

                              "ExtendScript is JavaScript plus a few very small extensions"

                              Like the dollar-sign operator to write to the console, you mean?

                              Yes, that. Or the .reflect.properties magic property. Or, for that matter, the entire InDesign DOM. Or the #target and #include directives. Or the concept of JSXBIN. The list goes on and on.

                              Are there any suggestions for a nice, offline complete Javascript

                              reference? What I'm using is a file called script56.chm (probably

                              Googelable) which is a really nice succinct reference but of JScript. If

                              there's something equivalent, what would it be?

                              I do not have such a reference to recommend. I don't have the offline problem you have, but I typically use a combination of the Mozilla MDN reference, https://developer.mozilla.org/en/JavaScript, and the ECMA-262 Standard 3rd edition which formally defines JavaScript, available from http://www.ecma-international.org/publications/standards/Ecma-262-arch.htm.

                               

                              Neither of those is a CHM file. I haven't drunk the CHM Kool Aid, though. I'm sure someone here can recommend something.

                               

                              Anyhow, perhaps some Windows developers will have a solution to offer you.