/3.0
(Extension.1
Name: "Script-IO"
FirstRootClassName: "List"
Roots: 2
Roots: 3
Roots: 4
Roots: 19
Roots: 20
Roots: 21
Roots: 22
Roots: 23
Roots: 24
Roots: 25
Roots: 26
Roots: 27
Version: 30
About: "Adds a menu to the Project GUI to:\n1) Import scripts from an ArcView project, extension, or text file(s)\n2) Export script(s) to text or HTML."
InstallScript: 28
UninstallScript: 29
ExtVersion: 1
)
(List.2
)
(List.3
)
(List.4
Child: 5
Child: 12
)
(List.5
Child: 6
Child: 10
Child: 11
)
(List.6
Child: 7
Child: 8
Child: 9
)
(AVStr.7
S: "Project"
)
(AVStr.8
S: "&Script-IO"
)
(AVStr.9
S: "ScriptIO.ExportMenu"
)
(Choice.10
Help: "Export scripts to text or HTML "
Label: "&Export scripts..."
Click: "ScriptIO.ExportMenu"
Shortcut: "Keys.None"
)
(Numb.11
)
(List.12
Child: 13
Child: 17
Child: 18
)
(List.13
Child: 14
Child: 15
Child: 16
)
(AVStr.14
S: "Project"
)
(AVStr.15
S: "&Script-IO"
)
(AVStr.16
S: "ScriptIO.ImportMenu"
)
(Choice.17
Label: "&Import Scripts..."
Click: "ScriptIO.ImportMenu"
Shortcut: "Keys.None"
)
(Numb.18
N: 1.00000000000000
)
(List.19
)
(Script.20
Name: "ScriptIO.ExportTextMulti"
SourceCode: "'---------------------------------------------------\n'Name: ScriptIO.ExportTextMulti\n'Author/Date: Andy Lyons, May, 1998\n'Prepared at: GeoPlan Center, University of Florida\n'---------------------------------------------------\n'Description: Exports scripts to a multiple text files\n'Is called by: ScriptIO.ExportMenu\n'Self: A list of script names\n'---------------------------------------------------\n\nMsgBox.Info(\"Please choose a directory for your script(s) to go.\", \"S
elect Output Folder\")\ndefFN = FileName.Merge(FileName.GetCWD.AsString, \"Put My Scripts Here\")\naveDir = FileDialog.Put(defFN, \"*.ave\", \"Choose a Directory for Your Script Output\")\nif (aveDir = NIL) then return nil end\naveDir = aveDir.ReturnDir\n\nscriptsList = Self\nav.UseWaitCursor\nnumExport = 0\n\nfor each aSEd in scriptsList\n theFileStr = aSEd.GetName.LCase.Substitute(\" \",\"_\")\n theFileStr = aSEd.GetName.LCase.Substitute(\".\",\"_\")\n if (System.GetOSVariant = #SYSTEM_OSVARIANT_MSW16) then\n theFileStr = theFi
leStr.Left(8)\n end \n\n outFile = FileName.Merge(aveDir.AsString, theFileStr)\n outFile.SetExtension(\"ave\")\n \n if (File.Exists (outFile)) then\n myMsg = \"Overwrite\" ++ outFile.GetFullName + \"?\"\n Overwrite = MsgBox.YesNoCancel(myMsg, \"Save Scripts\", TRUE)\n if (Overwrite = Nil) then\n return nil\n elseif (Overwrite.Not) then\n Continue \n end\n end\n \n lf = LineFile.Make(outFile, #FILE_PERM_WRITE)\n if (lf = nil) then\n MsgBox.Warning(\"Unable to write:\"++outFile.GetFullName,\"\")\n
Continue\n end\n \n lf.WriteElt(aSEd.GetSource)\n lf.Close\n numExport = numExport + 1\nend\n\nMsgBox.Info(numExport.AsString ++ \"scripts written to:\" ++ aveDir.GetFullName, \"Complete\")\n\n\n"
)
(Script.21
Name: "ScriptIO.ExportTextSing"
SourceCode: "'---------------------------------------------------\n'Name: ScriptIO.ExportTextSing\n'Author/Date: Andy Lyons, May, 1998\n'Prepared at: GeoPlan Center, University of Florida\n'---------------------------------------------------\n'Description: Exports scripts to a single text file\n'Is called by: ScriptIO.ExportMenu\n'Self: A list of script names\n'---------------------------------------------------\n\nscriptsList = Self\n\nprojFN = av.GetProject.GetFileName\nif (projFN = NIL)
then 'i.e., untitled.apr\n projF = FileName.Merge(FileName.GetCWD.AsString, \"untitled.apr\").AsString\nelse\n projF = projFN.GetBaseName\nend\ndefFN = (projF.Left(projF.Count-4)+\"_scripts.txt\").AsFileName\ntxtFN = FileDialog.Put(defFN, \"*.txt\", \"Save Scripts As Text\")\nif (txtFN = NIL) then\n return nil\nend\n\nmyMsg = \"Add the name of each script in the output?\"\nincludeName = MsgBox.YesNoCancel (myMsg, \"Include Names\", TRUE)\nif (includeName = NIL) then return nil end\n\nmyMsg = \"Text to separate scripts in output fi
le:\"\nsepString = MsgBox.Input(myMsg, \"Separator Text\", \"======================\")\nif (sepString = NIL) then return nil end\n\nf = LineFile.Make(txtFN, #FILE_PERM_WRITE)\nif (f = nil) then \n MsgBox.Error(\"Cannot open file:\" ++ txtFN.GetName, \"\") \n return nil\nend\n\nav.UseWaitCursor \n\n'Write content of each script\nfor each aSEd in scriptsList\n if (aSEd.GetName = Script.The.GetName) then Continue end\n if (includeName) then f.WriteElt(\"SCRIPT:\" ++ aSEd.GetName) end\n f.WriteElt(aSEd.GetSource)\n f.WriteElt(se
pString)\n f.WriteElt(\"\")\nend\n\nf.close\n\nMsgBox.Info(scriptsList.Count.AsString ++ \"scripts saved to \" + txtFN.GetBaseName.AsString,\"\")\n\n"
)
(Script.22
Name: "ScriptIO.ExportHTML"
SourceCode: "'---------------------------------------------------\n'Name: ScriptIO.ExportHTML\n'Author/Date: Andy Lyons, May, 1998\n'Prepared at: GeoPlan Center, University of Florida\n'---------------------------------------------------\n'Description: Exports scripts to an HTML file\n'Is called by: ScriptIO.ExportMenu\n'Self: A list of script names\n'---------------------------------------------------\n\nscriptsList = Self\n\nprojFN = av.GetProject.GetFileName\nif (projFN = NIL) then 'i.e
., untitled.apr\n projF = FileName.Merge(FileName.GetCWD.AsString, \"untitled.apr\").AsString\nelse\n projF = projFN.GetBaseName\nend\n\ndefFN = (projF.Left(projF.Count-4)+\"_scripts.html\").AsFileName\nhtmFN = FileDialog.Put(defFN, \"*.HTML\", \"Save Scripts As\")\nif (htmFN = NIL) then\n return nil\nend\n\nf = LineFile.Make(htmFN, #FILE_PERM_WRITE)\nif (f = nil) then \n MsgBox.Error(\"Cannot open file:\" ++ htmFN.GetName, \"\") \n return nil\nend\n\nav.UseWaitCursor \n\n'Write header\nf.WriteElt(\"
\" + projF + \" scr
ipts\")\nf.WriteElt(\"\")\nf.WriteElt(\"\")\nf.WriteElt(\"Scripts from \" + projF + \"
\")\nf.WriteElt(\"\")\n\n'Write hotlinks for internal jumps\nhalfWayPoint = (scriptsList.Count / 2).Round - 1\nfor each indexNum in 0..(scriptsList.Count - 1)\n aSEd = scriptsList.Get(indexNum)\n if (aSEd.GetName = Script.The.GetName) then Continue end\n sName = aSEd.GetName\n f.WriteElt(\"- \" +
sName + \"
\")\n if (indexNum = halfWayPoint) then f.WriteElt(\" | \") end\nend\nf.WriteElt(\" |
\")\n\n'Write content of each script\nfor each aSEd in scriptsList\n if (aSEd.GetName = Script.The.GetName) then Continue end\n f.WriteElt(\"\")\n f.WriteElt(\"\" + aSEd.GetName + \"\")\n f.WriteElt(aSEd.GetSource)\n f.WriteElt(\"
top
\")\nend\n\nf.WriteElt(\"
\")\nf.close\n\nMsgBox.Info(scriptsList.Count.AsString ++ \"scripts saved to \" + htmFN.GetBaseName.AsString,\"Complete\")\n\n"
)
(Script.23
Name: "ScriptIO.ImportAV"
SourceCode: "'---------------------------------------------------\n'Name: ScriptIO.ImpApr\n'Author/Date: Andy Lyons, May, 1998\n'Prepared at: GeoPlan Center, University of Florida\n'---------------------------------------------------\n'Description: Imports user-selected scripts from another Apr\n'Is called by: \n'Calls: ScriptIO.SEdExists\n'Passes: Name of a script\n'Returns: Nothing\n'---------------------------------------------------\n\n'Get file name and open Apr\nmyFN
List = FileDialog.ReturnFiles ({\"*.apr\", \"*.avx\"}, {\"ArcView Project (*.apr)\", \"ArcView Extension (*.avx)\"}, \n \"Select ArcView File\", 0) \nif (myFNList.Count = 0) then\n return nil\nelseif (myFNList.Count > 1) then\n MsgBox.Warning(\"Please select only one file. Also note file names should not contain blank spaces.\", \"Only One File\")\n return nil\nend\nmyFN = myFNList.Get(0)\n\n'scriptsDict structure: key = name of a SEd or script; value = Pos in Apr where script begins\nscriptsDic
t = Dictionary.Make (2)\n\nmyLF = LineFile.Make (myFN, #FILE_PERM_READ)\n\n'Initialize status bar\nnumLines = myLF.GetSize\nav.SetStatus(0)\nmyMsg = \"Looking for scripts in \" + myFN.GetBaseName \nav.ShowMsg (myMsg)\n\nlookFor1 = \"(SEd.\"\nlookFor2 = \"(Script.\"\n\n'Go through Apr & look for scripts or SEd\nwhile (myLF.IsAtEnd.Not)\n av.SetStatus ((myLF.GetPos)/numLines * 100)\n thisLine = myLF.ReadElt\n if ((thisLine.Left(lookFor1.Count) = lookFor1) OR\n (thisLine.Left(lookFor2.Count) = lookFor2)) then\n \n 'Read
next line which is contains the name of the SEd\n nameLine = myLF.ReadElt\n 'Strip off the beginning 'Name:'\n nameOnly = nameLine.Right(nameLine.Count - 7)\n 'Strip off first and last characters (quotes)\n nameOnly = nameOnly.Left(nameOnly.Count - 1)\n nameOnly = nameOnly.Right(nameOnly.Count - 1)\n 'Add name and Pos to dictionary\n scriptsDict.Add(nameOnly, myLF.GetPos - 2)\n end\nend\n\nav.ClearStatus\nav.ClearMsg\n\n'Get input from user\nscriptNames = scriptsDict.ReturnKeys\nscriptNam
es.Sort(TRUE)\nmyMsg = \"Which of the following scripts would you like to import?\"\ntoImpList = MsgBox.MultiListAsString(scriptNames, myMsg, \"Select Scripts\")\nif (toImpList = NIL) then return nil end\n\n'Add scripts to this project\nnumScripts = toImpList.Count\nav.SetStatus(0)\nmyMsg = \"Importing scripts\"\nav.ShowMsg (myMsg)\n\nnumImported = 0\nfor each aScriptName in toImpList\n 'First see if any existing scripts have the same names as the new ones\n if (av.Run(\"ScriptIO.SEdExists\", aScriptName)) then \n myMsg = \"A
script named \" + aScriptName + \" already exists in this \" +\n \"project, so the new one can not be imported.\"\n MsgBox.Warning(myMsg, \"Can't Import Script\")\n Continue\n end \n \n 'Go to the beginning of the source\n myLF.SetPos(scriptsDict.Get(aScriptName))\n \n sourceMark1 = TAB + \"Source:\" + TAB 'For an SEd\n sourceMark2 = TAB + \"SourceCode:\" + TAB 'For a Script\n SEd_or_Script = myLF.ReadElt\n \n if (SEd_or_Script.Left(lookFor1.Count) = lookFor1) then\n sourceMarker = sourceMark1\n
\n elseif (SEd_or_Script.Left(lookFor2.Count) = lookFor2) then\n sourceMarker = sourceMark2\n else\n \n MsgBox.Warning(\"Can not determine if this is a SEd or a Script.\", \"Bailing\")\n return nil \n end\n \n while (TRUE)\n if (myLF.ReadElt.Left(sourceMarker.Count) = sourceMarker) then\n BREAK\n end\n end\n myLF.SetPos(myLF.GetPos - 1)\n \n 'Next add the lines of the script into a list\n sourceList = List.Make\n while (TRUE)\n someString = myLF.ReadELt\n if (someString = \")\") then\n
BREAK\n elseif ((someString.Left(1) = TAB) AND (sourceList.Count > 0)) then\n BREAK\n else\n sourceList.Add(someString)\n end\n end \n \n 'Convert the list into a string\n sourceString = \"\"\n for each sourceLine in sourceList\n sourceString = sourceString + sourceLine\n end\n\n 'Remove the beginning: 'Source: ' \n sourceString = sourceString.Right(sourceString.Count - sourceMarker.Count)\n \n 'Chop off the first and last characters (quotes)\n sourceString = sourceString.Left(sourceString.
Count - 1)\n sourceString = sourceString.Right(sourceString.Count - 1)\n \n 'Convert characters \n sourceString = sourceString.Substitute(\"\\n\", NL)\n sourceString = sourceString.Substitute(\"\\\"\"\", \"\"\"\")\n\n 'Create an SEd and add it to the project\n theSEd = SEd.MakeFromSource(sourceString, aScriptName)\n av.GetProject.AddDOC(theSEd)\n numImported = numImported + 1\n av.SetStatus (numImported/numScripts * 100)\nend\n\nav.ClearStatus\nav.ClearMsg\n\nif (numImported > 0) then\n myMsg = numImported.AsString ++ \"scrip
t(s) have been imported.\"\n MsgBox.Info(myMsg, \"Scripts Imported\")\nend\n\n"
)
(Script.24
Name: "ScriptIO.ImportText"
SourceCode: "'---------------------------------------------------\n'Name: ScriptIO.ImportText\n'Author/Date: Andy Lyons, May, 1998\n'Prepared at: GeoPlan Center, University of Florida\n'---------------------------------------------------\n'Description: Imports scripts from text file(s)\n'Is called by: Menu item\n'Calls: ScriptIO.SEdExists\n'Passes: Name of a script\n'Returns: NIL\n'---------------------------------------------------\n\n' Description: Creates a new SEd fr
om the specified source file(s) and\n' adds the new SEd to the project. Checks for a Name specified in the header\n' and if found sets the SEd name to the header name, otherwise uses the \n' basename of the source file. Uses the ArcView standard header.\n'\n' To optimize performance for scripts which don't use the standard header,\n' only the first lines in the file are searched to find the name. The\n' number of lines to search is specified as the lineSearchLimit.\n'\n' Only search the first few lines in the
header for the script name...\n'\nlineSearchLimit = 5 \n\naveFileNameList = FileDialog.ReturnFiles( {\"*.ave\", \"*.txt\"}, {\"Script (*.ave)\",\n \"Text File (*.txt)\"}, \"Load Scripts\",0 )\nif ( aveFileNameList.Count = 0 ) then return nil end\n\ntotal = aveFileNameList.Count\ncounter = 0\nnumImport = 0\n\nfor each aveFileName in aveFileNameList\n counter = counter + 1\n av.SetStatus( (counter/total) * 100 )\n av.ShowMsg( aveFileName.GetBaseName )\n\n ' Search the file for a Name entry in the header...\n ' \n aveFile = LineFi
le.Make(aveFileName, #FILE_PERM_READ)\n hasName = false\n done = false\n lineCount = 0\n \n While (done.Not)\n theString = aveFile.ReadElt\n lineCount = lineCount + 1\n if ( theString = nil ) then\n done = true\n elseif ( theString.Contains( \"Name:\" )) then\n sedName = theString.Substitute( \"Name:\", \"\").BasicTrim( \"' \",\" \" )\n if ( sedName <> \"\" ) then\n hasName = true\n end \n done = true\n elseif( lineCount = lineSearchLimit ) then \n done = true\n else\n
continue\n end\n end\n if (hasName.Not) then sedName = aveFileName.GetBaseName end\n\n 'First see if any existing scripts have the same names as the new ones\n if (av.Run(\"ScriptIO.SEdExists\", sedName)) then \n myMsg = \"A script named \" + sedName + \" already exists in this \" +\n \"project, so the new one can not be imported.\"\n MsgBox.Warning(myMsg, \"Can't Import Script\")\n Continue\n end \n \n ' Load the entire contents of the script file into a list...\n stringList = List.Make \n aveFile.
GotoBeg\n aveFile.Read( stringList, aveFile.GetSize ) \n aveFile.Close\n \n ' Convert the list of strings to a long source string...\n sourceString = \"\"\n for each s in stringList \n sourceString = sourceString + s + NL\n end\n\n ' Make new SEd from the source string....\n theSEd = SEd.MakeFromSource( sourceString, sedName )\n\n av.GetProject.AddDOC(theSEd)\n numImport = numImport + 1\nend\n\nav.ClearStatus\nav.ClearMsg\n\nMsgBox.Info(numImport.AsString ++ \"script(s) imported.\",\"Scripts Imported\")\n\n\n"
)
(Script.25
Name: "ScriptIO.SEdExists"
SourceCode: "'---------------------------------------------------\n'Name: ScriptIO.SEdExists\n'Author/Date: Andy Lyons, May, 1998\n'Prepared at: GeoPlan Center, University of Florida\n'---------------------------------------------------\n'Description: Determines whether a SEd already exists in the\n' project\n'Is called by: ScriptIO.ImpApr\n'Self: A string (name of a SEd)\n'Returns: Boolean\n'---------------------------------------------------\n\nlookFor = Self\nfo
r each aDoc in av.GetProject.GetDocs\n if (aDoc.GetName = lookFor) then\n Return TRUE\n end\nend\n\nReturn FALSE\n\n"
)
(Script.26
Name: "ScriptIO.ExportMenu"
SourceCode: "'---------------------------------------------------\n'Name: ScriptIO.ExportMenu\n'Author/Date: Andy Lyons, May, 1998\n'Prepared at: GeoPlan Center, University of Florida\n'---------------------------------------------------\n'Description: Asks user to enter which scripts to export and in\n' what format\n'Is called by: Menu item\n'Calls: ScriptIO.ExportHTML, ScriptIO.ExportTextSing,\n' or ScriptIO.ExportTextMulti\n'Passes: A list of
script names\n'---------------------------------------------------\n\nmyProject = av.GetProject\nmyDocs = myProject.GetDocs\nscriptsList = List.Make\n\nfor each curDoc in myDocs\n if (curDoc.Is(SEd)) then\n scriptsList.Add(curDoc)\n end\nend\n\nif (scriptsList.Count = 0) then\n MsgBox.Warning(\"This ArcView project does not contain any scripts.\", \"No Scripts\")\n Return NIL\nend\n\nscriptsList.Sort(TRUE)\nmyMsg = \"Which script(s) would you like to export?\"\nscriptsToExport = MsgBox.MultiListAsString(scriptsList, myMsg, \"
Export Scripts\")\nif (scriptsToExport = NIL) then return nil end\nif (scriptsToExport.Count = 0) then return nil end\n\nchoices = Dictionary.Make (2)\nchoices.Add(\"Single text file\", \"ScriptIO.ExportTextSing\")\nchoices.Add(\"Multiple text files\", \"ScriptIO.ExportTextMulti\")\nchoices.Add(\"Single HTML file\", \"ScriptIO.ExportHTML\")\n\nmyChoice = MsgBox.ListAsString(choices.ReturnKeys, \"Save script(s) as:\", \"Export Scripts\")\nif (myChoice = NIL) then return nil end\n\n\nav.Run(choices.Get(myChoice), scriptsToExport)\n"
)
(Script.27
Name: "ScriptIO.ImportMenu"
SourceCode: "'---------------------------------------------------\n'Name: ScriptIO.ImportMenu\n'Author/Date: Andy Lyons, May, 1998\n'Prepared at: GeoPlan Center, University of Florida\n'---------------------------------------------------\n'Description: Asks user to enter which scripts to import and in\n' what format\n'Is called by: Menu item\n'Calls: ScriptIO.ImportAV, ScriptIO.ImportText\n'Passes: NIL\n'---------------------------------------------------\n\nchoic
es = Dictionary.Make (2)\nchoices.Add(\"Text file(s)\", \"ScriptIO.ImportText\")\nchoices.Add(\"An ArcView project or extension\", \"ScriptIO.ImportAV\")\n\nmyChoice = MsgBox.ListAsString(choices.ReturnKeys, \n \"Import script(s) from:\", \"Import Scripts\")\nif (myChoice = NIL) then return nil end\n\nav.Run(choices.Get(myChoice), NIL)\n"
)
(Script.28
Name: "My Extension Install"
SourceCode: "'DO NOT EDIT!!!\n\nif (av.getproject=nil) then return(nil) end\n\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\ntheToolMenuList=SELF.Get(3)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\n theProject.addDoc(adoc)\nend\n\n'Add the Controls\n'\nfor each totalControl in theControlList\n 'The Control list\n acontrol=totalControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find
the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex
)\nend\n\n\n'Add the menus\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0)\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the c
urrent project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n themenu=menu.make\n themenu.setlabel(mMenu)\n theMbar.add(themenu,999)\n end\n \n themenu.add(thecontrol, theCindex)\nend\n \n \n'Add the Tool Menus\n\nfor each totalControl in theToolMenuList\n 'The Control list\n acontrol=totalControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The con
trol Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=av.getproject.findGUI(aControl.get(0)).GetToolBa
r\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex)\nend\n\n\nav.getproject.setmodified(true)\n\n\n'And the scripts add themselves\n"
)
(Script.29
Name: "My Extension Uninstall"
SourceCode: "'DO NOT EDIT!!!\n\n'The SELF is the Extension\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\ntheToolMenuList=SELF.get(3)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\n If (theProject.finddoc(adoc.getname)<>NIL) then \n theAnswer=msgbox.yesno(\"Remove the Document \"+adoc.getname+\"?\",\"Remove Document?\",TRUE)\n if (theAnswer=TRUE) then theProject.RemoveDoc(adoc) end\n end\nend\n\n'Removethe Controls\n'\nfor each totalControl in theControlList\n 'Get the control list
from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecommand=
\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n\n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n theControlSet.remove(theControl)\n if (thecontrol = \"ToolBar\") then\n theControlSet.selectdefault\n end\n end\nend\n\n\n'Remove the Menus\n'\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0
)\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n
themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n MsgBox.Warning(\"The menu named \"+mMenu+\" is not here.\",\"Script Eror\")\n 'return(nil)\n else\n \n thething=themenu.getcontrols.find(thecontrol)\n if (thething<>NIL) then \n themenu.remove(thecontrol) \n end\n 'msgbox.info(themenu.GetControls.count.asstring,\"\")\n if (themenu.GetControls.count<1) then\n theMbar.remove(themenu)\n end\n end\nend\n \nfor each totalControl in theToolMenuList\n 'Get the control list from the
Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecontrolset=av.getp
roject.findGUI(aControl.get(0)).GetToolBar\n\n \n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n \n theControlSet.remove(theControl)\n theControlSet.selectdefault\n end\n\nend\n \n\n'And the scripts delete themselves\n\n\nav.getproject.setmodified(true)\n"
)