Does anyone have an example applescript script which drives the
Interface Builder to build a .nib file ?
aka: script thats ends commands to Interface Builder to insert a text
box at location X Y, sets attributes of that text box and then saves the
.NIB file ?
I am able to start interface builder and open an existing document.
Unable to create a new one, and definitely don't wher where to start to
start inserting objects into a window.
Having an example would allow me to associate what I see in the
dictionary for interface builder with the script and greatly help me.
(My goal is to parse legacy form layouts into an applescript that would
create a apple native .NIB file with roughly same layout as on the
legacy platform)
Reinder Verlinde - 19 Mar 2008 21:03 GMT
> Does anyone have an example applescript script which drives the
> Interface Builder to build a .nib file ?
[quoted text clipped - 6 lines]
> Unable to create a new one, and definitely don't wher where to start to
> start inserting objects into a window.
I doubt that you can do that using its dictionary. Using User Interface
Scripting might work, but IMO would just be an exercise in perseverence.
> Having an example would allow me to associate what I see in the
> dictionary for interface builder with the script and greatly help me.
>
> (My goal is to parse legacy form layouts into an applescript that would
> create a apple native .NIB file with roughly same layout as on the
> legacy platform)
I would not do that that way. Guessing at the .nib file format and
writing the XML probably would be orders of magnitude easier, faster,
and about as likely to break in a future version.
If long-term compatibility is a requirement, you might want to build on
GNUstep. According to
<http://heronsperch.blogspot.com/2006/08/nib-encoding-now-working-in-gnus
tep.html>, its Interface builder equivalent can write Cocoa .nib files.
Reinder
Chris Hanson - 20 Mar 2008 08:29 GMT
> Does anyone have an example applescript script which drives the
> Interface Builder to build a .nib file ?
I don't believe Interface Builder can be scripted to do something like that.
> (My goal is to parse legacy form layouts into an applescript that would
> create a apple native .NIB file with roughly same layout as on the
> legacy platform)
Don't parse the form layouts and generate nib files from them at build time.
Parse them at run time, and lay out your controls by just creating
instances of the appropriate classes and adding them as subviews of
your windows' content views.
It'll be a lot easier both to implement and to maintain over the long term.
-- Chris
JF Mezei - 20 Mar 2008 11:33 GMT
> Parse them at run time, and lay out your controls by just creating
> instances of the appropriate classes and adding them as subviews of
> your windows' content views.
These legacy forms are created in a DEC/VMS proprietary format for the
old FMS software. FMS doesn't run on Mac...
FMS can export its proprietary binary format into a text form that can
be parsed. (.FLG format)
Moving that .FLG to the Mac and having my application parse it whenever
it is started would preclude my adding more forms later on (no software
on the mac to generate .FLGs), or modify/improve those existing forms to
put GUI features on them.
I really want to move my apps over and use modern tools from now on and
no longre have any dependencies on the old system.
I have done some reading and found the command line utility "nibtool".
It can export a easy to understand structure of objects in a .nib file.
Unfortunatly, it cannot read it and convert it into a real .NIB again.
Reading more on the web, I found one Interface Builder .PDF which
mentions the "ibtool" utility which can export and re-import to
re-create a .NIB file. (page 96 of the Interface Builder User Guide)
Unfortunatly, this is not on my system (10.4.11) and the manual is for 10.5
Any chance it could create .NIB in a format 10.4 would understand ? Any
chance it would work on 10.4 ?
Simon Slavin - 21 Mar 2008 21:59 GMT
> Reading more on the web, I found one Interface Builder .PDF which
> mentions the "ibtool" utility which can export and re-import to
> re-create a .NIB file. (page 96 of the Interface Builder User Guide)
>
> Unfortunatly, this is not on my system (10.4.11) and the manual is for
> 10.5
Present in 10.5 and doesn't work with 10.4. Considering the price for
developers, it's probably worth you updating to 10.5.
Simon.

Signature
http://www.hearsay.demon.co.uk
JF Mezei - 22 Mar 2008 01:27 GMT
> Present in 10.5 and doesn't work with 10.4. Considering the price for
> developers, it's probably worth you updating to 10.5.
Can't upgrade to 10.5, I still have many classic apps.
Simon Slavin - 20 Mar 2008 22:15 GMT
On 18/03/2008, JF Mezei wrote in message
<47df8ec8$0$23909$c3e8da3@news.astraweb.com>:
> (My goal is to parse legacy form layouts into an applescript that would
> create a apple native .NIB file with roughly same layout as on the
> legacy platform)
Apparently it's not easy to script Interface Builder. I think it might be
easier to have your AppleScript write Cocoa code which creates the views
and fields. After all that's just text generation.
Simon.

Signature
http://www.hearsay.demon.co.uk