'-------------------------------------------------------
'runScriptsMenu Ver 1.0 by Graham D Clark
'g@grahamdclark.com
'Date : Monday, October 15th, 2002
'Updated:
'(c) Copyright 2002  Lawson&Clark
'-------------------------------------------------------
'Description: run scripts from drop down menu 
'-------------------------------------------------------
'Directions:
'****Change: GetFolder line to where your scripts are.***
'add a title for each script you add in the Array list Array("blah", "blah...
'add a title for each script in the dialog title Combo("Select blah, blah...
'then either add a case and include + path to script for each script you add
'or add a case and a function for each script you add here as in eg case 2 here
'perhaps organize your scripts in different folders
'-------------------------------------------------------
'Modification: will add a script to auto update this script 
'to add scipts to list or list all scripts and a defined folder.
'-------------------------------------------------------
Path = ActiveProject.path
scriptfpath = Path & "\scripts"
set ofs = CreateObject("Scripting.FilesystemObject")
set scriptfolder = ofs.GetFolder(scriptfpath)
'eg below for a path to set to where your scripts are
'set scriptfolder = ofs.GetFolder("C:\Temp\Softimage\XSI_2.03\Data\Scripts")
set scriptfiles = scriptfolder.files

i=0
set oDict = CreateObject ("Scripting.Dictionary")
for each oitem in scriptfiles
	i = i + 1
	filenom = oitem.path
	'if oitem.Type = "VBScript Script File" then
	'if oitem.Type = "JScript Script File" then
	'logmessage "I am a JS file"
	oDict.Add i, filenom
next
	
Set XSIDial = createobject("XSIDial.XSIDialog")
	Combo = oDict.Items
	Stuff = XSIDial.Combo( "Select Script:", Combo)
	FPath = oDict.Item(Stuff+1)
	logmessage FPath
	Include FPath

'-------------------------------------------------------
Sub Include( cNameScript )
	Set FSO = CreateObject("Scripting.filesystemobject")
	Set oFile = FSO.OpenTextFile( cNameScript )
	ExecuteGlobal oFile.ReadAll()
	oFile.Close
End Sub