Open Windows Dynamically When Starting App

Is there a way to dynamically specify what window(s) to open when the application starts?

For example, I would like to be able to append a parameter, i.e., the window to open, to the launching URL and the parameter be available, say, in the application global script.

I don’t think that you can pass/except parameters. Carl - is there some way of doing this? Retargeting does pass parameters with a similar mechanism, but I don’t think it’s open to you when opening a project. However, you can dynamically open windows with a Startup (Global) script. That allows you to base options on: OS, Hostname/IP, etc.

Seems like a feature I’ve requested. It’s a good idea.

No, you can’t pass parameters through the URL to the client. The problem lies in how Java web start loads the JNLP file that prevents dynamic parameter passing.

Sorry. You can create dummy projects that auto-login and then retarget to your project in various ways…not a perfect workaround, but it might help.

I dynamically open different windows on startup based off of the username or roles. I just went

if user = "Me":
    fpmi.gui.openWindow("Awesome Window")
if user != "Me":
    fpmi.gui.openWindow("Crappy Window")


[quote]I dynamically open different windows on startup based off of the username or roles. I just went

if user = “Me”:
fpmi.gui.openWindow(“Awesome Window”)
if user != “Me”:
fpmi.gui.openWindow(“Crappy Window”) [/quote]

Unfortunately, I don’t think using userids/roles would work in my application because we have a very loose security model and I want to load specific windows based on the locations from which the users invoke FPMI.


I was looking at and on this page they describe how to specify parameters in the jlnp file. Granted, I have a very limited understanding of how this works but couldn’t it be possible to dynamically generate a jlnp file on the gateway from the URL parameters and then launch the application with it? If so, then the only thing missing is a way to access the parameters from within FPMI. Am I really out in left-field here?


I don’t think we want to mess around with custom .JNLP files. Why not deal with location based on IP address or hostname? Storing your list in the database allows you to centrally manage access.

There’s a similar example post here.

myName = myIP = allowedHosts = fpmi.db.runQuery("SELECT hostName, IP, windows FROM hostList") for host in allowedHosts: if host['hostName'] == myName or host[1] == myIP: DO_SOMETHING


Does the system you are using to select the FactoryPMI page allow writes to the database? If so, you could use the database to your advantage. For example, you could have a table in the DB with a startup_window_name that is set before you open the FactoryPMI project. In the project, on startup, you could check that table and open the appropriate window, then reset startup_window_name to ‘’ (so the next time it starts, it would default to the main page).

[code]#check what name you put into the db
windowName = fpmi.db.runScalarQuery(“SELECT startup_window_name FROM startup_window_table”)

#open the proper window (or the default if the empty string is there)
if windowName == ‘’:
fpmi.gui.openWindow(“Main Window”)

#reset the table to the empty string
fpmi.db.runUpdateQuery("UPDATE startup_window_table SET startup_window_name = ‘’ ")
Now, assuming people aren’t constantly opening projects, this should work out well.

Our ‘jnlp’ files are dynamically generated. When you go to host:port/gateway/launch/projectname.jnlp, it dynamically generates an appropriate jnlp file for projectname. Now, you want to do this: host:port/gateway/launch/project … indow2=xyz

And then have the dynamically generated jnlp file take those URL arguments and code them up as params in the jnlp file. Sounds good, huh? The only problem is that one of the first pieces of info in the jnlp file is the url of the jnlp file itself. This is so that JWS can go and look at the most recent version of the JNLP file when the app is launched from a desktop shortcut. And the kicker is that that URL in the jnlp can’t have args due to the way JWS stores the url on the hard drive. (I tried this a year or so ago - no dice).

Sorry for getting so technical, but you left me no choice :wink:


Sorry for leaving you no choice.:laughing: It’s interesting though.


I was actually working in this direction. I’ll have to do a variation of this approach since FPMI can be launched on/from multiple workstations “simultaneously”. I’ll probably just add an additional column to the table to hold the workstation name and update the startup_window_name just for the row with the appropriate workstation name. Then in the global startup script, I’ll get the local workstation name for use in my query (e.g., select startup_window_name from start_up_windows_table where workstation = ‘workstation_name’). If there is no corresponding record, then I’ll just startup with the default windows.

That sounds great. :slight_smile: I love that there’s always a workaround!