To have the code please mailto Muthu Kumar Mani
# ===============================================================================
# Application/URL: RoleStartup
# Type: Generic
# Script Version: 1.0.0.0
# Written: Date[yyyy/mm/dd] By Name of the Team/Person
# Last Updated: Date[yyyy/mm/dd] By Name of the Team/Person
#
# Purpose: This definition invokes at SSO startup and displays the role picker to
# the end user. Then it invokes the applications set for the role that
# they selected.
#
# Note : For Every Application File there has to be an XML file with samename.xml
# ===============================================================================
# –Benchmark Timing: Shows time to show pick list and time to launch all applications
Local ?TimeA
Local ?TimeB
Local ?TimeC
Local ?TimeD
# — Set to ‘false’ to hide MessageBox
Set ?ShowBenchmarkTimes “false”
Set ?TimeA ?CurrTime(system)
#=====================
# List of Applications included
#=====================
# –Contains code to log the event
# Include “logEvent”
# –Contains definitions for all available roles
Include “RoleDefinition”
# –Contains subs that set the application list for selected role
Include “RoleLaunch”
#=====================
# Defining the Global Varaibles
#=====================
# –The number of selectable roles in the pick list
Set ?SelectableRoleCount “0″
# –The counter for role PickListAdd
Set ?RoleIndex “1″
# –Can set to ?RoleIndex here, but for clarity, do it later
Set ?SelectedRole “”
# –Unless changed at runtime, launch NO scripts
Set ?RoleApplicationCount “0″
#=====================================================
# Repeat as many times as there are Roles
# Any over 16 causes the Repeat to break (escape)
#
# NOTE: CANNOT use variables with Repeat block must use the If-Break
# construct with an escape case (the variable quirk problem)
#=====================================================
Repeat
# –Escape Case
If ?RoleIndex GT ?RoleDefCount
Break
EndIf
If ?RoleIndex EQ “1″
# –if there is a role 1, add the prompt for it
PickListAdd ?RoleDefPrompt_1 ”1″
Else
If ?RoleIndex EQ “2″
# –if there is a role 2, add the prompt for it
PickListAdd ?RoleDefPrompt_2 ”2″
Else
PickListAdd ?RoleDefPrompt_3 ”3″
Else
If ?RoleIndex EQ “4″
PickListAdd ?RoleDefPrompt_4 ”4″
Else
If ?RoleIndex EQ “5″
PickListAdd ?RoleDefPrompt_5 ”5″
Else
# throw away any over 17
Break
EndIf
EndIf
EndIf
EndIf
Increment ?RoleIndex
EndRepeat
#=====================================================
# If more than one possible role then let the user pick one, otherwise we will
# use the first one we added to the list.
#=====================================================
# –Benchmark Timing
Set ?TimeB ?CurrTime(system)
If ?RoleDefCount GT 1
# –more than one case, show role picker
PickListDisplay ?SelectedRole “Please SELECT your role.” -NoEdit
Else
If ?RoleDefCount LT 1
# –no roles defined case, quit
EndScript
Else
# –one role defined case
Set ?SelectedRole “1″
EndIf
EndIf
# –Benchmark Timing
Set ?TimeC ?CurrTime(system)
#======================================
# Call the sub for each role if that role was selected
#======================================
If ?SelectedRole EQ “1″
# –if role one was selected, set the application variables for the LaunchProgram part
Call “RoleLaunch1″
Else
If ?SelectedRole EQ “2″
# –if role two was selected…
Call “RoleLaunch2″
Else
If ?SelectedRole EQ “3″
Call “RoleLaunch3″
Else
If ?SelectedRole EQ “4″
Call “RoleLaunch4″
Else
If ?SelectedRole EQ “5″
Call “RoleLaunch5″
Else
# –this should never be invoked
EndScript
EndIf
EndIf
EndIf
EndIf
EndIf
#=========================================
# Lanuching the Applications based on the Role Selected
#=========================================
Include “RoleProgramLauncher”
#========================================
# Wait for applications to respond to the run command
# or they will pop back up after Minimize All
#========================================
# –Benchmark Timing
Set ?TimeD ?CurrTime(system)
# –Wait 1 second for each application launched
Multiply 1000 ?RoleApplicationCount ?WaitToMinimize
Delay ?WaitToMinimize
# –Press the Windows key and ‘d’
# Type \LWin+\|68
# –ShowBenchmarkTimes
If ?ShowBenchmarkTimes EQ “true”
Local ?PickListTime
Local ?ApplicationLaunchTime
# –Get difference
Subtract ?TimeB ?TimeA ?PickListTime
Subtract ?TimeD ?TimeC ?ApplicationLaunchTime
# –Show
MessageBox “Time to show picklist: ” ?PickListTime ” second(s) –” ?RoleDefCount ” role(s) shown”
MessageBox “Time to launch applications: ” ?ApplicationLaunchTime ” second(s) –” ?RoleApplicationCount ” application(s) launched”
EndIf
EndScript
To have the code please mailto Muthu Kumar Mani