Okay, well here then is an example using KiXforms. This is not an optimized piece of code and should really probably be controlled using a .INI file for flexibility. You might also want to use a different object depending on how you want the form to look.
In this example the user MUST be located as a member of the 'Group_A' group. Modify this to the correct group for your usage.

 
 

 


 
 
Break On
$sAppVer = '1.0 5/15/2005'
$sKiXVer = SubStr(@KIX,1,4)
$sKiXMin = '4.23'
$sKFMin = '2.4.0.45'



If $sKiXVer < $sKiXMin
$sMsg = MessageBox('This Script requires at least KiXtart '+$skiXMin,'Version Check',4112)
Quit 1
EndIf



If @ERROR Or CheckKiXformsVersion($sKFMin) < $sKFMin
$sMsg = MessageBox('This Script requires at least KiXforms '+
$sKFMin+@CRLF+'Current version is: '+CheckKiXformsVersion(),'Version Check',4112)
Quit 1
EndIf



$System = CreateObject("Kixtart.System")



;************* Form **************
$Form = $System.Form()
$Form.Icon = 19
$Form.BorderStyle = 1
$Form.BackColor = 212,208,200
$Form.Height = 250
$Form.Center
$Form.Text = "Application Launcher"
$Form.Width = 350
;**************************************



;************* GroupBox_Selection **************
$GroupBox_Selection = $Form.Controls.GroupBox()
$GroupBox_Selection.BackColor = 212,208,200
$GroupBox_Selection.Height = 200
$GroupBox_Selection.Left = 0
$GroupBox_Selection.Text = "Select application"
$GroupBox_Selection.Top = 0
$GroupBox_Selection.Width = 340
;**************************************



;************* ComboBox2 **************
$ComboBox = $GroupBox_Selection.Controls.ComboBox()
$ComboBox.DropDownWidth = 125
$ComboBox.Height = 150
$ComboBox.Left = 15
$ComboBox.Sorted = "False"
$ComboBox.Text = "Select"
$ComboBox.Top = 25
$ComboBox.Width = 121
$ComboBox.onclick = 'SelectItem()'
;**************************************



;************* Label **************
$Label = $GroupBox_Selection.Controls.Label()
$Label.Bounds = 150,25,175,100
$Label.Text = ''
$Label.Visible = 0
;**************************************



;************* Button **************
$Button = $GroupBox_Selection.Controls.Button()
$Button.Bounds = 200,160,75,25
$Button.Text = 'E&xit'
$Button.Visible = 1
$Button.onclick = "ExitClick()"
;**************************************

;Start application additions here
$Excel = 'Excel',ReadValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe','')
$WinWord = 'Winword',ReadValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winword.exe','')


Select
Case InGroup('Group_A')
$ComboBox.AddItem($Excel[0])
$ComboBox.AddItem($WinWord[0])
Case 1
; User not found in any group
$ComboBox.AddItem('Error')
EndSelect


$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 0


Function SelectItem()
Dim $Msg
Select
Case $ComboBox.Text='Excel'
Run $Excel[1]
Case $ComboBox.Text='Winword'
Run $Winword[1]
EndSelect
If $ComboBox.Text='Error'
$Label.Text = 'Your group membership was unable to be determined ' + @CRLF +
'Please contact the Helpdesk for assistance'
Else
$Label.Text = 'The system will now launch ' + $ComboBox.Text
EndIf
$Label.Visible = 1
EndFunction



Function CheckKiXformsVersion(optional $KFMin)
Dim $KFDll,$KFVer,$objSystem,$Main
If Not $KFMin $KFMin="2.3.0.45" EndIf
$KFDll=ReadValue('HKCR\CLSID\{F89DF848-618A-46F9-8A1C-396EA442BDD3}\InprocServer32','')
If @ERROR
$CheckKiXformsVersion=@ERROR
Exit $CheckKiXformsVersion
EndIf
$KFVer=GetFileVersion($KFDll,'BinFileVersion')+GetFileVersion($KFDll,'SpecialBuild')
If @ERROR
$CheckKiXformsVersion=@ERROR
Exit $CheckKiXformsVersion
EndIf
If $KFVer < $KFMin
Exit 13
EndIf
$objSystem = CreateObject("Kixtart.System")
$Main=$objSystem.Form()
If @ERROR
$CheckKiXformsVersion=@ERROR
Exit $CheckKiXformsVersion
EndIf
$CheckKiXformsVersion=$KFVer
EndFunction

Function ExitClick()
Quit()
EndFunction


 


Edited by NTDOC (2005-05-30 01:15 AM)