Command-line options

How can I select which window within an application to open on startup. I want one user to start with load and one to start with unload. I then need to password protect going between them.

Hi Chuck, thanks for the question.

There are a few ways of going about this. First of all, this is a prime example of where the new retargetting feature would make sense. Instead of having two separate sections (“load” and “unload”) inside of one project, you could have two separate projects. That way, different physical client machines could be set to launch the appropriate project directly, and if you make the two projects use two different authentication profiles, users will naturally be forced to re-login when retargetting between the projects. This is how I would recommend doing what you described.

Now, if you truly just want different startup screens based on different users, that would be done in a startup script. You could write a startup script like this:

username = if username == 'Bob' or username == 'Jack': fpmi.gui.openWindow('LoadScreen') else: fpmi.gui.openWindow('UnloadScreen')

Note that you can also detect the Windows username as well. That would be done by replacing the first line of the script above with:

username = fpmi.system.getProperty('')

You can also detect the computer name. There isn’t a very clean way of doing this (as of 1.8.6), but it isn’t too bad. If you wanted to use the computer name, the code would look like this:

from import InetAddress compname = InetAddress.getLocalHost().getHostName() if compname == 'Comp1' or compname == 'Comp2': fpmi.gui.openWindow('LoadScreen') else: fpmi.gui.openWindow('UnloadScreen')

Lastly, if not using retargetting, you would then prompt the user for a password in your navigation scripts when switching between the two windows. Let me know which path you choose to take, and I can help you further if necessary.

Hope this helps,

Carl nailed it. Either:

  1. create 2 projects and use retargeting (recommended unless you have many shared screens that change frequently).
  2. open different windows in a startup script. You can base your criteria on nearly anything you want in that script. You might also need a manual password. An example is given here.

Thanks Carl I’ll give it a try and let you know what happens

I remember there being an fpmi.system.getProperty() property for the computer name, so that you don’t have to do this:

from import InetAddress compname = InetAddress.getLocalHost().getHostName()

Is there such a property?

No, but now (as of 1.8.7) you can just call