3 Replies Latest reply on Nov 13, 2008 8:22 PM by (Simon_Paterson)

    [JS] GUI (sort of) for ScruitUI. Ideas and feedback.

    (Simon_Paterson) Level 1
      I just had a thought that I should be able to create an Applescript to interface with Xcode's Applescript Studio which would allow me to pump out ScruitUI Javascript code based on the project's window and widgets.

      Thinking out loud here (God I hope nobody can hear me), but essentially the idea goes something like this:

      * The user creates a window using Interface Builder attached to an Applescript Studio project. They would add widgets supported by ScriptUI such as boxes (groups), dropdown boxes, edittext boxes, buttons, radio groups, switches and so on (and for CS4, tab views).

      * Set the name and other initial properties of these widgets using the Attributes panel in Interface Builder. There should even be a way to associate events like onClick to function names within Interface Builder. This would allow the user to set the initial properties like 'enabled' and initial states for buttons, and so on.

      * Build the project in Applescript Studio to create a standalone application.

      Then the mojo. I would Inspect the widgets and their properties with another Applescript project which interprets each one and re-creates the window in ScriptUI code as a text file.

      Run the text file as a Javascript to see the result.

      Obviously the intention is to streamline the creation of ScriptUI interfaces. Of course the result would just be normal JS code so any customisation of the panel that was required would be business as usual.

      I don't know much about VBScript's capabilities, but it may be possible to duplicate the same idea using .NET or whatever is the Windows equivalent of Interface Builder.

      I guess I'm wondering if this would be a huge waste of time or not? How many people would get use out of this? I do a fair bit of ScriptUI work and it can be laborious and confusing with lots of groups, widgets, event function calls.

      Perhaps I've just had too much coffee.
        • 1. Re: [JS] GUI (sort of) for ScruitUI. Ideas and feedback.
          (Simon_Paterson) Level 1
          Gurus... I'd really like some feedback if you get a chance. Perhaps this is just a silly idea.
          • 2. Re: [JS] GUI (sort of) for ScruitUI. Ideas and feedback.
            Level 1
            Hi Simon,

            Someone has already done this, but I'm completely forgetting who it was and what it was called. I could also swear that we'd published an Adobe version (based on Eclipse) on Adobe Labs, but I can't find that, either. I think it's a great thing to do, but I think you might find that something already exists that will do what you want.

            At the same time, I've been thinking about creating an InDesign document that would do it for you. You'd have a library of elements that correspond to the widgets in a ScriptUI panel, which you could then drag onto a page and arrange. You'd then run another JavaScript, which would look at the elements and generate a ScriptUI panel.

            Thanks,

            Ole
            • 3. Re: [JS] GUI (sort of) for ScruitUI. Ideas and feedback.
              (Simon_Paterson) Level 1
              Thank you, Ole, for your reply.

              I like your idea better. Using an InDesign document would make the effort cross-platform.

              Did you envisage using the label on the element for any purpose? Maybe that is where we could put the widget name, for instance. It would be great to come up with a way to add events with named functions to any widget, and when the code is generated simply make that named function empty ready to be filled-in later.

              If you like, I am happy to collaborate on this with you if you can expand on your thoughts. I will even make a first attempt at generating the document to get the ball rolling, with the intention being to ultimately make it available to anyone who wants it.

              Again, thank you for your reply.