One would need a DOS or UNIX shell script to implement this behavior. There are two general algorithms that I can imagine:
1) Let the "idl -rt" (or "idlrt.exe") fail to check out a Runtime license, then run "idl -vm" (or "idlrt.exe -vm") right afterward.
This approach would be based on use of IDL's 'LMGR' function. Your IDL runtime application could begin with a call like this:
if lmgr(/DEMO) then begin
void = dialog_message(['No IDL license currently available.', $
'Restarting this app in the IDL Virtual Machine.'])
exit, STATUS=-99
endif
You could have a shell script, then, called, let's say, 'init_myidlapp', which could have syntax like this (using C-shell syntax as an example):
#!/bin/csh
idl -novm -rt=myidlapp.sav
# Assign the process exit status to a local variable
@ status = $?
if (status == -99) idl -vm=myidlapp.sav
2) Write a shell script that parses the output of the license manager's "lmstat" utility.
The only disadvantage with the above is that the user's xterm will show the output of an 'idl' process opening and failling before the Virtual Machine option opens. To get around this, however, would require a much more complicated text parser. The general algorithm would be: Parse the output of
/usr/local/rsi/idl/bin/lmstat -f idl_rt
or, if your system is using full developer "idl" license features:
/usr/local/rsi/idl/bin/lmstat -f idl
or, if your system is using both "idl_rt" and "idl" license features:
/usr/local/rsi/idl/bin/lmstat -a
(The Windows/DOS equivalent is "C:\RSI\IDL63\bin\bin.x86\lmutil lmstat ...")
Your script would first have to find a line(s) that looks like this:
Users of idl_rt: (Total of 12 licenses issued; Total of 6 licenses in use)
It would then have to find the numbers wilthin that line, compare them mathematically, then output a boolean value indicating whether more licenses are still available or no. The script would finish with a conditional that would start "idl -novm -rt=..." if 6 or more license units are available and would start "idl -vm=..." if 0 license units are available.
James Jones
|