<%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit Dim item If Request.QueryString("Edit")="Yes" Then EditVariables ElseIf Request.QueryString("Add")="Yes" Then AddVariable End If %> These are the existing Application level variables. Their values are stored in a text file called prefs.txt. Edit or delete them as desired in the form below.

<% DisplayVariables %>
Variable Name Variable Value

To add, delete, or change a variable, type the name and value of the variable into the text boxes below, then click Submit. If you type the name of an exiting variable and give a new value, then this variable's value will be altered in the running application and in the prefs.txt file. If you use a new variable name, an additional variable will be created for you. If you use an existing variable name and omit a value, then this variable will be deleted.

Variable Name Variable Value
<% Sub DisplayVariables Dim fso, txtSettings, stTextLine, intEqualPosition, stVarName, stVarValue, intCounter Set fso = Server.CreateObject("Scripting.FileSystemObject") Set txtSettings = fso.OpenTextFile(Server.MapPath("..\Prefs.txt")) Do Until txtSettings.AtEndOfStream stTextLine = ConvertQuotes(txtSettings.ReadLine) intEqualPosition = Instr(1, stTextLine, "=") If intEqualPosition <> 0 Then stVarName = Left(stTextLine, intEqualPosition - 1) stVarValue = Right(stTextLine, len(stTextLine) - intEqualPosition) End If Response.Write "" & stVarName & "" Response.Write "" Loop End Sub ' in order to display the quotation mark character in a form's input box ' it is necessary to convert the quotation mark to the " sequence Function ConvertQuotes(st) dim intQuotePosition intQuotePosition = Instr(1, st, Chr(34)) Do Until intQuotePosition = 0 st = Left(st, intQuotePosition - 1) & """ & Right(st, len(st) - intQuotePosition) intQuotePosition = Instr(1, st, Chr(34)) Loop ConvertQuotes = st End Function Sub ChangeVariables End Sub Sub EditVariables Dim fso, txtSettings Set fso = Server.CreateObject("Scripting.FileSystemObject") Set txtSettings = fso.CreateTextFile(Server.MapPath("Prefs.txt"), True, False) For Each item in Request.Form response.write item If Trim(item)<> "" And Trim (Request.Form(item))<>"" Then txtSettings.WriteLine item & "=" & Request.Form(item) End If Next End Sub Sub MakeNewTxtFile Dim fso, txtSettings Set fso = Server.CreateObject("Scripting.FileSystemObject") Set txtSettings = fso.CreateTextFile(Server.MapPath("Prefs.txt"), True, False) 'Create a new prefs.txt file to replace the old one For Each item in Request.Form("VarName") If item <> "" And Request.Form("VarName") <> "" Then txtSettings.WriteLine item & "=" & request.form(item) End If Next End Sub %>