Dynamic window in AS Studio?

I’ve been writing Applescript for years in various forms and I also know quite a bit of PHP/MySQL and have recently started building AS Studio apps for various things that need to be done.

I am working on a tool right now that I would like to have a variable amount of labels and check boxes in based on some preferences. I have figured out how to reliably read/write the plist files I need in AS Studio, but I can’t figure out how to have these impact the interface dynamically.

Essentially this app reaches out over Remote Apple Events to other machines and fires some basic processes in an app. The interface as it stands now just has a checkbox that includes the machine in the group of machines to run the remote apple event on. For round one and proof of concept, I hard coded in the addresses of the machines because I knew exactly what their IPs were and how many there were.

Now I need to be able to make a new window that is driven solely by a plist and can have as few as 1 remote machine and as many as the user needs (within reason).

Right now my prefs provide for the IP address, username, and pass of the remote machine as well as a label/name of the machine.

The only fields I need in the interface are labels (gotten from plist) and checkboxes (for enabling the command to run). At the bottom there is a “go” button that starts a running loop on remote machines and then a “stop” button that sends a stop looping command to the same machines.

Am I speaking gibberish here or is this even possible with InterfaceBuilder/AS Studio? It would be a snap if I was doing it in PHP - but alas this won’t quite work well as a web app :D.

Hi szumlins,
You cannot dynamically create interface elements through AS, but you can show or hide them.

Maybe I can figure out a way to have a reasonable amount of systems in the window and just label and activate the ones that have preference info attached. Not optimal, but it should work.

I’m sure what you need is more specialized, but have you checked out Remote Desktop? It’s pretty powerful and you can run scripts or automator actions on a list of machines.

You need a table view. The first column could be an NSButtonCell which would be your checkbox. So your plist file would contain an array of the information in the table. For example, if your table contained 2 rows your array would look like this.

{{state of checkbox1, IP address1, username1, pass1}, {state of checkbox2, IP address2, username2, pass2}}

State of checkbox is a bool value true/false. Then you create your table’s data source from that array and the table would show the proper amount of rows and the checkboxes would be set properly. Then you can have buttons to add or remove rows as needed for the user. Then when your program quits you write that array to the plist file, and when your app is launched you read it and set the table appropriately.