omegastripes

hta_helpomatic_via_vbscript.vbs

Jan 27th, 2015
1,433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' source file hta_helpomatic.hta
  2. ' http://www.microsoft.com/en-us/download/details.aspx?id=17332
  3. ' HTA dinamically created via VBS
  4. ' this script is for further encryption and compilation to exe
  5.  
  6. With CreateWindow()
  7.     .Document.Write "<html>" & vbCrLf & _
  8.     vbCrLf & _
  9.     "<head>" & vbCrLf & _
  10.     vbCrLf & _
  11.     "<title>The HTA Helpomatic -- Presented by the Microsoft Scripting Guys</title>" & vbCrLf & _
  12.     vbCrLf & _
  13.     "<HTA:APPLICATION " & vbCrLf & _
  14.     "     ID=""objHTAHelpomatic"" " & vbCrLf & _
  15.     "     APPLICATIONNAME=""HTAHelpomatic""" & vbCrLf & _
  16.     "     SCROLL=""no""" & vbCrLf & _
  17.     "     SINGLEINSTANCE=""yes""" & vbCrLf & _
  18.     "     WINDOWSTATE=""maximize""" & vbCrLf & _
  19.     ">" & vbCrLf & _
  20.     "</head>" & vbCrLf & _
  21.     vbCrLf & _
  22.     "<style>" & vbCrLf & _
  23.     "BODY" & vbCrLf & _
  24.     "{" & vbCrLf & _
  25.     "   background-color: buttonface;" & vbCrLf & _
  26.     "   font-family: Helvetica;" & vbCrLf & _
  27.     "   font-size: 10pt;" & vbCrLf & _
  28.     "   margin-top: 10px;" & vbCrLf & _
  29.     "   margin-left: 20px;" & vbCrLf & _
  30.     "   margin-right: 20px;" & vbCrLf & _
  31.     "   margin-bottom: 10px;" & vbCrLf & _
  32.     "}" & vbCrLf & _
  33.     vbCrLf & _
  34.     vbCrLf & _
  35.     ".button" & vbCrLf & _
  36.     "{" & vbCrLf & _
  37.     "   font-family: Helvetica;" & vbCrLf & _
  38.     "   font-size: 8pt;" & vbCrLf & _
  39.     "   width: 92px;" & vbCrLf & _
  40.     vbCrLf & _
  41.     "}" & vbCrLf & _
  42.     vbCrLf & _
  43.     "textarea" & vbCrLf & _
  44.     "{" & vbCrLf & _
  45.     "   font-family: arial;" & vbCrLf & _
  46.     "   font-size: 8pt;" & vbCrLf & _
  47.     "}" & vbCrLf & _
  48.     vbCrLf & _
  49.     "select" & vbCrLf & _
  50.     "{" & vbCrLf & _
  51.     "   font-family: arial;" & vbCrLf & _
  52.     "   font-size: 8pt;" & vbCrLf & _
  53.     "   width: 350px;" & vbCrLf & _
  54.     "   margin-left: 0px;" & vbCrLf & _
  55.     "}" & vbCrLf & _
  56.     vbCrLf & _
  57.     "td" & vbCrLf & _
  58.     "{" & vbCrLf & _
  59.     "   font-family: arial;" & vbCrLf & _
  60.     "   font-size: 10pt;" & vbCrLf & _
  61.     "}" & vbCrLf & _
  62.     vbCrLf & _
  63.     "</style>" & vbCrLf & _
  64.     vbCrLf & _
  65.     vbCrLf & _
  66.     vbCrLf & _
  67.     vbCrLf & _
  68.     "<SCRIPT LANGUAGE=""VBScript"">" & vbCrLf & _
  69.     vbCrLf & _
  70.     "Sub RunScript" & vbCrLf & _
  71.     "End Sub" & vbCrLf & _
  72.     vbCrLf & _
  73.     "Sub TestSub" & vbCrLf & _
  74.     "    strCopy = ConfigureArea.Value" & vbCrLf & _
  75.     "    document.parentwindow.clipboardData.SetData ""text"", strCopy" & vbCrLf & _
  76.     "End Sub" & vbCrLf & _
  77.     vbCrLf & _
  78.     "Sub CopyCode" & vbCrLf & _
  79.     "    strCopy = SubroutineArea.Value" & vbCrLf & _
  80.     "    document.parentwindow.clipboardData.SetData ""text"", strCopy" & vbCrLf & _
  81.     "End Sub" & vbCrLf & _
  82.     vbCrLf & _
  83.     "Sub GenerateCode" & vbCrLf & _
  84.     "    Show_Example_Button.Disabled = False" & vbCrLf & _
  85.     "    Copy_HTML_Button.Disabled = False" & vbCrLf & _
  86.     "    Reset_Button.Disabled = False" & vbCrLf & _
  87.     "    Copy_Code_Button.Disabled = False" & vbCrLf & _
  88.     vbCrLf & _
  89.     "    If D1.Value = ""Autorun Script"" Then" & vbCrLf & _
  90.     "        strScript = """"" & vbCrLf & _
  91.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  92.     "        Copy_HTML_Button.Disabled = True" & vbCrLf & _
  93.     "        Reset_Button.Disabled = True" & vbCrLf & _
  94.     "        strSub = ""'Displays a message box when the application loads"" & vbcrlf & vbcrlf" & vbCrLf & _
  95.     "        strSub = strSub & ""Sub Window_Onload"" & vbcrlf" & vbCrLf & _
  96.     "        strSub = strSub & ""    Msgbox "" & chr(34) & ""The application has started."" & chr(34) & vbcrlf" & vbCrLf & _
  97.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  98.     "        strExample = strScript" & vbCrLf & _
  99.     "        strDescription = ""An autorun script is a script that runs each time the HTA is started or reloaded. (For information on how to reload an HTA, see the element <b>Refresh the HTA</b>.) There is nothing special about an autorun script; it's simply script code contained in a subroutine named <b>Window_Onload</b>. <br>&nbsp;<br>The sample code shown here displays a message box each time the HTA is started or reloaded.""" & vbCrLf & _
  100.     "    End If" & vbCrLf & _
  101.     vbCrLf & _
  102.     "    If D1.Value = ""Basic HTML tags"" Then" & vbCrLf & _
  103.     "        Reset_Button.Disabled = True" & vbCrLf & _
  104.     "        Copy_Code_Button.Disabled = True" & vbCrLf & _
  105.     "        strScript = ""<b>boldface text</b> <i>italic text</i> <u>underlined text</u><br>regular script <sub>sub</sub>script <sup>super</sup>script<br>This &nbsp;&nbsp;&nbsp;&nbsp; text &nbsp;&nbsp;&nbsp;&nbsp; is &nbsp;&nbsp;&nbsp;&nbsp; separated &nbsp;&nbsp;&nbsp;&nbsp; by &nbsp;&nbsp;&nbsp;&nbsp; blank &nbsp;&nbsp;&nbsp;&nbsp; spaces.""" & vbCrLf & _
  106.     "        strExample = strScript" & vbCrLf & _
  107.     "        strDescription = ""This sample illustrates some basic HTML tags, including <b>b</b> (bold), <b>i</b> (italics), and <b>u</b> (underline). These tags help you create formatted output.""" & vbCrLf & _
  108.     "    End If" & vbCrLf & _
  109.     vbCrLf & _
  110.     "    If D1.Value=""Button"" Then" & vbCrLf & _
  111.     "        strScript = ""<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  112.     "        strSub = ""'Displays a message box when the button is clicked"" & vbcrlf & vbcrlf & ""Sub RunScript"" & vbcrlf & ""    Msgbox "" & chr(34) & ""Test"" & chr(34) & vbcrlf & ""End Sub""" & vbCrLf & _
  113.     "        strExample = strScript" & vbCrLf & _
  114.     "        strDescription = ""Buttons are used to initiate actions, which, in an HTA, typically means running a script of some kind. With a button, you will primarily be concerned with the <b>Value</b> (which is actually the on-screen label for the button) and the <b>onClick event</b>, with which you specify the script that runs when the button is clicked.<br>&nbsp;<br>In the example, the button simply displays a message box when clicked.""" & vbCrLf & _
  115.     "    End If" & vbCrLf & _
  116.     vbCrLf & _
  117.     "    If D1.Value=""Checkbox"" Then" & vbCrLf & _
  118.     "        strScript = ""<input type="" & chr(34) & ""checkbox"" & chr(34) & ""name="" & chr(34) & ""BasicCheckbox"" & chr(34) & ""value="" & chr(34) & ""1"" & chr(34) & ""> Option 1""" & vbCrLf & _
  119.     "        strSub = ""'Tells you whether BasicCheckbox has been selected or not"" & vbcrlf & vbcrlf  " & vbCrLf & _
  120.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  121.     "        strSub = strSub & ""    If BasicCheckbox.Checked Then"" & vbcrlf" & vbCrLf & _
  122.     "        strSub = strSub & ""        Msgbox "" & chr(34) & ""The checkbox has been checked."" & chr(34) & vbcrlf" & vbCrLf & _
  123.     "        strSub = strSub & ""    Else"" & vbcrlf" & vbCrLf & _
  124.     "        strSub = strSub & ""        Msgbox "" & chr(34) & ""The checkbox has not been checked."" & chr(34) & vbcrlf" & vbCrLf & _
  125.     "        strSub = strSub & ""    End If"" & vbcrlf" & vbCrLf & _
  126.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  127.     "        strExample = strScript & ""&nbsp;&nbsp;&nbsp;<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  128.     "        strDescription = ""A checkbox is typically used for optional elements within a script: yes, we want to check available memory on a computer; no, we don't want to check available memory on a computer. Interesting things you can do with a checkbox include disabling it (<b>Disabled = True</b>) and configuring it to be automatically selected when displayed (<b>Checked = True</b>).<br>&nbsp;<br>In this example, select or de-select the checkbox and then click the Run Button; the script will determine whether the checkbox has been selected or not, and then inform you of its current state.""" & vbCrLf & _
  129.     "    End If" & vbCrLf & _
  130.     vbCrLf & _
  131.     "    If D1.Value = ""Data display in new window"" Then" & vbCrLf & _
  132.     "        strScript = """"" & vbCrLf & _
  133.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  134.     "        Copy_HTML_Button.Disabled = True       " & vbCrLf & _
  135.     "        strSub = ""'Displays formatted information in a new window"" & vbcrlf & vbcrlf" & vbCrLf & _
  136.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  137.     "        strSub = strSub & ""    Set objIE = CreateObject("" & chr(34) & ""InternetExplorer.Application"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  138.     "        strSub = strSub & ""    objIE.Navigate("" & chr(34) & ""about:blank"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  139.     "        strSub = strSub & ""    objIE.ToolBar = 0"" & vbcrlf" & vbCrLf & _
  140.     "        strSub = strSub & ""    objIE.StatusBar = 0"" & vbcrlf" & vbCrLf & _
  141.     "        strSub = strSub & ""    Set objDoc = objIE.Document.Body"" & vbcrlf" & vbCrLf & _
  142.     "        strSub = strSub & ""    strHTML = "" & chr(34) & ""<B>This information is displayed in a separate window.</B>"" & chr(34) & vbcrlf" & vbCrLf & _
  143.     "        strSub = strSub & ""    objDoc.InnerHTML = strHTML"" & vbcrlf" & vbCrLf & _
  144.     "        strSub = strSub & ""    objIE.Visible = True"" & vbcrlf" & vbCrLf & _
  145.     "        strSub = strSub & ""End Sub""           " & vbCrLf & _
  146.     "        strExample = ""<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  147.     "        strDescription = ""By creating a new instance of Internet Explorer, you can display data in a window separate from your main HTA window. To do this, create the new instance of Internet Explorer, and Navigate to about:blank (which causes Internet Explorer to open up with a blank page). You can then write data to this new window by setting the <b>InnerHTML property</b> of the document to the desired values.<br>&nbsp;<br>This example opens a new window and simply displays one formatted sentence.<br>&nbsp;<br><b>Note</b>: Be sure you set the <b>Visible</b> property of the new Internet Explorer instance to True. Otherwise, your window will not be visible on screen.""" & vbCrLf & _
  148.     "    End If" & vbCrLf & _
  149.     vbCrLf & _
  150.     "    If D1.Value = ""Change cursor"" Then" & vbCrLf & _
  151.     "        strScript = """"" & vbCrLf & _
  152.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  153.     "        Copy_HTML_Button.Disabled = True       " & vbCrLf & _
  154.     "        strSub = ""'Changes the cursor to an hourglass, pauses, then changes it back to the default"" & vbcrlf & vbcrlf" & vbCrLf & _
  155.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  156.     "        strSub = strSub & ""    document.body.style.cursor = "" & chr(34) & ""wait"" & chr(34) & vbcrlf" & vbCrLf & _
  157.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  158.     "        strExample = ""<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  159.     "        strDescription = ""Using a script, you can modify the cursor to reflect the current state of your HTA; for example, if the HTA is carrying out a lengthy procedure, you can change the cursor to an hourglass. The cursor can be changed to any of the following: crosshair; default; hand; help; wait.<br>&nbsp;<br>In this example, clicking the Run Button will change the cursor to an hourglass. To change it back, modify the script by setting the cursor to <b>default</b>. Click the Reset Example button to apply the new script code, and then click the Run Button again.""" & vbCrLf & _
  160.     "    End If" & vbCrLf & _
  161.     vbCrLf & _
  162.     "    If D1.Value = ""Copy to Clipboard"" Then" & vbCrLf & _
  163.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  164.     "        strScript = ""<textarea name="" & chr(34) & ""BasicTextArea"" & chr(34) & "" rows="" & chr(34) & ""5"" & chr(34) & "" cols="" & chr(34) & ""75"" & chr(34) & ""></textarea>""" & vbCrLf & _
  165.     "        strSub = ""' Copies the contents of the text area to the clipboard"" & vbcrlf & vbcrlf" & vbCrLf & _
  166.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  167.     "        strSub = strSub & ""    strCopy = BasicTextArea.Value"" & vbcrlf" & vbCrLf & _
  168.     "        strSub = strSub & ""    document.parentwindow.clipboardData.SetData "" & chr(34) & ""text"" & chr(34) & "", strCopy"" & vbcrlf" & vbCrLf & _
  169.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  170.     "        strExample = strScript & ""&nbsp;&nbsp;&nbsp;<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  171.     "        strDescription = ""Sample script that copies the contents of the text area named BasicTextArea to the Clipboard. To test the script, type some information into the text area, and then click the Run Button. The information you typed will now be copied to the Clipboard. (You don't need to select the text; just click the button.)""" & vbCrLf & _
  172.     "    End If" & vbCrLf & _
  173.     vbCrLf & _
  174.     "    If D1.Value = ""Create basic HTA"" Then" & vbCrLf & _
  175.     "        Reset_Button.Disabled = True" & vbCrLf & _
  176.     "        Copy_Code_Button.Disabled = True" & vbCrLf & _
  177.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  178.     "        strScript = ""<html>"" & vbcrlf" & vbCrLf & _
  179.     "        strScript = strScript & ""<head>"" & vbcrlf" & vbCrLf & _
  180.     "        strScript = strScript & ""<title>HTA Helpomatic</title>"" & vbcrlf & vbcrlf" & vbCrLf & _
  181.     "        strScript = strScript & ""<HTA:APPLICATION "" & vbcrlf" & vbCrLf & _
  182.     "        strScript = strScript & ""     ID="" & chr(34) & ""objHTAHelpomatic"" & chr(34) & vbcrlf" & vbCrLf & _
  183.     "        strScript = strScript & ""     APPLICATIONNAME="" & chr(34) & ""HTAHelpomatic"" & chr(34) & vbcrlf" & vbCrLf & _
  184.     "        strScript = strScript & ""     SCROLL="" & chr(34) & ""yes"" & chr(34) & vbcrlf" & vbCrLf & _
  185.     "        strScript = strScript & ""     SINGLEINSTANCE="" & chr(34) & ""yes"" & chr(34) & vbcrlf" & vbCrLf & _
  186.     "        strScript = strScript & ""     WINDOWSTATE="" & chr(34) & ""maximize"" & chr(34) & vbcrlf" & vbCrLf & _
  187.     "        strScript = strScript & "">"" & vbcrlf" & vbCrLf & _
  188.     "        strScript = strScript & ""</head>"" & vbcrlf & vbcrlf" & vbCrLf & _
  189.     "        strScript = strScript & ""<SCRIPT Language="" & chr(34) & ""VBScript"" & chr(34) & "">"" & vbcrlf" & vbCrLf & _
  190.     "        strScript = strScript & ""</"" & ""SCRIPT>"" & vbcrlf" & vbCrLf & _
  191.     "        strScript = strScript & ""<body>"" & vbcrlf & vbcrlf & vbcrlf" & vbCrLf & _
  192.     "        strScript = strScript & ""</body>"" & vbcrlf" & vbCrLf & _
  193.     "        strScript = strScript & ""</html>""" & vbCrLf & _
  194.     "        strDescription = ""Sample code that creates the basic structure of an HTA; to use this, copy the code, paste it into Notepad, and then save the file with a .hta file extension. You can then place HTML elements (such as buttons and listboxes) inside the body tag, and place scripts that you write inside the script tag.<br>&nbsp;<br>Note: Be sure your scripts have unique names within each HTA, and that they start with the <b>Sub</b> tag (for example, <b>Sub RunScript</b>) and end with the <b>End Sub</b> tag.""" & vbCrLf & _
  195.     "    End If" & vbCrLf & _
  196.     vbCrLf & _
  197.     "    If D1.Value = ""Disabled control"" Then" & vbCrLf & _
  198.     "        strScript = ""<select size="" & chr(34) & ""3"" & chr(34) &  "" name="" & chr(34) & ""Dropdown1"" & chr(34) &  "" Disabled=True>"" & vbcrlf" & vbCrLf & _
  199.     "        strScript = strScript & ""<option value="" & chr(34) & ""1"" & chr(34) & "">Option 1</option>"" & vbcrlf" & vbCrLf & _
  200.     "        strScript = strScript & ""<option value="" & chr(34) & ""2"" & chr(34) & "">Option 2</option>"" & vbcrlf" & vbCrLf & _
  201.     "        strScript = strScript & ""<option value="" & chr(34) & ""3"" & chr(34) & "">Option 3</option>"" & vbcrlf" & vbCrLf & _
  202.     "        strScript = strScript & ""<option value="" & chr(34) & ""4"" & chr(34) & "">Option 4</option>"" & vbcrlf" & vbCrLf & _
  203.     "        strScript = strScript & ""</select>""" & vbCrLf & _
  204.     "        strSub = ""'Enables the dropdownl list named DropDown1"" & vbcrlf & vbcrlf" & vbCrLf & _
  205.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  206.     "        strSub = strSub & ""    DropDown1.Disabled = False"" & vbcrlf" & vbCrLf & _
  207.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  208.     "        strExample = strScript & ""&nbsp;&nbsp;&nbsp;<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  209.     "        strDescription = ""Among other things, disabling a control makes that control available only when it makes sense for it to be available. (For example, you might keep a Create New User button disabled until the user has entered all the requisite information, such as user name, password, etc.) You can programmatically enable a disabled control (or vice-versa) by setting the item's Disabled property to False.<br>&nbsp;<br>In this example, clicking the Run Button will enable the listbox. To disable the listbox, change the code so that the <b>Disabled</b> property is True, click the Reset Example button, and then click the Run Button again.""" & vbCrLf & _
  210.     "    End If" & vbCrLf & _
  211.     vbCrLf & _
  212.     "    If D1.Value = ""Display a confirmation box"" Then" & vbCrLf & _
  213.     "        strScript = """"" & vbCrLf & _
  214.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  215.     "        Copy_HTML_Button.Disabled = True" & vbCrLf & _
  216.     "        strSub = ""'Displays a confirmation box before proceeding with the script"" & vbcrlf & vbcrlf" & vbCrLf & _
  217.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  218.     "        strSub = strSub & ""    blnAnswer = window.confirm("" & chr(34) & ""Are you sure you want to continue?"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  219.     "        strSub = strSub & ""    If blnAnswer Then"" & vbcrlf" & vbCrLf & _
  220.     "        strSub = strSub & ""        Msgbox "" & chr(34) & ""You clicked the OK button"" & chr(34) & vbcrlf" & vbCrLf & _
  221.     "        strSub = strSub & ""    Else"" & vbcrlf" & vbCrLf & _
  222.     "        strSub = strSub & ""        Msgbox "" & chr(34) & ""You clicked the Cancel button."" & chr(34) & vbcrlf" & vbCrLf & _
  223.     "        strSub = strSub & ""    End If"" & vbcrlf" & vbCrLf & _
  224.     "        strSub = strSub & ""End Sub"" & vbcrlf" & vbCrLf & _
  225.     "        strExample = ""<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  226.     "        strDescription = ""The Confirm method displays a dialog box that contains both an OK and a Cancel button. If the return value from the confirmation box is True, that means the user clicked the OK button; if the return value is False, that means the user clicked the Cancel button.<br>&nbsp;<br>The sample script displays a message box asking, 'Are you sure you want to continue?' To display a different message, simply set that message as the sole parameter passed to the Confirm method.""" & vbCrLf & _
  227.     "    End If" & vbCrLf & _
  228.     vbCrLf & _
  229.     "    If D1.Value = ""Display the print dialog box"" Then" & vbCrLf & _
  230.     "        strScript = """"" & vbCrLf & _
  231.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  232.     "        Copy_HTML_Button.Disabled = True" & vbCrLf & _
  233.     "        Reset_Button.Disabled = True" & vbCrLf & _
  234.     "        strSub = ""'Display the print dialog box"" & vbcrlf & vbcrlf" & vbCrLf & _
  235.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  236.     "        strSub = strSub & ""    Window.Print()"" & vbcrlf" & vbCrLf & _
  237.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  238.     "        strExample = ""<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  239.     "        strDescription = ""This code displays the Print dialog box, enabling you to print the current page. Alternatively, you can right-click anywhere in the document and select Print to display this dialog box. A button such as this can be particularly useful in cases where you are displaying data in a new (and presumably uncluttered) window.""" & vbCrLf & _
  240.     "    End If" & vbCrLf & _
  241.     vbCrLf & _
  242.     "    If D1.Value = ""Drop-down Listbox"" Then" & vbCrLf & _
  243.     "        strScript = ""<select size="" & chr(34) & ""1"" & chr(34) &  "" name="" & chr(34) & ""DropDown1"" & chr(34) &  "" onChange="" & chr(34) & ""RunScript"" & chr(34) & "">"" & vbcrlf" & vbCrLf & _
  244.     "        strScript = strScript & ""<option value="" & chr(34) & ""1"" & chr(34) & "">Option 1</option>"" & vbcrlf" & vbCrLf & _
  245.     "        strScript = strScript & ""<option value="" & chr(34) & ""2"" & chr(34) & "">Option 2</option>"" & vbcrlf" & vbCrLf & _
  246.     "        strScript = strScript & ""<option value="" & chr(34) & ""3"" & chr(34) & "">Option 3</option>"" & vbcrlf" & vbCrLf & _
  247.     "        strScript = strScript & ""<option value="" & chr(34) & ""4"" & chr(34) & "">Option 4</option>"" & vbcrlf" & vbCrLf & _
  248.     "        strScript = strScript & ""</select>""" & vbCrLf & _
  249.     "        strSub = ""'Indicates which option in DropDown1 was selected"" & vbcrlf & vbcrlf  " & vbCrLf & _
  250.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  251.     "        strSub = strSub & ""    Msgbox DropDown1.Value"" & vbcrlf" & vbCrLf & _
  252.     "        strSub = strSub & ""End Sub"" & vbcrlf" & vbCrLf & _
  253.     "        strExample = strScript " & vbCrLf & _
  254.     "        strDescription = ""A drop-down listbox allows you to select one item from any number of options. The HTML code for a drop-down listbox consists of a select tag (which creates the list) and a number of option tags, with each option tag representing one item in the drop-down list. Each item in the list should have a unique value; to set a particular option as the default value, set its <b>Selected</b> property to True.<br>&nbsp;<br>The sample drop-down listbox shows four options; when you select one, a script (RunScript) runs, and a message box apears displaying the value of the selected item.""" & vbCrLf & _
  255.     "    End If" & vbCrLf & _
  256.     vbCrLf & _
  257.     "    If D1.Value = ""Font Formatting"" Then" & vbCrLf & _
  258.     "        Reset_Button.Disabled = True" & vbCrLf & _
  259.     "        Copy_Code_Button.Disabled = True" & vbCrLf & _
  260.     "        strScript = ""<font color="" & chr(34) & ""red"" & chr(34) & "" face="" & chr(34) & ""Times New Roman"" & chr(34) & "" size="" & chr(34) & ""6"" & chr(34) & "">Your text goes here</font>""" & vbCrLf & _
  261.     "        strExample = strScript" & vbCrLf & _
  262.     "        strDescription = ""HTML gives you a considerable amount of control over fonts and font formatting. This example uses basic HTML tags to set the font color (red), typeface (Times New Roman) and size (6, based on an HTML standard where 1 is the smallest font and 6 the largest). Font formats can also be controlled in an HTA by using styles and stylesheets.""" & vbCrLf & _
  263.     "    End If" & vbCrLf & _
  264.     vbCrLf & _
  265.     "    If D1.Value = ""Hyperlink"" Then" & vbCrLf & _
  266.     "        Reset_Button.Disabled = True" & vbCrLf & _
  267.     "        Copy_Code_Button.Disabled = True" & vbCrLf & _
  268.     "        strScript = ""<a href="" & chr(34) & ""http://www.microsoft.com/technet/scriptcenter"" & chr(34) & "" target="" & chr(34) & ""blank"" & chr(34) & "">Script Center</a href>""" & vbCrLf & _
  269.     "        strExample = strScript" & vbCrLf & _
  270.     "        strDescription = ""Hyperlinks enable you to open Web pages (either from the local computer or across the Internet) and display them. The sample HTML code shown here opens the Script Center home page in a separate window (<b>target= 'blank'</b>).""" & vbCrLf & _
  271.     "    End If" & vbCrLf & _
  272.     vbCrLf & _
  273.     "    If D1.Value = ""Listbox"" Then" & vbCrLf & _
  274.     "        strScript = ""<select size="" & chr(34) & ""3"" & chr(34) &  "" name="" & chr(34) & ""Listbox1"" & chr(34) &  "" onChange="" & chr(34) & ""RunScript"" & chr(34) & "">"" & vbcrlf" & vbCrLf & _
  275.     "        strScript = strScript & ""<option value="" & chr(34) & ""1"" & chr(34) & "">Option 1</option>"" & vbcrlf" & vbCrLf & _
  276.     "        strScript = strScript & ""<option value="" & chr(34) & ""2"" & chr(34) & "">Option 2</option>"" & vbcrlf" & vbCrLf & _
  277.     "        strScript = strScript & ""<option value="" & chr(34) & ""3"" & chr(34) & "">Option 3</option>"" & vbcrlf" & vbCrLf & _
  278.     "        strScript = strScript & ""<option value="" & chr(34) & ""4"" & chr(34) & "">Option 4</option>"" & vbcrlf" & vbCrLf & _
  279.     "        strScript = strScript & ""</select>""" & vbCrLf & _
  280.     "        strSub = ""'Indicates which option in Listbox1 was selected"" & vbcrlf & vbcrlf  " & vbCrLf & _
  281.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  282.     "        strSub = strSub & ""    Msgbox Listbox1.Value"" & vbcrlf" & vbCrLf & _
  283.     "        strSub = strSub & ""End Sub"" " & vbCrLf & _
  284.     "        strExample = strScript " & vbCrLf & _
  285.     "        strDescription = ""A listbox is nothing more than a drop-down listbox with a <b>Size</b> larger than 1. (The size indicates how many items are displayed on screen at one time.)<br>&nbsp;<br>The sample code simply displays the listbox item that is currently selected.""" & vbCrLf & _
  286.     "    End If" & vbCrLf & _
  287.     vbCrLf & _
  288.     "    If D1.Value = ""Multi-select List Box"" Then" & vbCrLf & _
  289.     "        strScript = ""<select size="" & chr(34) & ""3"" & chr(34) &  "" name="" & chr(34) & ""DropDown1"" & chr(34) &  "" multiple>"" & vbcrlf" & vbCrLf & _
  290.     "        strScript = strScript & ""<option value="" & chr(34) & ""1"" & chr(34) & "">Option 1</option>"" & vbcrlf" & vbCrLf & _
  291.     "        strScript = strScript & ""<option value="" & chr(34) & ""2"" & chr(34) & "">Option 2</option>"" & vbcrlf" & vbCrLf & _
  292.     "        strScript = strScript & ""<option value="" & chr(34) & ""3"" & chr(34) & "">Option 3</option>"" & vbcrlf" & vbCrLf & _
  293.     "        strScript = strScript & ""<option value="" & chr(34) & ""4"" & chr(34) & "">Option 4</option>"" & vbcrlf" & vbCrLf & _
  294.     "        strScript = strScript & ""</select>""" & vbCrLf & _
  295.     "        strSub = ""'Displays all the items selected in a multi-select listbox"" & vbcrlf & vbcrlf" & vbCrLf & _
  296.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  297.     "        strSub = strSub & ""    For i = 0 to (Dropdown1.Options.Length - 1)"" & vbcrlf" & vbCrLf & _
  298.     "        strSub = strSub & ""        If (Dropdown1.Options(i).Selected) Then"" & vbcrlf" & vbCrLf & _
  299.     "        strSub = strSub & ""            strComputer = strComputer & Dropdown1.Options(i).Value & vbcrlf"" & vbcrlf" & vbCrLf & _
  300.     "        strSub = strSub & ""        End If"" & vbcrlf" & vbCrLf & _
  301.     "        strSub = strSub & ""    Next"" & vbcrlf" & vbCrLf & _
  302.     "        strSub = strSub & ""    Msgbox strComputer"" & vbcrlf" & vbCrLf & _
  303.     "        strSub = strSub & ""End Sub  """ & vbCrLf & _
  304.     "        strExample = strScript & ""&nbsp;&nbsp;&nbsp;<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  305.     "        strDescription = ""A multi-select listbox allows you to select more than one item at a time; to do so, click on the first item, then hold down the CTRL key and click on any subsequent items. Any listbox can be turned into a multi-select listbox simply by adding the <b>multiple</b> parameter.<br>&nbsp;<br>The sample script shows how to loop through the items in the listbox and identify which ones have been selected.""" & vbCrLf & _
  306.     "    End If" & vbCrLf & _
  307.     vbCrLf & _
  308.     "    If D1.Value = ""On-the-fly listbox"" Then" & vbCrLf & _
  309.     "        strScript = """"" & vbCrLf & _
  310.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  311.     "        Copy_HTML_Button.Disabled = True        " & vbCrLf & _
  312.     "        Reset_Button.Disabled = True" & vbCrLf & _
  313.     "        strSub = ""'Creates an on-the-fly listbox based on the contents of the text file computers.txt"" & vbcrlf & vbcrlf" & vbCrLf & _
  314.     "        strSub = strSub & ""Sub Window_Onload"" & vbcrlf" & vbCrLf & _
  315.     "        strSub = strSub & ""    ForReading = 1"" & vbcrlf" & vbCrLf & _
  316.     "        strSub = strSub & ""    strNewFile = "" & chr(34) & ""computers.txt"" & chr(34) & vbcrlf" & vbCrLf & _
  317.     "        strSub = strSub & ""    Set objFSO = CreateObject("" & chr(34) & ""Scripting.FileSystemObject"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  318.     "        strSub = strSub & ""    Set objFile = objFSO.OpenTextFile _"" & vbcrlf" & vbCrLf & _
  319.     "        strSub = strSub & ""        (strNewFile, ForReading)"" & vbcrlf" & vbCrLf & _
  320.     "        strSub = strSub & ""    Do Until objFile.AtEndOfStream"" & vbcrlf" & vbCrLf & _
  321.     "        strSub = strSub & ""        strLine = objFile.ReadLine"" & vbcrlf" & vbCrLf & _
  322.     "        strSub = strSub & ""        Set objOption = Document.createElement("" & chr(34) & ""OPTION"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  323.     "        strSub = strSub & ""        objOption.Text = strLine"" & vbcrlf" & vbCrLf & _
  324.     "        strSub = strSub & ""        objOption.Value = strLine"" & vbcrlf" & vbCrLf & _
  325.     "        strSub = strSub & ""        AvailableComputers.Add(objOption)"" & vbcrlf" & vbCrLf & _
  326.     "        strSub = strSub & ""    Loop"" & vbcrlf" & vbCrLf & _
  327.     "        strSub = strSub & ""    objFile.Close"" & vbcrlf" & vbCrLf & _
  328.     "        strSub = strSub & ""End Sub""   " & vbCrLf & _
  329.     "        strExample = strScript" & vbCrLf & _
  330.     "        strDescription = ""Sample code that reads in a list of computer names from a text file (computers.txt) and then constructs a listbox using the names read in from the list. This simple example does not allow you to modify the list after it has been created; to get a different set of computers in the listbox, you will have to edit the computers.txt file and then re-run the code.""" & vbCrLf & _
  331.     "    End If" & vbCrLf & _
  332.     vbCrLf & _
  333.     "    If D1.Value=""Password box"" Then" & vbCrLf & _
  334.     "        strScript = ""<input type="" & chr(34) & ""password"" & chr(34) & "" name="" & chr(34) & ""PasswordArea"" & chr(34) & "" size="" & chr(34) & ""30"" & chr(34) & "">""" & vbCrLf & _
  335.     "        strSub = ""'Displays the value typed into the password box"" & vbcrlf & vbcrlf" & vbCrLf & _
  336.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  337.     "        strSub = strSub & ""    Msgbox PasswordArea.Value"" & vbcrlf" & vbCrLf & _
  338.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  339.     "        strExample = strScript & ""&nbsp;&nbsp;&nbsp;<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  340.     "        strDescription = ""A password box masks any data entered into it, displaying black circles rather than the actual characters. However, the actual characters are still recorded by and available to your script. This allows you to enter sensitive information, such as passwords, without having that information displayed on screen. One interesting property you can set here: <b>MaxLength</b>, which limits the number of characters that can be typed into the box.<br>&nbsp;<br>In the example shown here, the information you type in the password box is displayed in a message box when you click Run Button. This simply demonstrates that the masked information is available for use by the script.""" & vbCrLf & _
  341.     "    End If" & vbCrLf & _
  342.     vbCrLf & _
  343.     "    If D1.Value = ""Paste from Clipboard"" Then" & vbCrLf & _
  344.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  345.     "        strScript = ""<span id=DataArea>This is a span named DataArea.</span>""" & vbCrLf & _
  346.     "        strSub = ""' Pastes the contents of the clipboard to the span named DataArea"" & vbcrlf & vbcrlf" & vbCrLf & _
  347.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  348.     "        strSub = strSub & ""    DataArea.InnerHTML = document.parentwindow.clipboardData.GetData("" & chr(34) & ""text"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  349.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  350.     "        strExample = strScript & ""<br>&nbsp;<br><input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  351.     "        strDescription = ""The clipboardData.GetData method allows you to programmtically paste text currently on the Clipboard. In a textbox or textarea, you can paste from the Clipboard by typing CTRL-V or by right-clicking and choosing Paste from the context menu. The clipboardData.GetData method, however, enables you to paste Clipboard text into other parts of your document, such as a span.<br>&nbsp;<br>To use the sample code, copy some text to the Clipboard, then click the Run Button to insert that text into the span named DataArea.""" & vbCrLf & _
  352.     "    End If" & vbCrLf & _
  353.     vbCrLf & _
  354.     "    If D1.Value = ""Prompt the user for input"" Then" & vbCrLf & _
  355.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  356.     "        Copy_HTML_Button.Disabled = True" & vbCrLf & _
  357.     "        strSub = ""'Displays a dialog box prompting the user for input"" & vbcrlf & vbcrlf" & vbCrLf & _
  358.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  359.     "        strSub = strSub & ""    strAnswer = window.prompt("" & chr(34) & ""Please enter the domain name."" & chr(34) & "", "" & chr(34) & ""fabrikam.com"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  360.     "        strSub = strSub & ""    If IsNull(strAnswer) Then"" & vbcrlf" & vbCrLf & _
  361.     "        strSub = strSub & ""        Msgbox "" & chr(34) & ""You clicked the Cancel button"" & chr(34) & vbcrlf" & vbCrLf & _
  362.     "        strSub = strSub & ""    Else"" & vbcrlf" & vbCrLf & _
  363.     "        strSub = strSub & ""        Msgbox "" & chr(34) & ""You entered: "" & chr(34) & "" & strAnswer"" & vbcrlf" & vbCrLf & _
  364.     "        strSub = strSub & ""    End If"" & vbcrlf" & vbCrLf & _
  365.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  366.     "        strExample = ""<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  367.     "        strDescription = ""This sample script displays a dialog box, complete with OK and Cancel buttons, that prompts the user to enter data of some kind. If the return value for the input box is null, that means the user clicked the Cancel button; if the user clicks OK, the return value will be whatever has been typed into the input box. (If the user does not type anything yet still clicks OK, the return value will be an empty string rather than null.) If you click the Run Button and respond to the input box, the sample script will report the return value.<br>&nbsp;<br>The input box accepts two parameters: the prompt message and, optionally, a default value.""" & vbCrLf & _
  368.     "    End If" & vbCrLf & _
  369.     vbCrLf & _
  370.     "    If D1.Value=""Radio button"" Then" & vbCrLf & _
  371.     "        strScript = ""<input type="" & chr(34) & ""radio"" & chr(34) & "" name="" & chr(34) & ""UserOption"" & chr(34) & "" value="" & chr(34) & ""1"" & chr(34) & "">Option 1<BR>"" & vbcrlf" & vbCrLf & _
  372.     "        strScript = strScript & ""<input type="" & chr(34) & ""radio"" & chr(34) & "" name="" & chr(34) & ""UserOption"" & chr(34) & "" value="" & chr(34) & ""2"" & chr(34) & "">Option 2<BR>"" & vbcrlf" & vbCrLf & _
  373.     "        strScript = strScript & ""<input type="" & chr(34) & ""radio"" & chr(34) & "" name="" & chr(34) & ""UserOption"" & chr(34) & "" value="" & chr(34) & ""3"" & chr(34) & "">Option 3<BR>"" & vbcrlf" & vbCrLf & _
  374.     "        strSub = ""'Indicates which radio button was selected"" & vbcrlf & vbcrlf" & vbCrLf & _
  375.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  376.     "        strSub = strSub & ""    If UserOption(0).Checked Then"" & vbcrlf" & vbCrLf & _
  377.     "        strSub = strSub & ""        Msgbox "" & chr(34) & ""Option 1 was selected."" & chr(34) & vbcrlf" & vbCrLf & _
  378.     "        strSub = strSub & ""    End If"" & vbcrlf" & vbCrLf & _
  379.     "        strSub = strSub & ""    If UserOption(1).Checked Then"" & vbcrlf" & vbCrLf & _
  380.     "        strSub = strSub & ""        Msgbox "" & chr(34) & ""Option 2 was selected."" & chr(34) & vbcrlf" & vbCrLf & _
  381.     "        strSub = strSub & ""    End If"" & vbcrlf" & vbCrLf & _
  382.     "        strSub = strSub & ""    If UserOption(2).Checked Then"" & vbcrlf" & vbCrLf & _
  383.     "        strSub = strSub & ""        Msgbox "" & chr(34) & ""Option 3 was selected."" & chr(34) & vbcrlf" & vbCrLf & _
  384.     "        strSub = strSub & ""    End If"" & vbcrlf" & vbCrLf & _
  385.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  386.     "        strExample = strScript & ""<br><input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  387.     "        strDescription = ""Radio buttons are used for choices that are mutually exclusive: you can either disable or enable a user account, but you can't do both at the same time. Radio buttons are meaningless by themselves: you must have at least two of them, and they must have the same Name. If you prefer one of those buttons to represent the default, simply set its <b>Checked</b> property to True.<br>&nbsp;<br>To run the sample script, select a button and then click the Run Button; the script will tell you which option was selected.""" & vbCrLf & _
  388.     "    End If" & vbCrLf & _
  389.     vbCrLf & _
  390.     "    If D1.Value = ""Refresh the HTA"" Then" & vbCrLf & _
  391.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  392.     "        Copy_HTML_Button.Disabled = True" & vbCrLf & _
  393.     "        strSub = ""'Refreshes the HTA page, which includes re-running any Windows_Onload code"" & vbcrlf & vbcrlf" & vbCrLf & _
  394.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  395.     "        strSub = strSub & ""    Location.Reload(True)"" & vbcrlf" & vbCrLf & _
  396.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  397.     "        strExample = ""<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  398.     "        strDescription = ""Sample code that refreshes the HTA window. In effect, this reloads and restarts the HTA. The Reload method is useful if certain data has changed since the HTA was started. For example, suppose your HTA reads in a list of computer names from a text file, and you have now added some additional names to that file. To display those names, you can simply reload the HTA, which, among other things, will cause it to re-read the text file.""" & vbCrLf & _
  399.     "    End If" & vbCrLf & _
  400.     vbCrLf & _
  401.     "    If D1.Value = ""Save data"" Then" & vbCrLf & _
  402.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  403.     "        Copy_HTML_Button.Disabled = True" & vbCrLf & _
  404.     "        strScript = ""<span id=DataArea><B>Span</B>. The contents of this span (DataArea) will be saved as a .htm file.</span>""" & vbCrLf & _
  405.     "        strSub = ""'Data in the span DataArea is saved to a .htm file"" & vbcrlf & vbcrlf" & vbCrLf & _
  406.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  407.     "        strSub = strSub & ""    Set objFSO = CreateObject("" & chr(34) & ""Scripting.FileSystemObject"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  408.     "        strSub = strSub & ""    objFSO.CreateTextFile("" & chr(34) & ""test.htm"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  409.     "        strSub = strSub & ""    Set objFile = objFSO.OpenTextFile("" & chr(34) & ""test.htm"" & chr(34) & "", 2)"" & vbcrlf" & vbCrLf & _
  410.     "        strSub = strSub & ""    objFile.WriteLine DataArea.InnerHTML"" & vbcrlf" & vbCrLf & _
  411.     "        strSub = strSub & ""    objFile.Close"" & vbcrlf" & vbCrLf & _
  412.     "        strSub = strSub & ""End Sub""         " & vbCrLf & _
  413.     "        strExample = strScript & ""<br>&nbsp;<br><input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  414.     "        strDescription = ""Sample script that saves the information (including all HTML formatting) found in a span named DataArea. In this example, the FileSystemObject is used to create a new file named test.htm, and then the data is saved to that file.""" & vbCrLf & _
  415.     vbCrLf & _
  416.     "    End If" & vbCrLf & _
  417.     vbCrLf & _
  418.     "    If D1.Value = ""Span"" Then" & vbCrLf & _
  419.     "        strScript = ""<span id=DataArea>This is a span named DataArea.</span>""" & vbCrLf & _
  420.     "        strSub = ""'Sets the InnerHTML for the span named DataArea"" & vbcrlf & vbcrlf  " & vbCrLf & _
  421.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  422.     "        strSub = strSub & ""    DataArea.InnerHTML = "" & chr(34) & ""<B>The computer did not respond when pinged.</B>"" & chr(34) & vbcrlf" & vbCrLf & _
  423.     "        strSub = strSub & ""End Sub""        " & vbCrLf & _
  424.     "        strExample = strScript & ""<br>&nbsp;<br><input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  425.     "        strDescription = ""The Span tag allows you to name a portion of your document, and then use scripts to programmatically modify that part of the document. A typical use of a span is to: <br>&nbsp;<br>1) Run a script (such as a WMI script) that collects information about something. <br>&nbsp;<br>2) Store the output of the script, along with any HTML formatting you wish to add, to a variable. <br>&nbsp;<br>3) Set the InnerHTML property of the span to that variable (e.g., DataArea.InnerHTML = strHTML). <br>&nbsp;<br>The simple example shown here sets the InnerHTML to a boldfaced sentence, combining the boldface tag with regular text.""" & vbCrLf & _
  426.     "    End If" & vbCrLf & _
  427.     vbCrLf & _
  428.     "    If D1.Value = ""Timer"" Then" & vbCrLf & _
  429.     "        strScript = """"" & vbCrLf & _
  430.     "        Show_Example_Button.Disabled = True" & vbCrLf & _
  431.     "        Copy_HTML_Button.Disabled = True" & vbCrLf & _
  432.     "        Reset_Button.Disabled = True       " & vbCrLf & _
  433.     "        strSub = ""'Causes the script RunScript to run every 5 seconds (5000 milliseconds)"" & vbcrlf & vbcrlf" & vbCrLf & _
  434.     "        strSub = strSub & ""Sub Window_OnLoad"" & vbcrlf" & vbCrLf & _
  435.     "        strSub = strSub & ""    iTimerID = window.setInterval("" & chr(34) & ""RunScript"" & chr(34) & "", 5000, "" & chr(34) & ""VBScript"" & chr(34) & "")"" & vbcrlf" & vbCrLf & _
  436.     "        strSub = strSub & ""End Sub""        " & vbCrLf & _
  437.     "        strExample = strScript" & vbCrLf & _
  438.     "        strDescription = ""Sample code that causes the script named RunScript to run every 5 seconds (5000 milliseconds). If you place any created timers in the Windows_OnLoad subroutine, those timers will automatically start when your HTA loads. As a result, any scripts they reference will automatically run at the specified intervals.""" & vbCrLf & _
  439.     "    End If" & vbCrLf & _
  440.     vbCrLf & _
  441.     "    If D1.Value = ""Table (2 Column)"" Then" & vbCrLf & _
  442.     "        Reset_Button.Disabled = True" & vbCrLf & _
  443.     "        Copy_Code_Button.Disabled = True" & vbCrLf & _
  444.     "        strScript = ""<table width="" & chr(34) & ""100%"" & chr(34) & "" border>"" & vbcrlf" & vbCrLf & _
  445.     "        strScript = strScript & ""  <tr>"" & vbcrlf" & vbCrLf & _
  446.     "        strScript = strScript & ""    <td width="" & chr(34) & ""50%"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">Row 1, Column 1</td>"" & vbcrlf" & vbCrLf & _
  447.     "        strScript = strScript & ""    <td width="" & chr(34) & ""50%"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">Row 1, Column 2</td>"" & vbcrlf" & vbCrLf & _
  448.     "        strScript = strScript & ""  </tr>"" & vbcrlf" & vbCrLf & _
  449.     "        strScript = strScript & ""</table>"" & vbcrlf" & vbCrLf & _
  450.     "        strExample = strScript" & vbCrLf & _
  451.     "        strDescription = ""Tables provide an easy way to create nicely-aligned, nicely-formatted output. This sample code creates a basic two-column table, with the two columns the same size. To create a table with different-sized columns, adjust the cell (td) widths accordingly. <br>&nbsp;<br>For tables (table), table rows (tr), and table cells (td), you can change the horizontal alignment (align), the vertical alignment (valign), the background color (bgcolor), the border color (bordercolor) and many other properties.""" & vbCrLf & _
  452.     "    End If" & vbCrLf & _
  453.     vbCrLf & _
  454.     "    If D1.Value = ""Table (3 Column)"" Then'" & vbCrLf & _
  455.     "        Reset_Button.Disabled = True" & vbCrLf & _
  456.     "        Copy_Code_Button.Disabled = True" & vbCrLf & _
  457.     "        strScript = ""<table width="" & chr(34) & ""100%"" & chr(34) & "" border>"" & vbcrlf" & vbCrLf & _
  458.     "        strScript = strScript & ""  <tr>"" & vbcrlf" & vbCrLf & _
  459.     "        strScript = strScript & ""    <td width="" & chr(34) & ""33%"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "" border= "" & chr(34) & ""black"" & chr(34) & "">Row 1, Column 1</td>"" & vbcrlf" & vbCrLf & _
  460.     "        strScript = strScript & ""    <td width="" & chr(34) & ""33%"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">Row 1, Column 2</td>"" & vbcrlf" & vbCrLf & _
  461.     "        strScript = strScript & ""    <td width="" & chr(34) & ""33%"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">Row 1, Column 3</td>"" & vbcrlf" & vbCrLf & _
  462.     "        strScript = strScript & ""  </tr>"" & vbcrlf" & vbCrLf & _
  463.     "        strScript = strScript & ""</table>"" & vbcrlf" & vbCrLf & _
  464.     "        strExample = strScript" & vbCrLf & _
  465.     "        strDescription = ""Tables provide an easy way to create nicely-aligned, nicely-formatted output. This sample code creates a basic three-column table, with each column the same size. To create a table with different-sized columns, adjust the cell (td) widths accordingly. <br>&nbsp;<br>For tables (table), table rows (tr), and table cells (td), you can change the horizontal alignment (align), the vertical alignment (valign), the background color (bgcolor), the border color (bordercolor) and many other properties.""" & vbCrLf & _
  466.     "    End If" & vbCrLf & _
  467.     vbCrLf & _
  468.     "    If D1.value = ""Table (4 Column)"" Then" & vbCrLf & _
  469.     "        Reset_Button.Disabled = True" & vbCrLf & _
  470.     "        Copy_Code_Button.Disabled = True" & vbCrLf & _
  471.     "        strScript = ""<table width="" & chr(34) & ""100%"" & chr(34) & "" border>"" & vbcrlf" & vbCrLf & _
  472.     "        strScript = strScript & ""  <tr>"" & vbcrlf" & vbCrLf & _
  473.     "        strScript = strScript & ""    <td width="" & chr(34) & ""25%"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">Row 1, Column 1</td>"" & vbcrlf" & vbCrLf & _
  474.     "        strScript = strScript & ""    <td width="" & chr(34) & ""25%"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">Row 1, Column 2</td>"" & vbcrlf" & vbCrLf & _
  475.     "        strScript = strScript & ""    <td width="" & chr(34) & ""25%"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">Row 1, Column 3</td>"" & vbcrlf" & vbCrLf & _
  476.     "        strScript = strScript & ""    <td width="" & chr(34) & ""25%"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">Row 1, Column 4</td>"" & vbcrlf" & vbCrLf & _
  477.     "        strScript = strScript & ""  </tr>"" & vbcrlf" & vbCrLf & _
  478.     "        strScript = strScript & ""</table>"" & vbcrlf" & vbCrLf & _
  479.     "        strExample = strScript" & vbCrLf & _
  480.     "        strDescription = ""Tables provide an easy way to create nicely-aligned, nicely-formatted output. This sample code creates a basic four-column table, with each column the same size. To create a table with different-sized columns, adjust the cell (td) widths accordingly. <br>&nbsp;<br>For tables (table), table rows (tr), and table cells (td), you can change the horizontal alignment (align), the vertical alignment (valign), the background color (bgcolor), the border color (bordercolor) and many other properties.""" & vbCrLf & _
  481.     "    End If" & vbCrLf & _
  482.     vbCrLf & _
  483.     "    If D1.Value = ""Table (Formatted Rows)"" Then" & vbCrLf & _
  484.     "        Reset_Button.Disabled = True" & vbCrLf & _
  485.     "        Copy_Code_Button.Disabled = True" & vbCrLf & _
  486.     "        strScript = ""<table width="" & chr(34) & ""100%"" & chr(34) & "">"" & vbcrlf" & vbCrLf & _
  487.     "        strScript = strScript & ""<tr bgcolor="" & chr(34) & ""white"" & chr(34) & "" align="" & chr(34) & ""center"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">""  & vbcrlf" & vbCrLf & _
  488.     "        strScript = strScript & ""    <td>Row 1, Column 1</td>"" & vbcrlf" & vbCrLf & _
  489.     "        strScript = strScript & ""    <td>Row 1, Column 2</td>"" & vbcrlf" & vbCrLf & _
  490.     "        strScript = strScript & ""  </tr>"" & vbcrlf" & vbCrLf & _
  491.     "        strScript = strScript & ""  <tr bgcolor="" & chr(34) & ""yellow"" & chr(34) & "" align="" & chr(34) & ""right"" & chr(34) & "" valign="" & chr(34) & ""top"" & chr(34) & "">"" & vbcrlf" & vbCrLf & _
  492.     "        strScript = strScript & ""    <td>Row 1, Column 1</td>"" & vbcrlf" & vbCrLf & _
  493.     "        strScript = strScript & ""    <td>Row 1, Column 2</td>"" & vbcrlf" & vbCrLf & _
  494.     "        strScript = strScript & ""  </tr>"" & vbcrlf" & vbCrLf & _
  495.     "        strScript = strScript & ""</table>""    " & vbCrLf & _
  496.     "        strExample = strScript" & vbCrLf & _
  497.     "        strDescription = ""Tables provide an easy way to create nicely-aligned, nicely-formatted output. This sample code creates a basic two-column, two-row table, with the two columns the same size, but with different alignments and background colors. To create a table with different-sized columns, adjust the cell (td) widths accordingly. <br>&nbsp;<br>For tables (table), table rows (tr), and table cells (td), you can change the horizontal alignment (align), the vertical alignment (valign), the background color (bgcolor), the border color (bordercolor) and many other properties. For example, add <b>rules = all </b> to the table tag and notice the difference.""" & vbCrLf & _
  498.     "    End If" & vbCrLf & _
  499.     vbCrLf & _
  500.     "    If D1.Value = ""Text Area"" Then" & vbCrLf & _
  501.     "        strScript = ""<textarea name="" & chr(34) & ""BasicTextArea"" & chr(34) & "" rows="" & chr(34) & ""5"" & chr(34) & "" cols="" & chr(34) & ""75"" & chr(34) & ""></textarea>""" & vbCrLf & _
  502.     "        strSub = ""'Places text in the text area named BasicTextArea"" & vbcrlf & vbcrlf  " & vbCrLf & _
  503.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  504.     "        strSub = strSub & ""    BasicTextArea.Value = "" & chr(34) & ""This information will be placed in the multi-line text box named BasicTextArea."" & chr(34) & vbcrlf" & vbCrLf & _
  505.     "        strSub = strSub & ""End Sub"" " & vbCrLf & _
  506.     "        strExample = strScript & ""&nbsp;&nbsp;&nbsp;<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  507.     "        strDescription = ""Textareas are simply multi-line text boxes; as a result, you can place a large amount of text information in a single text box. When configuring a textarea, you can specify the number of rows displayed on screen as well as the number of columns (one pixel per column). If the data being added exceeds the on-screen size of the textarea, scroll bars will automatically appear, allowing you to scroll up and down and view all the information.<br>&nbsp;<br>The sample script shows how you can programmatically add information to a textarea. You can also retrieve information from a textarea by retrieving the <b>Value</b>.""" & vbCrLf & _
  508.     "    End If" & vbCrLf & _
  509.     vbCrLf & _
  510.     "    If D1.Value = ""Text Box"" Then" & vbCrLf & _
  511.     "        strScript = ""<input type="" & chr(34) & ""text"" & chr(34) & "" name="" & chr(34) & ""BasicTextBox"" & chr(34) & "" size="" & chr(34) & ""50"" & chr(34) & "">""" & vbCrLf & _
  512.     "        strSub = ""'Displays the contents of the text box BasicTextBox"" & vbcrlf & vbcrlf  " & vbCrLf & _
  513.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  514.     "        strSub = strSub & ""    Msgbox BasicTextBox.Value"" & vbcrlf" & vbCrLf & _
  515.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  516.     "        strExample = strScript & ""&nbsp;&nbsp;&nbsp;<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "">""" & vbCrLf & _
  517.     "        strDescription = ""Typically used to provide a way for users to enter information; users can type information (such as a user name) in the text box, and then you can programtically retrieve that information by checking the <b>Value</b> of the text box. A text box can be no bigger than a single line; to create larger text boxes, use the <b>Textarea</b> tag. To set a default for the text box, specify the Value as part of the input tag. To configure the size of the text box, set the <b>Width</b> as part of the input tag.<br>&nbsp;<br>The sample code simply echoes the information currently in the text box.""" & vbCrLf & _
  518.     "    End If" & vbCrLf & _
  519.     vbCrLf & _
  520.     "    If D1.Value=""ToolTip"" Then" & vbCrLf & _
  521.     "        strScript = ""<input id=runbutton  class="" & chr(34) & ""button"" & chr(34) & "" type="" & chr(34) & ""button"" & chr(34) & "" value="" & chr(34) & ""Run Button"" & chr(34) & "" name="" & chr(34) & ""run_button"" & chr(34) & ""  onClick="" & chr(34) & ""RunScript"" & chr(34) & "" title="" & chr(34) & ""Click here to change the tooltip."" & chr(34) & "">""" & vbCrLf & _
  522.     "        strSub = ""'Changes the tooltip for the button named run_button"" & vbcrlf & vbcrlf  " & vbCrLf & _
  523.     "        strSub = strSub & ""Sub RunScript"" & vbcrlf" & vbCrLf & _
  524.     "        strSub = strSub & ""    Run_Button.Title = "" & chr(34) & ""You successfully changed the tooltip."" & chr(34) & vbcrlf" & vbCrLf & _
  525.     "        strSub = strSub & ""End Sub""" & vbCrLf & _
  526.     "        strExample = strScript " & vbCrLf & _
  527.     "        strDescription = ""Tooltips are little bits of explanatory information that appear whenever you hold the mouse above a control. Tooltips can be configured for most HTML elements simply by setting the <b>Title</b> property.<br>&nbsp;<br>In the example shown here, hold the mouse over the Run Button to see the current tooltip. Then, click the Run Button, and hold the mouse over it again; you should see that the tooltip has changed to the Title specified in the script code.""" & vbCrLf & _
  528.     "    End If" & vbCrLf & _
  529.     vbCrLf & _
  530.     "    ConfigureArea.Value = strScript" & vbCrLf & _
  531.     "    SubroutineArea.Value = strSub" & vbCrLf & _
  532.     "    SampleArea.InnerHTML = strExample" & vbCrLf & _
  533.     "    Description.InnerHTML = strDescription" & vbCrLf & _
  534.     "    ExampleScript.Text = SubroutineArea.Value" & vbCrLf & _
  535.     "    " & vbCrLf & _
  536.     "End Sub" & vbCrLf & _
  537.     vbCrLf & _
  538.     "Sub ShowExample" & vbCrLf & _
  539.     "    On Error Resume Next" & vbCrLf & _
  540.     "    strScript = """"" & vbCrLf & _
  541.     "    x = 0" & vbCrLf & _
  542.     "    If D1.Value=""Checkbox"" Then " & vbCrLf & _
  543.     "        x = 1" & vbCrLf & _
  544.     "    End If" & vbCrLf & _
  545.     "    If D1.Value = ""Disabled control"" Then" & vbCrLf & _
  546.     "        x = 1" & vbCrLf & _
  547.     "    End If" & vbCrLf & _
  548.     "    If D1.Value = ""Multi-select Listbox"" Then" & vbCrLf & _
  549.     "        x = 1" & vbCrLf & _
  550.     "    End If" & vbCrLf & _
  551.     "    If D1.Value=""Password box"" Then" & vbCrLf & _
  552.     "        x = 1" & vbCrLf & _
  553.     "    End If" & vbCrLf & _
  554.     "    If D1.Value=""Radio button"" Then" & vbCrLf & _
  555.     "        x = 1" & vbCrLf & _
  556.     "    End If" & vbCrLf & _
  557.     "    If D1.Value = ""Span"" Then" & vbCrLf & _
  558.     "        x = 1" & vbCrLf & _
  559.     "    End If" & vbCrLf & _
  560.     "    If D1.Value = ""Text Area"" Then" & vbCrLf & _
  561.     "        x = 1" & vbCrLf & _
  562.     "    End If" & vbCrLf & _
  563.     "    If D1.Value = ""Text Box"" Then" & vbCrLf & _
  564.     "        x = 1" & vbCrLf & _
  565.     "    End If" & vbCrLf & _
  566.     "    If x = 1 Then" & vbCrLf & _
  567.     "        strScript = ""<input id=runbutton  class='button' type='button' value='Run Button' name='run_button'  onClick='RunScript'>""" & vbCrLf & _
  568.     "    End If" & vbCrLf & _
  569.     "    strScript = ConfigureArea.Value & ""&nbsp;&nbsp;&nbsp;"" & strScript" & vbCrLf & _
  570.     "    SampleArea.InnerHTML = strScript" & vbCrLf & _
  571.     "End Sub" & vbCrLf & _
  572.     vbCrLf & _
  573.     vbCrLf & _
  574.     "Sub ResetCode" & vbCrLf & _
  575.     "    On Error Resume Next" & vbCrLf & _
  576.     "    ExampleScript.Text = SubroutineArea.Value" & vbCrLf & _
  577.     "End Sub" & vbCrLf & _
  578.     vbCrLf & _
  579.     "</SCRIPT>" & vbCrLf & _
  580.     vbCrLf & _
  581.     vbCrLf & _
  582.     "<SCRIPT Language=""VBScript"" id=""ExampleScript"">" & vbCrLf & _
  583.     "    Sub ExampleSub" & vbCrLf & _
  584.     "    End Sub" & vbCrLf & _
  585.     "</SCRIPT>" & vbCrLf & _
  586.     vbCrLf & _
  587.     vbCrLf & _
  588.     "<body>" & vbCrLf & _
  589.     "&nbsp;<BR>" & vbCrLf & _
  590.     "<table width=""100%"">" & vbCrLf & _
  591.     "    <tr>" & vbCrLf & _
  592.     "        <td width = ""23%"" valign=""top""><b>HTA Elements</b><BR><span id=""PartsList"">" & vbCrLf & _
  593.     "        <select size=""12"" name=""D1"" onChange=""GenerateCode"">" & vbCrLf & _
  594.     "        <option value=""Autorun Script"">Autorun script</option> " & vbCrLf & _
  595.     "        <option value=""Basic HTML tags"">Basic HTML tags</option> " & vbCrLf & _
  596.     "        <option value=""Button"">Button</option>" & vbCrLf & _
  597.     "        <option value=""Change cursor"">Change cursor</option>" & vbCrLf & _
  598.     "        <option value=""Checkbox"">Checkbox</option>" & vbCrLf & _
  599.     "        <option value=""Copy to Clipboard"">Copy to Clipboard</option>" & vbCrLf & _
  600.     "        <option value=""Create basic HTA"">Create basic HTA</option>" & vbCrLf & _
  601.     "        <option value=""Disabled control"">Disabled control</option>" & vbCrLf & _
  602.     "        <option value=""Display a confirmation box"">Display a confirmation box</option>" & vbCrLf & _
  603.     "        <option value=""Data display in new window"">Display data in a new window</option>" & vbCrLf & _
  604.     "        <option value=""Display the print dialog box"">Display the Print dialog box</option>" & vbCrLf & _
  605.     "        <option value=""Drop-down Listbox"">Drop-down listbox</option>" & vbCrLf & _
  606.     "        <option value=""Font Formatting"">Font formatting</option>" & vbCrLf & _
  607.     "        <option value=""Hyperlink"">Hyperlink</option>" & vbCrLf & _
  608.     "        <option value=""Listbox"">Listbox</option>" & vbCrLf & _
  609.     "        <option value=""Multi-select List Box"">Multi-select listbox</option>" & vbCrLf & _
  610.     "        <option value=""On-the-fly listbox"">On-the-fly listbox</option>" & vbCrLf & _
  611.     "        <option value=""Password box"">Password box</option>" & vbCrLf & _
  612.     "        <option value=""Paste from Clipboard"">Paste from Clipboard</option>" & vbCrLf & _
  613.     "        <option value=""Prompt the user for input"">Prompt the user for input</option>" & vbCrLf & _
  614.     "        <option value=""Radio button"">Radio button</option>" & vbCrLf & _
  615.     "        <option value=""Refresh the HTA"">Refresh the HTA</option>" & vbCrLf & _
  616.     "        <option value=""Save data"">Save data to a .htm file</option>" & vbCrLf & _
  617.     "        <option value=""Span"">Span</option>" & vbCrLf & _
  618.     "        <option value=""Table (2 Column)"">Table (2-column)</option>" & vbCrLf & _
  619.     "        <option value=""Table (3 Column)"">Table (3-column)</option>" & vbCrLf & _
  620.     "        <option value=""Table (4 Column)"">Table (4-column)</option>" & vbCrLf & _
  621.     "        <option value=""Table (Formatted Rows)"">Table (formatted rows)</option>" & vbCrLf & _
  622.     "        <option value=""Text Area"">Textarea</option>" & vbCrLf & _
  623.     "        <option value=""Text Box"">Text box</option>" & vbCrLf & _
  624.     "        <option value=""Timer"">Timer</option>" & vbCrLf & _
  625.     "        <option value=""ToolTip"">ToolTip</option>" & vbCrLf & _
  626.     "        </select></span><P><span id=""Description"">The HTA Helpomatic is designed to help you write Hypertext Applications (HTAs). To use the Helpomatic, select an item from the list labeled HTA Elements. When you do so, code for including the element in an HTA will appear in the box labeled HTML Code and/or in the box labeled Subroutine Code. Depending on the option selected, a sample element will also appear in the portion of the screen labeled Sample.<br>&nbsp;<br>If you wish, you can modify the code in the HTML Code box, then click the Reset Example button to see the results of those modifications. When satisfied, click Copy to Clipboard to copy the relevant code.<br>&nbsp;<br>You can also modify the script code, and configure the sample to use that code by clicking the Reset Example button found in the area labeled Subroutine Code.<br>&nbsp;<br><b>Note</b>: There is little error-checking in the HTA Helpomatic. If you enter improper HTML or script code, you might get an error message asking if you want to continue to run scripts on this page. If that occurs, click <b>Yes</b> and then continue.<BR>" & vbCrLf & _
  627.     "</span>" & vbCrLf & _
  628.     "        </td>" & vbCrLf & _
  629.     "        <td width = ""10%"" valign=""top"">&nbsp;</td>" & vbCrLf & _
  630.     "        <td width = ""67%"" valign=""top""><b>HTML Code</b><BR><textarea rows=""12"" name=""ConfigureArea"" cols=""115""></textarea><P align=""right"">" & vbCrLf & _
  631.     "        <input id=runbutton  class=""button"" type=""button"" value=""Reset Example"" name=""show_example_button""  onClick=""ShowExample"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & vbCrLf & _
  632.     "        <input id=runbutton  class=""button"" type=""button"" value=""Copy to Clipboard"" name=""copy_html_button""  onClick=""TestSub""></P>" & vbCrLf & _
  633.     "        <P>" & vbCrLf & _
  634.     "        <b>Subroutine Code</b><BR><textarea rows=""12"" name=""SubroutineArea"" cols=""115""></textarea><P align=""right"">" & vbCrLf & _
  635.     "        <input id=runbutton  class=""button"" type=""button"" value=""Reset Example"" name=""reset_button""  onClick=""ResetCode"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & vbCrLf & _
  636.     "        <input id=runbutton  class=""button"" type=""button"" value=""Copy to Clipboard"" name=""copy_code_button""  onClick=""CopyCode""></P></td>" & vbCrLf & _
  637.     "    </tr>" & vbCrLf & _
  638.     "</table><br>&nbsp;<br>" & vbCrLf & _
  639.     "<hr>" & vbCrLf & _
  640.     "<b>Sample</b><P>" & vbCrLf & _
  641.     "<span id=""SampleArea""></span>" & vbCrLf & _
  642.     vbCrLf & _
  643.     "</body>"
  644. End With
  645.  
  646. Function CreateWindow()
  647.     Rem source http://forum.script-coding.com/viewtopic.php?pid=75356#p75356
  648.     Dim sSignature, oShellWnd, oProc
  649.     On Error Resume Next
  650.     sSignature = Left(CreateObject("Scriptlet.TypeLib").Guid, 38)
  651.     Do
  652.         Set oProc = CreateObject("WScript.Shell").Exec("mshta about:""<HTA:APPLICATION ID=objHTAHelpomatic APPLICATIONNAME=HTAHelpomatic SCROLL=no SINGLEINSTANCE=yes WINDOWSTATE=maximize><object id='shellwindow' classid='clsid:8856F961-340A-11D0-A96B-00C04FD705A2'><param name=RegisterAsBrowser value=1></object><script>shellwindow.putproperty('" & sSignature & "',document.parentWindow);</script>""")
  653.         Do
  654.             If oProc.Status > 0 Then Exit Do
  655.             For Each oShellWnd In CreateObject("Shell.Application").Windows
  656.                 Set CreateWindow = oShellWnd.GetProperty(sSignature)
  657.                 If Err.Number = 0 Then Exit Function
  658.                 Err.Clear
  659.             Next
  660.         Loop
  661.     Loop
  662. End Function
Add Comment
Please, Sign In to add comment