Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for birdname.hta

(view source code of birdname.hta as plain text)

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title>BirdName</title>
  5.  
  6. <HTA:APPLICATION
  7.   APPLICATIONNAME="BirdName"
  8.   ID="BirdName"
  9.   VERSION="2.12"
  10.   SCROLL="auto"
  11.   SINGLEINSTANCE="yes"/>
  12.  
  13. <style type="text/css">
  1. .Center
  2. {
  3. 	text-align: center;
  4. 	margin-left: auto;
  5. 	margin-right: auto;
  6. }
  7.  
  8. .Group
  9. {
  10. 	border: 1px solid gray;
  11. 	padding: 12px 25px 12px 25px;
  12. }
  13.  
  14. .Hidden
  15. {
  16. 	visibility: hidden;
  17. }
  18.  
  19. a
  20. {
  21. 	color: yellow;
  22. }
  23.  
  24. body
  25. {
  26. 	font: 12pt arial,sans-serif;
  27. 	color:white;
  28. 	background-color: #606060;
  29. 	filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#000000', EndColorStr='#606060');
  30. 	height: 100%;
  31. 	padding: 15px;
  32. 	margin: 0;
  33. }
  34.  
  35. input.Button, span.Button
  36. {
  37. 	width: 12em;
  38. 	height: 2em;
  39. }
  40.  
  41. table
  42. {
  43. 	border: 0 none;
  44. 	width: 90%;
  45. }
  46.  
  47. td.Content
  48. {
  49. 	width: 35%;
  50. }
  51.  
  52. td.Control
  53. {
  54. 	width: 20%;
  55. 	text-align: right;
  56. }
  57.  
  58. td.Spacer
  59. {
  60. 	width: 5%;
  61. }
  1. </style>
  2.  
  3. </head>
  4.  
  5.  
  6. <script language="VBScript">
  1. Option Explicit
  2.  
  3. On Error Goto 0
  4.  
  5. Const ForAppending = 8
  6. Const ForReading   = 1
  7. Const ForWriting   = 2
  8.  
  9. Const TristateFalse      =  0
  10. Const TristateMixed      = -2
  11. Const TristateTrue       = -1
  12. Const TristateUseDefault = -2
  13.  
  14. Dim arrLang( )
  15. Dim blnUseLocalLanguageNames
  16. Dim objCaptions, objIE, objSettings
  17. Dim strAlternativeScientificName
  18.  
  19. Set objCaptions = CreateObject( "Scripting.Dictionary" )
  20. Set objSettings = CreateObject( "Scripting.Dictionary" )
  21. Set objIE       = CreateObject( "InternetExplorer.Application" )
  22.  
  23.  
  24. ' Capitalize
  25. Function Cap( myString )
  26. 	Dim strString
  27. 	strString = Replace( myString, "  ", " " )
  28. 	strString = LCase( Trim( strString ) )
  29. 	Cap = UCase( Left( strString, 1 ) ) & Mid( strString, 2 )
  30. End Function
  31.  
  32.  
  33. Sub CheckUpdate( )
  34. 	Dim intAnswer, intButtons, lenLatestVer, strCurrentVer, strLatestver, strPrompt, strTitle, wshShell
  35.  
  36. 	'On Error Resume Next
  37.  
  38. 	' Change mouse pointer to hourglass while checking for update
  39. 	Document.Body.Style.Cursor = "wait"
  40.  
  41. 	Set wshShell = CreateObject( "WScript.Shell" )
  42.  
  43. 	strCurrentVer = BirdName.Version
  44. 	' Read the latest version info from the web
  45. 	strLatestVer  = WGet( "http://www.robvanderwoude.com/updates/birdname.txt" )
  46.  
  47. 	' Retry once, after clearing the IE cache, if the versions don't match
  48. 	If strCurrentVer <> strLatestver Then
  49. 		' Clear the IE cache
  50. 		wshShell.Run "RUNDll32.EXE InetCpl.cpl,ClearMyTracksByProcess 8", 7, True
  51. 		' Try again, read the latest version info from the web
  52. 		strLatestver = WGet( "http://www.robvanderwoude.com/updates/birdname.txt" )
  53. 	End If
  54.  
  55. 	lenLatestVer  = Len( strLatestVer )
  56. 	If lenLatestVer = 4 Then
  57. 		If objSettings.Item( "AutoUpdate" ) = 1 Then
  58. 			Update
  59. 		Else
  60. 			intButtons = vbYesNoCancel + vbApplicationModal + vbInformation
  61. 			If strLatestVer < strCurrentVer Then
  62. 				strTitle  = "Unofficial version"
  63. 				strPrompt = "You seem to be using a pre-release version (" & strCurrentVer & ") of BirdName.hta." _
  64. 				          & vbCrLf & vbCrLf _
  65. 				          & "The latest official release is " & strLatestver _
  66. 				          & vbCrLf & vbCrLf _
  67. 				          & "Do you want to download the latest official version?"
  68. 				intAnswer = MsgBox( strPrompt, intButtons + vbDefaultButton2, strTitle )
  69. 				If intAnswer = vbYes Then
  70. 					wshShell.Run "http://www.robvanderwoude.com/birdname.php", 3, False
  71. 				End If
  72. 			End If
  73. 			If strLatestVer > strCurrentVer Then
  74. 				strTitle  = "Old version"
  75. 				strPrompt = "You are using version " & strCurrentVer & " of BirdName.hta." _
  76. 				          & vbCrLf & vbCrLf _
  77. 				          & "The latest official release is " & strLatestver _
  78. 				          & vbCrLf & vbCrLf _
  79. 				          & "Do you want to download the latest official version?"
  80. 				intAnswer = MsgBox( strPrompt, intButtons, strTitle )
  81. 				If intAnswer = vbYes Then
  82. 					wshShell.Run "http://www.robvanderwoude.com/birdname.php", 3, False
  83. 				End If
  84. 			End If
  85. 		End If
  86. 	End If
  87.  
  88. 	Set wshShell = Nothing
  89.  
  90. 	' Change mouse pointer back to default
  91. 	Document.Body.Style.Cursor = "default"
  92.  
  93. 	On Error Goto 0
  94. End Sub
  95.  
  96.  
  97. Sub ClearTranslations( )
  98. 	Translation1.value = ""
  99. 	Translation2.value = ""
  100. 	Translation3.value = ""
  101. 	Translation4.value = ""
  102. 	Button_SearchTranslation1.disabled   = True
  103. 	Button_SearchTranslation2.disabled   = True
  104. 	Button_SearchTranslation3.disabled   = True
  105. 	Button_SearchTranslation4.disabled   = True
  106. End Sub
  107.  
  108.  
  109. Function GetLanguageList( )
  110. 	Dim i
  111. 	Dim objHTTP, objMatch, objMatches, objNewOption, objRE
  112. 	Dim strHTML, strMsg, strResp, strURL
  113.  
  114. 	GetLanguageList = False
  115.  
  116. 	' Read and save the entire URL including HTML tags in a variable named strHTML
  117. 	Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
  118. 	strURL = "http://meta.wikimedia.org/wiki/List_of_Wikipedias"
  119. 	objHTTP.Open "GET", strURL
  120. 	objHTTP.Send
  121. 	If objHTTP.Status = 200 Then
  122. 		strHTML = objHTTP.ResponseText
  123. 		GetLanguageList = True
  124. 	Else
  125. 		MsgBox "Unable to contact Wikipedia for a list of available languages." _
  126. 		     & vbCrLf & vbCrLf _
  127. 		     & "Error code: " & objHTTP.Status _
  128. 		     & vbCrLf & vbCrLf _
  129. 		     & "Correct the problem and try again.", vbOKOnly, "Connection Error"
  130. 	End If
  131. 	Set objHTTP = Nothing
  132.  
  133. 	' Parse the languages tables and save the results in a 2-dimensional array named arrLang;
  134. 	' arrLang(0) is the language code
  135. 	' arrLang(1) is the local language name
  136. 	' arrLang(2) is the English language name
  137. 	Set objRE = New RegExp
  138. 	objRE.Global = True
  139. 	objRE.IgnoreCase = True
  140. 	objRE.Pattern = "<tr>[^<]*<td>[0-9,]+</td>[^<]*<td><a [^>]+>([^<]+)</a></td>[^<]*<td[^>]*><a [^>]+>([^<]+)</a></td>[^<]*<td><a [^>]+>([^<]+)</a></td>"
  141. 	Set objMatches = objRE.Execute( strHTML )
  142. 	For Each objMatch In objMatches
  143. 		If objMatch.Submatches.Count > 2 Then
  144. 			ReDim Preserve arrLang( 2, i )
  145. 			arrLang( 0, i ) = objMatch.Submatches.Item(2)
  146. 			arrLang( 1, i ) = objMatch.Submatches.Item(1)
  147. 			arrLang( 2, i ) = objMatch.Submatches.Item(0)
  148. 			i = i + 1
  149. 		End If
  150. 	Next
  151. 	Set objRE = Nothing
  152. End Function
  153.  
  154.  
  155. ' Read scientific name from WikiPedia page
  156. Sub GetScientificName( )
  157. 	Dim objMatches, objOption, objRE
  158. 	Dim strSpeciesName, strHTML, strLangCode, strURL
  159. 	Dim strDEBUG
  160.  
  161. 	ScientificName.value = ""
  162. 	strAlternativeScientificName = ""
  163. 	strSpeciesName = Cap( SpeciesInput.value )
  164. 	SpeciesInput.value = strSpeciesName
  165. 	For Each objOption In SelectSourceLanguage.Options
  166. 		If objOption.Selected Then
  167. 			strLangCode = objOption.value
  168. 		End If
  169. 	Next
  170. 	strURL = "http://" & strLangCode & ".wikipedia.org/wiki/" & Und( strSpeciesName )
  171. 	strHTML = WGet( strURL )
  172. 	If Left( LCase( strHTML ), 2 ) = "--" Then
  173. 		ScientificName.value = strHTML
  174. 		ScientificName.style.color = "red"
  175. 		Exit Sub
  176. 	Else
  177. 		ScientificName.style.color = "black"
  178. 	End If
  179. 	Set objRE = New RegExp
  180. 	objRE.Global = True
  181. 	objRE.IgnoreCase = True
  182. 	' First, test if the URL is for the selected animal class
  183. 	objRE.Pattern = Replace( SelectClass.value, "ph", "(ph|f)" )
  184. 	If objRE.Test( strHTML ) Or SelectClass.value = "All" Then
  185. 		' Next, find the bird name, followed by 1 or 2 scientific names in parenthesis
  186. 		objRE.Pattern = "<b>" & strSpeciesName & "</b> (<[bi]>)*\((<[bi]>)*([^<\n\r]+)(</[bi]>)*(<sup[^>]*>.*?</sup>)?([^<\)]*(<[bi]>)*([^<\)]+)(</[bi]>)*(<sup[^>]*>.*?</sup>)?)?\)(</[bi]>)*"
  187. 		Set objMatches = objRE.Execute( strHTML )
  188. 		If objMatches.Count > 0 Then
  189. 			If objMatches.Item(0).Submatches.Count > 10 Then
  190. 				' The displayed scientific name is the first match
  191. 				ScientificName.value = Cap( objMatches.Item(0).Submatches(2) )
  192. 				ScientificName.style.color = "black"
  193. 				' The optional second match is kept as a "spare" in case a translation will not be found
  194. 				strAlternativeScientificName = Cap( objMatches.Item(0).Submatches(9) )
  195. 			End If
  196. 		End If
  197. 	Else
  198. 		ScientificName.value = "--" & objcaptions.Item( "Not" & SelectClass.value ) & " " & objcaptions.Item( "OrAmbiguous" ) & "?--"
  199. 		ScientificName.style.color = "red"
  200. 		Button_SearchScientificName.disabled = False
  201. 		strAlternativeScientificName = ""
  202. 		ClearTranslations
  203. 	End If
  204. 	strDEBUG = strAlternativeScientificName
  205. 	Set objMatches = Nothing
  206. 	Set objRE = Nothing
  207. End Sub
  208.  
  209.  
  210. Sub HelpMsg( )
  211. 	Dim strHTML
  212. 	strHTML = "<h1>BirdName,  Version " & BirdName.Version & "</h1>\n\n" _
  213. 	        & "<p>This HTA uses <a href=""http://www.wikipedia.org/"">Wikipedia</a> to translate animal (chordata) species names from and to (m)any language(s).</p>\n\n" _
  214. 	        & "<p>You can use this program to translate a species name from one of the supported ""local"" languages to any of the other supported languages.<br>\n" _
  215. 	        & "Start by selecting a class in the dropdown list """ & objCaptions.Item( "Class" ) & ": <select size=""1"" style=""width: 10em;"">\n\t<option>" & objCaptions.Item( "All" ) & "</option>\n\t<option>" & objCaptions.Item( "ClassActinopterygii" ) & "</option>\n\t<option>" & objCaptions.Item( "ClassAmphibia" ) & "</option>\n\t<option selected=""selected"">" & objCaptions.Item( "ClassAves" ) & "</option>\n\t<option>" & objCaptions.Item( "ClassChondrichthyes" ) & "</option>\n\t<option>" & objCaptions.Item( "ClassMammalia" ) & "</option>\n\t<option>" & objCaptions.Item( "ClassReptilia" ) & "</option>\n</select>"".<br>\n" _
  216. 	        & "Next, type the species name in the <em>empty</em> field just below the class selection.<br>\n" _
  217. 	        & "The program will first search the scientific name on Wikipedia and then translate that scientific name to the language of choice.<br>\n" _
  218. 	        & "Alternatively, you can enter the scientific name yourself, and the program will translate it to the language(s) of choice.<br>\n" _
  219. 	        & "With the <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""" & objCaptions.Item( "Search" ) & """> buttons you can search Wikipedia interactively for the requested translations.</p>\n\n" _
  220. 	        & "<h2>Settings</h2>\n\n" _
  221. 	        & "<p>If <input type=""checkbox""> <code>" & objCaptions.Item( "UseLocalLanguageNames" ) & "</code> is checked, the list of available languages shows the local language names (e.g. ""Fran&ccedil;ais"", ""Cymraeg""), if not checked the English language names are listed instead (e.g. ""French"", ""Welsh"").</p>\n\n" _
  222. 	        & "<p><select size=""1"" style=""width: 3em;"">\n\t<option>1</option>\n\t<option selected>2</option>\n\t<option>3</option>\n\t<option>4</option>\n</select> <code>" & objCaptions.Item( "SimultaneousTranslations" ) & "</code> controls the number of translations shown; it ranges from 1 to 4.</p>\n\n" _
  223. 	        & "<p>To change settings permanently, click the <input type=""button"" class=""Button"" value=""" & objCaptions.Item( "Configure" ) & """ style=""width: 10em; height: 2em; vertical-align: middle""> button, next to the """ & objCaptions.Item( "Settings" ) & """ header, to open the configuration files in Notepad (see the chapter ""Customization"" for more details).</p>\n\n" _
  224. 	        & "<p>Click <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""" & objCaptions.Item( "HideSettings" ) & """> to move the """ & objCaptions.Item( "Settings" ) & """ block out of sight (it will reappear next time the program is started).</p>\n\n" _
  225. 	        & "<h2>Program Updates</h2>\n\n" _
  226. 	        & "<p>This program automatically checks for updates.<br>\n" _
  227. 	        & "If an update is available, a notification will pop up, asking you if you want to download the latest official release.<br>\n" _
  228. 	        & "If you click ""Yes"" the BirdName download page will be opened in your default browser.<br>\n" _
  229. 	        & "Unless you update the program, the notification will reappear next time the program is started.</p>\n\n" _
  230. 	        & "<p>If AutoUpdate is enabled, the program is updated ""on-the-fly"" without notification (see the chapter <a href=""#Customization"">Customization</a> for more details).</p>\n\n" _
  231. 	        & "<h2>Restrictions</h2>\n\n" _
  232. 	        & "<p>This program uses Wikipedia to find the requested translations.<br>\n" _
  233. 	        & "Thus it depends on:<br>\n\n" _
  234. 	        & "<ol>\n\t<li>the full name being entered, exactly as used on Wikipedia (e.g. ""Great Bittern"" instead of ""Bittern"")</li>\n\t<li>a page dedicated to the bird of choice in each language of choice</li>\n\t<li>redirection of the scientific name to the local name</li>\n\t<li>Wikipedia's page layout remaining more or less unchanged</li>\n</ol>\n\n" _
  235. 	        & "<p>It may be clear that these conditions may not always be met.<br>\n" _
  236. 	        & "If no translation was found because there is no dedicated page, use the <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""" & objCaptions.Item( "Search" ) & """> button next to the """ & objCaptions.Item( "Translation" ) & """ field to search for the name yourself.</p>\n\n" _
  237. 	        & "<p>Ambiguity, multiple ""local"" names, or the use of an incomplete name or group name instead of the species' full name, may prevent the program to find the scientific name.<br>\n" _
  238. 	        & "That is where the <input type=""button"" style=""width: 10em; height: 2em; vertical-align: middle"" value=""" & objCaptions.Item( "Search" ) & """> button next to the """ & objCaptions.Item( "ScientificName" ) & """ field comes to the rescue.<br>\n" _
  239. 	        & "Click it to find the scientific name yourself, or look it up in a printed bird guide.<br>\n" _
  240. 	        & "Once found, clear the """ & objCaptions.Item( "BirdName" ) & """ field and use the """ & objCaptions.Item( "ScientificName" ) & """ field to find the requested translations.<br>\n" _
  241. 	        & "If you still can't find the translation that way, this program cannot assist you any further.</p>\n\n" _
  242. 	        & "<h2 id=""Customization"">Customization</h2>\n\n" _
  243. 	        & "<p>You may use a configuration file named BirdName.cfg, to customize the window size, default input and output languages and number of simultaneous translations.<br>\n" _
  244. 	        & "BirdName.cfg is an ANSI encoded (or ""ASCII"") plain text file, located in BirdName.hta's parent folder.<br>\n" _
  245. 	        & "Examine the default settings shown below to find out what you can customize and how:</p>\n\n" _
  246. 	        & "<pre>Version=" & BirdName.Version & "\n" _
  247. 	        & "AutoUpdate=0\n" _
  248. 	        & "ConfigLanguage=en\n" _
  249. 	        & "DefaultLanguage=en\n" _
  250. 	        & "LocalLanguageNames=1\n" _
  251. 	        & "NumTrans=4\n" _
  252. 	        & "TransLang1=nl\n" _
  253. 	        & "TransLang2=de\n" _
  254. 	        & "TransLang3=es\n" _
  255. 	        & "TransLang4=da\n" _
  256. 	        & "WindowHeight=768\n" _
  257. 	        & "WindowWidth=1024</pre>\n\n" _
  258. 	        & "<table>\n<tr>\n\t<th style=""vertical-align: top;"">Note 1:</th>\n\t<td style=""vertical-align: top;"">Each of these settings can also be specified on the command line, e.g.<br>\n" _
  259. 	        & "\t\t<code>BirdName.hta /ConfigLanguage=en /DefaultLanguage=fr</code></td>\n</tr>\n" _
  260. 	        & "<tr>\n\t<th style=""vertical-align: top;"">Note 2:</th>\n\t<td style=""vertical-align: top;""><code>AutoUpdate=1</code> will update the HTA to the latest version without any user interaction.</td>\n</tr>\n</table>\n\n" _
  261. 	        & "<p>Besides the program settings, you can also customize (translate) the captions and button labels.<br>\n" _
  262. 	        & "This requires an ANSI encoded (or ""ASCII"") plain text file named BirdName.<em>lang</em>, located in BirdName.hta's parent folder, where <em>lang</em> is the language code specified by <code>ConfigLanguage</code> in BirdName.cfg (e.g. <code>en</code>).<br>\n" _
  263. 	        & "Unicode or extended ASCII characters in all text except button labels must be escaped (e.g. <code>&amp;Uuml;</code> for <code>&Uuml;</code>).<br>\n" _
  264. 	        & "You may have to experiment with code page settings when using extended ASCII characters in translated <em>button</em> labels.<br>\n" _
  265. 	        & "Examine BirdName.en, shown below, to figure out what you can customize and how:</p>\n\n" _
  266. 	        & "<pre>Version=" & BirdName.Version & "\n" _
  267. 	        & "All=All\n" _
  268. 	        & "Class=Class\n" _
  269. 	        & "ClassAll=All\n" _
  270. 	        & "ClassActinopterygii=Ray-finned fishes\n" _
  271. 	        & "ClassAmphibia=Amphibians\n" _
  272. 	        & "ClassAves=Birds\n" _
  273. 	        & "ClassChondrichthyes=Cartilaginous fishes\n" _
  274. 	        & "ClassMammalia=Mammmals\n" _
  275. 	        & "ClassReptilia=Reptiles\n" _
  276. 	        & "Configure=Configure\n" _
  277. 	        & "Help=Help\n" _
  278. 	        & "HideSettings=Hide Settings\n" _
  279. 	        & "NotActinopterygii=Not a ray-finned fish\n" _
  280. 	        & "NotAmphibia=Not an amphibian\n" _
  281. 	        & "NotAves=Not a bird\n" _
  282. 	        & "NotChondrichthyes=Not a cartilaginous fish\n" _
  283. 	        & "NotMammalia=Not a mammmal\n" _
  284. 	        & "NotReptilia=Not a reptile\n" _
  285. 	        & "OrAmbiguous=or ambiguous name\n" _
  286. 	        & "ScientificName=Scientific Name\n" _
  287. 	        & "Search=Search Wikipedia\n" _
  288. 	        & "Settings=Settings\n" _
  289. 	        & "SimultaneousTranslations=simultaneous translations\n" _
  290. 	        & "Translate=Translate\n" _
  291. 	        & "Translation=Translation\n" _
  292. 	        & "UseLocalLanguageNames=Use local language names</pre>\n\n" _
  293. 	        & "<p>Open the configuration files by clicking the <input type=""button"" class=""Button"" value=""" & objCaptions.Item( "Configure" ) & """ style=""width: 10em; height: 2em; vertical-align: middle""> button, next to the """ & objCaptions.Item( "Settings" ) & """ header.</p>\n\n" _
  294. 	        & "Change one setting at a time and examine the effect.<br>\n" _
  295. 	        & "If the result is a complete mess, just delete BirdName.cfg (and optionally BirdName.<em>lang</em>) to restore the default settings.</p>\n\n" _
  296. 	        & "&copy; 2013 Rob van der Woude<br>\n" _
  297. 	        & "<a href=""http://www.robvanderwoude.com/birdname.php"">http://www.robvanderwoude.com/birdname.php</a></p>\n"
  298. 	strHTML = Replace( strHTML, "\n", vbCrLf )
  299. 	strHTML = Replace( strHTML, "\t", vbTab  )
  300.  
  301. 	On Error Resume Next
  302. 	objIE.Navigate "about:blank"
  303. 	If Err Then
  304. 		Set objIE = CreateObject( "InternetExplorer.Application" )
  305. 		objIE.Navigate "about:blank"
  306. 	End If
  307. 	On Error Goto 0
  308. 	objIE.Width  = objSettings.Item( "WindowWidth" )
  309. 	objIE.Height = objSettings.Item( "WindowHeight" )
  310. 	objIE.Left   = Int( ( window.screen.width  - objIE.Width  ) / 2 ) + 30
  311. 	objIE.Top    = Int( ( window.screen.height - objIE.Height ) / 2 ) + 30
  312. 	objIE.StatusBar  = False
  313. 	objIE.AddressBar = False
  314. 	objIE.MenuBar    = False
  315. 	objIE.ToolBar    = False
  316. 	objIE.Document.title = "Help for BirdName " & BirdName.Version & ",  Rob van der Woude 2013"
  317. 	objIE.Document.body.style.fontFamily = "arial,sans-serif"
  318. 	objIE.Document.body.style.fontSize = "80%"
  319. 	objIE.Document.body.InnerHTML = strHTML
  320. 	objIE.Visible = 1
  321. End Sub
  322.  
  323.  
  324. Sub InitialConfig( )
  325. 	objCaptions.RemoveAll
  326. 	objCaptions.Add "Version", "0.00"
  327. 	objCaptions.Add "All", "All"
  328. 	objCaptions.Add "Class", "Class"
  329. 	objCaptions.Add "ClassAll", "All"
  330. 	objCaptions.Add "ClassActinopterygii", "Ray-finned fishes"
  331. 	objCaptions.Add "ClassAmphibia", "Amphibians"
  332. 	objCaptions.Add "ClassAves", "Birds"
  333. 	objCaptions.Add "ClassChondrichthyes", "Cartilaginous fishes"
  334. 	objCaptions.Add "ClassMammalia", "Mammmals"
  335. 	objCaptions.Add "ClassReptilia", "Reptiles"
  336. 	objCaptions.Add "Configure", "Configure"
  337. 	objCaptions.Add "Help", "Help"
  338. 	objCaptions.Add "HideSettings", "Hide Settings"
  339. 	objCaptions.Add "NotActinopterygii", "Not a ray-finned fish"
  340. 	objCaptions.Add "NotAmphibia", "Not an amphibian"
  341. 	objCaptions.Add "NotAves", "Not a bird"
  342. 	objCaptions.Add "NotChondrichthyes", "Not a cartilaginous fish"
  343. 	objCaptions.Add "NotMammalia", "Not a mammmal"
  344. 	objCaptions.Add "NotReptilia", "Not a reptile"
  345. 	objCaptions.Add "OrAmbiguous", "or ambiguous name"
  346. 	objCaptions.Add "ScientificName", "Scientific Name"
  347. 	objCaptions.Add "Search", "Search Wikipedia"
  348. 	objCaptions.Add "Settings", "Settings"
  349. 	objCaptions.Add "SimultaneousTranslations", "simultaneous translations"
  350. 	objCaptions.Add "Translate", "Translate"
  351. 	objCaptions.Add "Translation", "Translation"
  352. 	objCaptions.Add "UseLocalLanguageNames", "Use local language names"
  353.  
  354. 	objSettings.RemoveAll
  355. 	objSettings.Add "Version", "0.00"
  356. 	objSettings.Add "AutoUpdate", 0
  357. 	objSettings.Add "ConfigLanguage", ""
  358. 	objSettings.Add "DefaultLanguage", "en"
  359. 	objSettings.Add "LocalLanguageNames", True
  360. 	objSettings.Add "NumTrans", 2
  361. 	objSettings.Add "TransLang1", "nl"
  362. 	objSettings.Add "TransLang2", "de"
  363. 	objSettings.Add "TransLang3", "fr"
  364. 	objSettings.Add "TransLang4", "it"
  365. 	objSettings.Add "WindowHeight", 768
  366. 	objSettings.Add "WindowWidth", 1024
  367. End Sub
  368.  
  369.  
  370. Sub LoadConfig( )
  371. 	Dim blnError
  372. 	Dim i, intButtons
  373. 	Dim objCaptionsFile, objFSO, objMatches, objNewOption, objRE, objSettingsFile
  374. 	Dim strBaseName, strCaptionsFile, strCommandLine, strKey, strLine, strPrompt, strSettingsFile, strTitle, strValue
  375.  
  376. 	blnError       = False
  377. 	strCommandLine = BirdName.CommandLine
  378.  
  379. 	' Regular expression object to check command line arguments
  380. 	Set objRE = New RegExp
  381. 	objRE.Global = True
  382. 	objRE.IgnoreCase = True
  383.  
  384. 	' Find the full path of this HTA
  385. 	strBaseName = Left( Self.location.pathname, Len( Self.location.pathname ) - 4 )
  386.  
  387. 	' Check if it is accompanied by a config file
  388. 	strSettingsFile = strBaseName & ".cfg"
  389. 	Set objFSO = CreateObject( "Scripting.FileSystemObject" )
  390. 	With objFSO
  391. 		If .FileExists( strSettingsFile ) Then
  392. 			Set objSettingsFile = .OpenTextFile( strSettingsFile, ForReading, TristateFalse )
  393. 			While Not objSettingsFile.AtEndOfStream
  394. 				strLine = objSettingsFile.ReadLine( )
  395. 				strKey   = Trim( Left( strLine, InStr( strLine, "=" ) - 1 ) )
  396. 				strValue = Trim( Mid( strLine, InStr( strLine, "=" ) + 1 ) )
  397. 				Select Case strKey
  398. 					Case "AutoUpdate", "LocalLanguageNames"
  399. 						objSettings.Item( strKey ) = CBool( strValue )
  400. 						If InStr( UCase( strCommandLine ), "/" & UCase( strKey ) ) Then
  401. 							objRE.Pattern = " /" & strKey & "[\=\:](0|1)([^\d]|$)"
  402. 							Set objMatches = objRE.Execute( strCommandLine )
  403. 							If objMatches.Count > 0 Then
  404. 								objSettings.Item( strKey ) = CBool( objMatches.Item(0).Submatches(0) )
  405. 							End If
  406. 							Set objMatches = Nothing
  407. 						End if
  408. 					Case "ConfigLanguage", "DefaultClass", "DefaultLanguage", "TransLang1", "TransLang2", "TransLang3", "TransLang4", "Version"
  409. 						objSettings.Item( strKey ) = CStr( strValue )
  410. 						If InStr( UCase( strCommandLine ), "/" & UCase( strKey ) ) Then
  411. 							objRE.Pattern = " /" & strKey & "[\=\:]([a-z]+)"
  412. 							Set objMatches = objRE.Execute( strCommandLine )
  413. 							If objMatches.Count > 0 Then
  414. 								objSettings.Item( strKey ) = Trim( objMatches.Item(0).Submatches(0) )
  415. 							End If
  416. 							Set objMatches = Nothing
  417. 						End If
  418. 					Case "NumTrans", "WindowHeight", "WindowWidth"
  419. 						objSettings.Item( strKey ) = CInt( strValue )
  420. 						If InStr( UCase( strCommandLine ), "/" & UCase( strKey ) ) Then
  421. 							objRE.Pattern = " /" & strKey & "[\=\:](\d+)"
  422. 							Set objMatches = objRE.Execute( strCommandLine )
  423. 							If objMatches.Count > 0 Then
  424. 								objSettings.Item( strKey ) = CInt( objMatches.Item(0).Submatches(0) )
  425. 							End If
  426. 							Set objMatches = Nothing
  427. 						End if
  428. 					Case Else
  429. 						If Left( strKey, 1 ) <> ";" Then blnError = True
  430. 				End Select
  431. 			Wend
  432. 			objSettingsFile.Close
  433. 			Set objSettingsFile = Nothing
  434.  
  435. 			If objSettings.Item( "Version" ) <> BirdName.Version And objSettings.Item( "Version" ) <> "0.00" Then
  436. 				intButtons = vbOKOnly + vbApplicationModal + vbExclamation
  437. 				strTitle   = "Old configuration file"
  438. 				strPrompt  = "The configuration file BirdName.cfg is not compatible with this version of BirdName.hta." _
  439. 				           & vbCrLf & vbCrLf _
  440. 				           & "The default configuration values will be used instead."
  441. 				MsgBox strPrompt, intButtons, strTitle
  442. 				InitialConfig
  443. 			End If
  444.  
  445. 			If Not blnError Then
  446. 				If objSettings.Item( "ConfigLanguage" ) <> "" Then
  447. 					strCaptionsFile = strBaseName & "." & objSettings.Item( "ConfigLanguage" )
  448. 					If .FileExists( strCaptionsFile ) Then
  449. 						Set objCaptionsFile = .OpenTextFile( strCaptionsFile, ForReading, TristateFalse )
  450. 						While Not objCaptionsFile.AtEndOfStream
  451. 							strLine = objCaptionsFile.ReadLine( )
  452. 							strKey = Trim( Left( strLine, InStr( strLine, "=" ) - 1 ) )
  453. 							strValue = Trim( Mid( strLine, InStr( strLine, "=" ) + 1 ) )
  454. 							Select Case strKey
  455. 								Case "Configure", "Help", "HideSettings", "Invertebrate", "Name", "ScientificName", "Search", "Settings", "SimultaneousTranslations", "Translate", "Translation", "UseLocalLanguageNames", "Version"
  456. 									objCaptions.Item( strKey ) = strValue
  457. 								Case "Class", "ClassAll", "ClassActinopterygii", "ClassAmphibia", "ClassAves", "ClassChondrichthyes", "ClassMammalia", "ClassReptilia"
  458. 									objCaptions.Item( strKey ) = strValue
  459. 								Case "All", "Actinopterygii", "Amphibia", "Aves", "Chondrichthyes", "Mammalia", "Reptilia"
  460. 									objCaptions.Item( strKey ) = strValue
  461. 								Case "Amphibian", "Bird", "CartilaginousFish", "Mammal", "RayFinnedFish", "Reptile"
  462. 									objCaptions.Item( strKey ) = strValue
  463. 								Case "NotActinopterygii", "NotAmphibia", "NotAves", "NotChondrichthyes", "NotMammalia", "NotReptilia", "OrAmbiguous"
  464. 									objCaptions.Item( strKey ) = strValue
  465. 								Case Else
  466. 									If Left( strKey, 1 ) <> ";" Then blnError = True
  467. 							End Select
  468. 						Wend
  469. 						objCaptionsFile.Close
  470. 						Set objCaptionsFile = Nothing
  471. 					End If
  472. 				End If
  473. 			End If
  474.  
  475. 			If objCaptions.Item( "Version" ) <> BirdName.Version And objCaptions.Item( "Version" ) <> "0.00" Then
  476. 				intButtons = vbOKOnly + vbApplicationModal + vbExclamation
  477. 				strTitle   = "Old configuration file"
  478. 				strPrompt  = "The language file BirdName." & objSettings.Item( "ConfigLanguage" ) & " is not compatible with this version of BirdName.hta." _
  479. 				           & vbCrLf & vbCrLf _
  480. 				           & "The default language, English, will be used instead."
  481. 				MsgBox strPrompt, intButtons, strTitle
  482. 				InitialConfig
  483. 			End If
  484.  
  485. 			SelectNumTrans.innerHTML  = ""
  486. 			For i = 1 To 4
  487. 				Set objNewOption  = document.createElement( "OPTION" )
  488. 				objNewOption.text = i
  489. 				objNewOption.value = i
  490. 				If Int( objSettings.Item( "NumTrans" ) ) = i Then
  491. 					objNewOption.selected = True
  492. 				End If
  493. 				SelectNumTrans.options.Add( objNewOption )
  494. 			Next
  495.  
  496. 			SelectClass.innerHTML  = ""
  497. 			Set objNewOption  = document.createElement( "OPTION" )
  498. 			objNewOption.text = objCaptions.Item( "All" )
  499. 			objNewOption.value = "All"
  500. 			If objSettings.Item( "DefaultClass" ) = objNewOption.value Then objNewOption.selected = True
  501. 			SelectClass.options.Add( objNewOption )
  502. 			Set objNewOption  = document.createElement( "OPTION" )
  503. 			objNewOption.text = objCaptions.Item( "ClassActinopterygii" )
  504. 			objNewOption.value = "Actinopterygii"
  505. 			If objSettings.Item( "DefaultClass" ) = objNewOption.value Then objNewOption.selected = True
  506. 			SelectClass.options.Add( objNewOption )
  507. 			Set objNewOption  = document.createElement( "OPTION" )
  508. 			objNewOption.text = objCaptions.Item( "ClassAmphibia" )
  509. 			objNewOption.value = "Amphibia"
  510. 			If objSettings.Item( "DefaultClass" ) = objNewOption.value Then objNewOption.selected = True
  511. 			SelectClass.options.Add( objNewOption )
  512. 			Set objNewOption  = document.createElement( "OPTION" )
  513. 			objNewOption.text = objCaptions.Item( "ClassAves" )
  514. 			objNewOption.value = "Aves"
  515. 			If objSettings.Item( "DefaultClass" ) = objNewOption.value Then objNewOption.selected = True
  516. 			SelectClass.options.Add( objNewOption )
  517. 			Set objNewOption  = document.createElement( "OPTION" )
  518. 			objNewOption.text = objCaptions.Item( "ClassChondrichthyes" )
  519. 			objNewOption.value = "Chondrichthyes"
  520. 			If objSettings.Item( "DefaultClass" ) = objNewOption.value Then objNewOption.selected = True
  521. 			SelectClass.options.Add( objNewOption )
  522. 			Set objNewOption  = document.createElement( "OPTION" )
  523. 			objNewOption.text = objCaptions.Item( "ClassMammalia" )
  524. 			objNewOption.value = "Mammalia"
  525. 			If objSettings.Item( "DefaultClass" ) = objNewOption.value Then objNewOption.selected = True
  526. 			SelectClass.options.Add( objNewOption )
  527. 			Set objNewOption  = document.createElement( "OPTION" )
  528. 			objNewOption.text = objCaptions.Item( "ClassReptilia" )
  529. 			objNewOption.value = "Reptilia"
  530. 			SelectClass.options.Add( objNewOption )
  531.  
  532. 			Label_Class.innerHTML                    = objCaptions.Item( "Class" )
  533. 			Button_Configure.value                   = objCaptions.Item( "Configure" )
  534. 			Button_Help.value                        = objCaptions.Item( "Help" )
  535. 			Button_HideSettings.value                = objCaptions.Item( "HideSettings" )
  536. 			Label_ScientificName.innerHTML           = objCaptions.Item( "ScientificName" )
  537. 			Button_SearchScientificName.value        = objCaptions.Item( "Search" )
  538. 			Button_SearchTranslation1.value          = objCaptions.Item( "Search" )
  539. 			Button_SearchTranslation2.value          = objCaptions.Item( "Search" )
  540. 			Button_SearchTranslation3.value          = objCaptions.Item( "Search" )
  541. 			Button_SearchTranslation4.value          = objCaptions.Item( "Search" )
  542. 			Label_Settings.innerHTML                 = objCaptions.Item( "Settings" )
  543. 			Label_SimultaneousTranslations.innerHTML = objCaptions.Item( "SimultaneousTranslations" )
  544. 			Button_Translate.value                   = objCaptions.Item( "Translate" )
  545. 			Label_Translation1.innerHTML             = objCaptions.Item( "Translation" )
  546. 			Label_Translation2.innerHTML             = objCaptions.Item( "Translation" )
  547. 			Label_Translation3.innerHTML             = objCaptions.Item( "Translation" )
  548. 			Label_Translation4.innerHTML             = objCaptions.Item( "Translation" )
  549. 			Label_UseLocalLanguageNames.innerHTML    = objCaptions.Item( "UseLocalLanguageNames" )
  550. 			UseLocalLanguageNames.Checked            = objSettings.Item( "LocalLanguageNames" )
  551. 		Else
  552. 			InitialConfig
  553. 		End If
  554. 	End With
  555. 	Set objFSO = Nothing
  556. 	Set objRE  = Nothing
  557.  
  558. 	' Resize and position window
  559. 	objSettings.Item( "WindowWidth" )  = Min( objSettings.Item( "WindowWidth" ), window.screen.width )
  560. 	objSettings.Item( "WindowHeight" ) = Min( objSettings.Item( "WindowHeight" ), window.screen.height )
  561. 	Self.resizeTo objSettings.Item( "WindowWidth" ), objSettings.Item( "WindowHeight" )
  562. 	Self.moveTo Int( ( window.screen.width  - objSettings.Item( "WindowWidth" ) ) / 2 ), Int( ( window.screen.height - objSettings.Item( "WindowHeight" ) ) / 2 )
  563. End Sub
  564.  
  565.  
  566. Function Max( num1, num2 )
  567. 	If CDbl( num1 ) > CDbl( num2 ) Then
  568. 		Max = CDbl( num1 )
  569. 	Else
  570. 		Max = CDbl( num2 )
  571. 	End If
  572. End Function
  573.  
  574.  
  575. Function Min( num1, num2 )
  576. 	If CDbl( num1 ) < CDbl( num2 ) Then
  577. 		Min = CDbl( num1 )
  578. 	Else
  579. 		Min = CDbl( num2 )
  580. 	End If
  581. End Function
  582.  
  583.  
  584. Function OSVersion( )
  585. 	Dim arrOSVer
  586. 	OSVersion = 0
  587. 	On Error Resume Next
  588. 	Set objWMIService = GetObject( "winmgmts://./root/cimv2" )
  589. 	Set colInstances  = objWMIService.ExecQuery( "SELECT * FROM Win32_OperatingSystem" )
  590. 	For Each objInstance In colInstances
  591. 		arrOSVer = Split( objInstance.Version, "." )
  592. 		If UBound( arrOSVer ) > 0 Then OSVersion = 100 * arrOSVer(0) + arrOSVer(1)
  593. 	Next
  594. 	Set colInstances  = Nothing
  595. 	Set objWMIService = Nothing
  596. 	On Error Goto 0
  597. End Function
  598.  
  599.  
  600. Sub Sleep( seconds )
  601. 	Dim wshShell, strCmd
  602. 	On Error Resume Next
  603. 	Set wshShell = CreateObject( "Wscript.Shell" )
  604. 	strCmd = "%COMSPEC% /C (PING -n " & seconds & " 127.0.0.1 >NUL 2>&1 || PING -n " & seconds & " ::1 >NUL 2>&1)"
  605. 	wshShell.Run strCmd, 0, 1
  606. 	Set wshShell = Nothing
  607. 	On Error Goto 0
  608. End Sub
  609.  
  610.  
  611. Sub Sort2Dim1( ByRef myArray, myIndex )
  612. ' Sort a 2-dimensional array by its specified index in the 1st dimension
  613.     Dim i, j, arrHolder( 2 )
  614.     For i = ( UBound( myArray, 2 ) - 1 ) to 0 Step -1
  615.         For j= 0 to i
  616.             If UCase( myArray( myIndex, j ) ) > UCase( myArray( myIndex, j + 1 ) ) Then
  617.                 arrHolder( 0 )      = myArray( 0, j + 1 )
  618.                 arrHolder( 1 )      = myArray( 1, j + 1 )
  619.                 arrHolder( 2 )      = myArray( 2, j + 1 )
  620.                 myArray( 0, j + 1 ) = myArray( 0, j )
  621.                 myArray( 1, j + 1 ) = myArray( 1, j )
  622.                 myArray( 2, j + 1 ) = myArray( 2, j )
  623.                 myArray( 0, j )     = arrHolder( 0 )
  624.                 myArray( 1, j )     = arrHolder( 1 )
  625.                 myArray( 2, j )     = arrHolder( 2 )
  626.             End If
  627.         Next
  628.     Next 
  629. End Sub
  630.  
  631.  
  632. ' Translate scientific name to specified language using WikiPedia
  633. Function Translate( myLanguageCode )
  634. Dim dummy
  635. 	Dim objMatches, objRE
  636. 	Dim strHTML, strName, strURL
  637.  
  638. 	If Trim( ScientificName.value ) = "" Then
  639. 		Translate = ""
  640. 		Exit Function
  641. 	End If
  642.  
  643. 	' First, try the URL generated with the first scientific name
  644. 	strURL = "http://" & myLanguageCode & ".wikipedia.org/wiki/" & Und( ScientificName.value )
  645. 	strHTML = WGet( strURL )
  646. 	' If the page or translation wasn't found, try the second scientific name, if available
  647. 	If Left( strHTML, 2 ) = "--" Then
  648. 		If strAlternativeScientificName = "" Then
  649. 			Translate = strHTML
  650. 			Exit Function
  651. 		Else
  652. 			strURL = "http://" & myLanguageCode & ".wikipedia.org/wiki/" & Und( strAlternativeScientificName )
  653. 			strHTML = WGet( strURL )
  654. 			If Left( strHTML, 2 ) = "--" Then
  655. 				Translate = strHTML
  656. 				Exit Function
  657. 			End If
  658. 		End If
  659. 	End If
  660. 	Set objRE = New RegExp
  661. 	objRE.Global = False
  662. 	objRE.IgnoreCase = True
  663. 	' First, let's assume the page title is the translated name
  664. 	objRE.Pattern = "<h1 (?:[^>]*?)?(?:id|class)=""firstHeading"" (?:class|id)=""firstHeading""(?:[^>]*?)?>(?:[\n\r\s]*)(?:<span[^>]*>)?(.*?)(?:</span>)(?:[\n\r\s]*)?</h1>"
  665. 	Set objMatches = objRE.Execute( strHTML )
  666. 	If objMatches.Count > 0 Then
  667. 		If objMatches.Item(0).Submatches.Count > 0 Then
  668. 			strName = objMatches.Item(0).Submatches(0)
  669. 		End If
  670. 	End If
  671. 	' In case the page title is the scientific name, try an alternative search pattern
  672. 	If LCase( ScientificName.value ) = LCase( strName ) Then
  673. 		objre.Pattern = "<b>([^<]+)</b> \(<i>(<b>)?" & ScientificName.value & "(</b>)?</i>(,|\)) [^\n\r]{20,}[\n\r]"
  674. 		Set objMatches = objRE.Execute( strHTML )
  675. 		If objMatches.Count > 0 Then
  676. 			If objMatches.Item(0).Submatches.Count > 0 Then
  677. 				strName = objMatches.Item(0).Submatches(0)
  678. 			End If
  679. 		End If
  680. 	End If
  681.  
  682. 	Set objMatches = Nothing
  683. 	Set objRE = Nothing
  684. 	Translate = strName
  685. End Function
  686.  
  687.  
  688. Function TextFromHTML( myURL )
  689.     Dim objHTTP
  690.     TextFromHTML = ""
  691.     Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
  692.     objHTTP.Open "GET", myURL
  693.     objHTTP.Send
  694.     ' Check if the result was valid, and if so return the result
  695.     If objHTTP.Status = 200 Then
  696.     	TextFromHTML = objHTTP.ResponseText
  697.     End If
  698.     Set objHTTP = Nothing
  699. End Function
  700.  
  701.  
  702. ' Replace spaces by underscores to create URL
  703. Function Und( myString )
  704. 	Und = Replace( myString, " ", "_" )
  705. End Function
  706.  
  707.  
  708. Sub Update( )
  709. 	Dim blnAccess, blnCreate, blnOverwrite
  710. 	Dim objFSO, objHTAFile, objShell
  711. 	Dim strHTAFile
  712.  
  713. 	blnCreate = True
  714. 	blnOverwrite = True
  715. 	strHTAFile = Self.location.pathname
  716. 	Set objFSO   = CreateObject( "Scripting.FileSystemObject" )
  717. 	'On Error Resume Next
  718. 	With objFSO
  719. 		Set objHTAFile = .GetFile( strHTAFile )
  720. 		objHTAFile.Copy Left( strHTAFile, Len( strHTAFile ) - 4 ) & ".bak." & CStr( 10000 * Hour( Now ) + 100 * Minute( Now ) + Second( Now ) ), blnOverwrite
  721. 		If Err Then
  722. 			blnAccess = False
  723. 		Else
  724. 			blnAccess = True
  725. 		End If
  726. 		Set objHTAFile = Nothing
  727. 		WGetSource
  728. 		Self.location.reload( True )
  729. 	End With
  730. 	On Error Goto 0
  731. 	Set objFSO   = Nothing
  732. 	' If we could not access the HTA to update it, we will retry with elevated privileges
  733. 	If Not blnAccess Then
  734. 		If InStr( BirdName.CommandLine, " /Update" ) Then
  735. 			MsgBox "The automatic update failed: no access.", vbOKOnly + vbApplicationModal + vbExclamation, "Automatic update failed"
  736. 		Else
  737. 			If OSVersion > 599 Then
  738. 				Set objShell = CreateObject( "Shell.Application" )
  739. 				objShell.ShellExecute BirdName.CommandLine & " /Update", "", "runas", 1
  740. 				Set objShell = Nothing
  741. 			Else
  742. 				MsgBox "Update failed, no access."
  743. 			End If
  744. 		End If
  745. 	End If
  746. End Sub
  747.  
  748.  
  749. ' Read the entire web page
  750. Function WGet( myURL )
  751. 	Dim objHTTP
  752. 	WGet = "--Not Found: " & myURL & "--"
  753. 	Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
  754. 	objHTTP.Open "GET", myURL
  755. 	objHTTP.Send
  756. 	If objHTTP.Status = 200 Then
  757. 		WGet = objHTTP.ResponseText
  758. 	Else
  759. 		WGet = "--Not found (" & objHTTP.Status & ") " & myURL & "--"
  760. 	End If
  761. 	Set objHTTP = Nothing
  762. End Function
  763.  
  764.  
  765. ' Read the HTA source code from the web page and overwrite this HTA itself
  766. Sub WGetSource(  )
  767. 	Dim intAnswer, intButtons
  768. 	Dim objADODB, objHTTP, objRE, wshShell
  769. 	Dim strHTA, strPrompt, strText, strTitle, strURL
  770.  
  771. 	Const adTypeBinary          = 1
  772. 	Const adTypeText            = 2
  773. 	Const adSaveCreateNotExist  = 1
  774. 	Const adSaveCreateOverWrite = 2
  775.  
  776. 	strURL  = "http://www.robvanderwoude.com/files/birdname_hta.txt"
  777. 	strHTA  = Self.location.pathname
  778. 	strText = ""
  779.  
  780. 	Set objADODB = CreateObject( "ADODB.Stream" )
  781. 	Set objRE    = New RegExp
  782.  
  783. 	Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
  784. 	objHTTP.Open "GET", strURL
  785. 	objHTTP.Send
  786. 	If objHTTP.Status = 200 Then
  787. 		strText = objHTTP.ResponseText
  788. 	End If
  789. 	Set objHTTP = Nothing
  790.  
  791. 	If InStr( strText, "APPLICATIONNAME=""BirdName""" ) Then
  792. 		' Use ADODB stream to convert to and save as ASCII
  793. 		With objADODB
  794. 			.Open
  795. 			.Type = adTypeText
  796. 			.CharSet = "us-ascii"
  797. 			.WriteText strText
  798. 			.SaveToFile strHTA, adSaveCreateOverWrite
  799. 			.Close
  800. 		End With
  801. 	Else
  802. 		intButtons = vbYesNoCancel + vbApplicationModal + vbInformation
  803. 		strTitle   = "Automatic update failed"
  804. 		strPrompt  = "The automatic update of BirdName.hta failed." & vbCrLf & vbCrLf & "Do you want to download the latest official release now?" 
  805. 		intAnswer  = MsgBox( strPrompt, intButtons, strTitle )
  806. 		If intAnswer = vbYes Then
  807. 			Set wshShell = CreateObject( "WScript.Shell" )
  808. 			wshShell.Run "http://www.robvanderwoude.com/birdname.php", 3, False
  809. 			Set wshShell = Nothing
  810. 		End If
  811. 	End If
  812.  
  813. 	Set objADODB = Nothing
  814. 	Set objHTTP  = Nothing
  815. 	Set objRE    = Nothing
  816. End Sub
  817.  
  818.  
  819. ' Event triggered subroutines
  820.  
  821.  
  822. Sub Window_OnLoad( )
  823. 	window.document.title = "BirdName " & BirdName.Version & ",  Rob van der Woude 2013"
  824. 	LoadConfig
  825. 	If GetLanguageList( ) Then
  826. 		OnClick_UseLocalLanguageNames
  827. 		OnChange_SelectNumTrans
  828. 		setTimeout "CheckUpdate", 500, "VBScript"
  829. 		If InStr( BirdName.CommandLine, "/?" ) Then HelpMsg
  830. 	Else
  831. 		Self.close
  832. 	End If
  833. End Sub
  834.  
  835.  
  836. Sub Window_OnUnload( )
  837. 	On Error Resume Next
  838. 	objIE.Quit
  839. 	Set objIE = Nothing
  840. 	On Error Goto 0
  841. End Sub
  842.  
  843.  
  844. Sub OnChange_ScientificName( )
  845. 	ClearTranslations
  846. 	If Not Button_SearchScientificName.disabled Then
  847. 		If Trim( ScientificName.value ) <> "" And Left( LCase( Trim( ScientificName.value ) ), 11 ) <> "--not found" Then
  848. 			SpeciesInput.value = ""
  849. 			Button_SearchScientificName.disabled = False
  850. 		End If
  851. 	End If
  852. 	If Trim( SpeciesInput.value & ScientificName.value ) = "" Then
  853. 		Button_Clear.disabled     = True
  854. 		Button_Translate.disabled = True
  855. 	Else
  856. 		Button_Clear.disabled     = False
  857. 		Button_Translate.disabled = False
  858. 	End If
  859. 	If Trim( ScientificName.value ) = "" Then
  860. 		Button_SearchScientificName.disabled = True
  861. 	Else
  862. 		Button_SearchScientificName.disabled = False
  863. 		' Start translating when Enter key is pressed
  864. 		If window.event.Keycode = 13 Then OnClick_ButtonTranslate
  865. 	End If
  866. End Sub
  867.  
  868.  
  869. Sub OnChange_SelectSourceLanguage( )
  870. 	objSettings.Item( "DefaultLanguage" ) = SelectSourceLanguage.value
  871. End Sub
  872.  
  873.  
  874. Sub OnChange_SelectTargetLanguage1( )
  875. 	Translation1.value = ""
  876. 	objSettings.Item( "TransLang1" ) = SelectTargetLanguage1.value
  877. End Sub
  878.  
  879.  
  880. Sub OnChange_SelectTargetLanguage2( )
  881. 	Translation2.value = ""
  882. 	objSettings.Item( "TransLang2" ) = SelectTargetLanguage2.value
  883. End Sub
  884.  
  885.  
  886. Sub OnChange_SelectTargetLanguage3( )
  887. 	Translation3.value = ""
  888. 	objSettings.Item( "TransLang3" ) = SelectTargetLanguage3.value
  889. End Sub
  890.  
  891.  
  892. Sub OnChange_SelectTargetLanguage4( )
  893. 	Translation4.value = ""
  894. 	objSettings.Item( "TransLang4" ) = SelectTargetLanguage4.value
  895. End Sub
  896.  
  897.  
  898. Sub OnChange_SelectClass( )
  899. 	ScientificName.value = ""
  900. 	Button_SearchScientificName.disabled = True
  901. 	ClearTranslations
  902. 	SpeciesInput.Focus
  903. End Sub
  904.  
  905.  
  906. Sub OnChange_SelectNumTrans( )
  907. 	Dim i, intNumTrans, objNewOption
  908. 	If SelectNumTrans.value = "" Then
  909. 		SelectNumTrans.innerHTML  = ""
  910. 		For i = 1 To 4
  911. 			Set objNewOption  = document.createElement( "OPTION" )
  912. 			objNewOption.text = i
  913. 			objNewOption.value = i
  914. 			If Int( objSettings.Item( "NumTrans" ) ) = i Then
  915. 				objNewOption.selected = True
  916. 			End If
  917. 			SelectNumTrans.options.Add( objNewOption )
  918. 		Next
  919. 	End If
  920. 	intNumTrans = SelectNumTrans.value
  921. 	TranslationBlock2.style.display = "none"
  922. 	TranslationBlock3.style.display = "none"
  923. 	TranslationBlock4.style.display = "none"
  924. 	If intNumTrans = 1 Then
  925. 		Label_Trans1.style.display = "none"
  926. 	Else
  927. 		Label_Trans1.style.display = "inline"
  928. 	End If
  929. 	If intNumTrans > 1 Then TranslationBlock2.style.display = "block"
  930. 	If intNumTrans > 2 Then TranslationBlock3.style.display = "block"
  931. 	If intNumTrans > 3 Then TranslationBlock4.style.display = "block"
  932. End Sub
  933.  
  934.  
  935. Sub OnChange_SpeciesInput( )
  936. 	ClearTranslations
  937. 	If Trim( SpeciesInput.value & ScientificName.value ) = "" Then
  938. 		Button_Clear.disabled     = True
  939. 		Button_Translate.disabled = True
  940. 	Else
  941. 		Button_Clear.disabled     = False
  942. 		Button_Translate.disabled = False
  943. 	End If
  944. 	If Trim( SpeciesInput.value ) = "" Then
  945. 		Button_Translate.disabled = True
  946. 	Else
  947. 		Button_Translate.disabled = False
  948. 		' Start translating when Enter key is pressed
  949. 		If window.event.Keycode = 13 Then OnClick_ButtonTranslate
  950. 	End If
  951. 	If Trim( ScientificName.value ) = "" Then
  952. 		Button_SearchScientificName.disabled = True
  953. 	Else
  954. 		Button_SearchScientificName.disabled = False
  955. 	End If
  956. End Sub
  957.  
  958.  
  959. Sub OnClick_ButtonClear( )
  960. 	ScientificName.value = ""
  961. 	SpeciesInput.value  = ""
  962. 	OnChange_SpeciesInput
  963. 	SpeciesInput.Focus
  964. End Sub
  965.  
  966.  
  967. Sub OnClick_ButtonConfigure( )
  968. 	Dim wshShell, strBaseName
  969. 	Set wshShell = CreateObject( "WScript.Shell" )
  970. 	strBaseName = Left( Self.location.pathname, Len( Self.location.pathname ) - 4 )
  971. 	wshShell.Run "notepad.exe " & strBaseName & ".cfg", 5, True
  972. 	LoadConfig
  973. 	wshShell.Run "notepad.exe " & strBaseName & "." & objSettings.Item( "ConfigLanguage" ), 5, True
  974. 	Self.location.reload True
  975. End Sub
  976.  
  977.  
  978. Sub OnClick_ButtonDownload( )
  979. 	window.open "http://www.robvanderwoude.com/birdname.php"
  980. End Sub
  981.  
  982.  
  983. Sub OnClick_ButtonHideSettings( )
  984. 	SettingsBlock.style.display = "none"
  985. End Sub
  986.  
  987.  
  988. Sub OnClick_ButtonSearchScientificName( )
  989. 	window.open "http://" & SelectSourceLanguage.value & ".wikipedia.org/wiki/" & Cap( Und( SpeciesInput.value ) )
  990. End Sub
  991.  
  992.  
  993. Sub OnClick_ButtonSearchTranslation1( )
  994. 	If Translation1.value = "" Or Left( LCase( Trim( Translation1.value ) ), 2 ) = "--" Then
  995. 		window.open "http://" & SelectTargetLanguage1.value & ".wikipedia.org/wiki/" & Und( ScientificName.value )
  996. 	Else
  997. 		window.open "http://" & SelectTargetLanguage1.value & ".wikipedia.org/wiki/" & Und( Translation1.value )
  998. 	End If
  999. End Sub
  1000.  
  1001.  
  1002. Sub OnClick_ButtonSearchTranslation2( )
  1003. 	If Translation2.value = "" Or Left( LCase( Trim( Translation2.value ) ), 2 ) = "--" Then
  1004. 		window.open "http://" & SelectTargetLanguage2.value & ".wikipedia.org/wiki/" & Und( ScientificName.value )
  1005. 	Else
  1006. 		window.open "http://" & SelectTargetLanguage2.value & ".wikipedia.org/wiki/" & Und( Translation2.value )
  1007. 	End If
  1008. End Sub
  1009.  
  1010.  
  1011. Sub OnClick_ButtonSearchTranslation3( )
  1012. 	If Translation3.value = "" Or Left( LCase( Trim( Translation3.value ) ), 2 ) = "--" Then
  1013. 		window.open "http://" & SelectTargetLanguage3.value & ".wikipedia.org/wiki/" & Und( ScientificName.value )
  1014. 	Else
  1015. 		window.open "http://" & SelectTargetLanguage3.value & ".wikipedia.org/wiki/" & Und( Translation3.value )
  1016. 	End If
  1017. End Sub
  1018.  
  1019.  
  1020. Sub OnClick_ButtonSearchTranslation4( )
  1021. 	If Translation4.value = "" Or Left( LCase( Trim( Translation4.value ) ), 2 ) = "--" Then
  1022. 		window.open "http://" & SelectTargetLanguage4.value & ".wikipedia.org/wiki/" & Und( ScientificName.value )
  1023. 	Else
  1024. 		window.open "http://" & SelectTargetLanguage4.value & ".wikipedia.org/wiki/" & Und( Translation4.value )
  1025. 	End If
  1026. End Sub
  1027.  
  1028.  
  1029. Sub OnClick_ButtonTranslate( )
  1030. 	ClearTranslations
  1031. 	Button_SearchScientificName.disabled = True
  1032. 	If Trim( SpeciesInput.value ) = "" Then
  1033. 		ScientificName.value = Cap( ScientificName.value )
  1034. 		SpeciesInput.value = Translate( objSettings.Item( "DefaultLanguage" ) )
  1035. 	Else
  1036. 		ScientificName.value = ""
  1037. 		GetScientificName
  1038. 	End If
  1039. 	Button_SearchScientificName.disabled = False
  1040. 	If ScientificName.value <> "" And Left( LCase( Trim( ScientificName.value ) ), 2 ) <> "--" Then
  1041. 		Translation1.value = Translate( objSettings.Item( "TransLang1" ) )
  1042. 		Button_SearchTranslation1.disabled = False
  1043. 		If Left( LCase( Trim( Translation1.value ) ), 2 ) = "--" Then
  1044. 			Translation1.style.color = "red"
  1045. 		Else
  1046. 			Translation1.style.color = "black"
  1047. 		End If
  1048. 		If SelectNumTrans.value > 1 Then
  1049. 			Translation2.value = Translate( objSettings.Item( "TransLang2" ) )
  1050. 			Button_SearchTranslation2.disabled = False
  1051. 			If Left( LCase( Trim( Translation2.value ) ), 2 ) = "--" Then
  1052. 				Translation2.style.color = "red"
  1053. 			Else
  1054. 				Translation2.style.color = "black"
  1055. 			End If
  1056. 		End If
  1057. 		If SelectNumTrans.value > 2 Then
  1058. 			Translation3.value = Translate( objSettings.Item( "TransLang3" ) )
  1059. 			Button_SearchTranslation3.disabled = False
  1060. 			If Left( LCase( Trim( Translation3.value ) ), 2 ) = "--" Then
  1061. 				Translation3.style.color = "red"
  1062. 			Else
  1063. 				Translation3.style.color = "black"
  1064. 			End If
  1065. 		End If
  1066. 		If SelectNumTrans.value > 3 Then
  1067. 			Translation4.value = Translate( objSettings.Item( "TransLang4" ) )
  1068. 			Button_SearchTranslation4.disabled = False
  1069. 			If Left( LCase( Trim( Translation4.value ) ), 2 ) = "--" Then
  1070. 				Translation4.style.color = "red"
  1071. 			Else
  1072. 				Translation4.style.color = "black"
  1073. 			End If
  1074. 		End If
  1075. 	End If
  1076. 	If Left( LCase( Trim( SpeciesInput.value ) ), 2 ) = "--" Then
  1077. 		SpeciesInput.style.color = "red"
  1078. 	Else
  1079. 		SpeciesInput.style.color = "black"
  1080. 	End If
  1081. 	If Left( LCase( Trim( ScientificName.value ) ), 2 ) = "--" Then
  1082. 		ScientificName.style.color = "red"
  1083. 	Else
  1084. 		ScientificName.style.color = "black"
  1085. 	End If
  1086. End Sub
  1087.  
  1088.  
  1089. Sub OnClick_ButtonUpdate( )
  1090. 	Dim strMsg, strQuote, strTitle
  1091.  
  1092. 	Const vbCancel = 2
  1093. 	Const vbYes    = 6
  1094. 	Const vbNo     = 7
  1095.  
  1096. 	If Left( BirdName.Version, 1 ) = "0" Then strQuote = Chr(34)
  1097. 	strMsg   = "You are about to update the running BirdName program to its latest " & strQuote & "stable" & strQuote & " release." & vbCrLf _
  1098. 	         & "A copy of the program will be saved, allowing a roll-back if necessary." & vbCrLf & vbCrLf
  1099. 	If Left( BirdName.Version, 4 ) < "0.30" Then
  1100. 		strMsg = strMsg & "The update to version " & BirdName.Version & " will render previous configuration files useless." & vbCrLf & vbCrLf
  1101. 	End If
  1102. 	strMsg   = strMsg & "Do you want to update now?"
  1103. 	strTitle = "Confirm Update"
  1104. 	If MsgBox( strMsg, vbYesNoCancel, strTitle ) = vbYes Then Update
  1105. End Sub
  1106.  
  1107.  
  1108. Sub OnClick_UseLocalLanguageNames( )
  1109. 	Dim i, intIndex, objNewOption
  1110. 	blnUseLocalLanguageNames = UseLocalLanguageNames.Checked
  1111. 	If blnUseLocalLanguageNames Then
  1112. 		intIndex = 1
  1113. 	Else
  1114. 		intIndex = 2
  1115. 	End If
  1116. 	Sort2Dim1 arrLang, intIndex
  1117.  
  1118. 	SelectSourceLanguage.innerHTML  = ""
  1119. 	For i = 0 To UBound( arrLang, 2 )
  1120. 		Set objNewOption  = document.createElement( "OPTION" )
  1121. 		objNewOption.text = arrLang( intIndex, i )
  1122. 		objNewOption.value = arrLang( 0, i )
  1123. 		objNewOption.title = arrLang( 3 - intIndex, i )
  1124. 		If UCase( objSettings.Item( "DefaultLanguage" ) ) = UCase( arrLang( 0, i ) ) Then
  1125. 			objNewOption.selected = True
  1126. 		End If
  1127. 		SelectSourceLanguage.options.Add( objNewOption )
  1128. 	Next
  1129.  
  1130. 	SelectTargetLanguage1.innerHTML = ""
  1131. 	For i = 0 To UBound( arrLang, 2 )
  1132. 		Set objNewOption  = document.createElement( "OPTION" )
  1133. 		objNewOption.text = arrLang( intIndex, i )
  1134. 		objNewOption.value = arrLang( 0, i )
  1135. 		objNewOption.title = arrLang( 3 - intIndex, i )
  1136. 		If UCase( objSettings.Item( "TransLang1" ) ) = UCase( arrLang( 0, i ) ) Then
  1137. 			objNewOption.selected = True
  1138. 		End If
  1139. 		SelectTargetLanguage1.options.Add( objNewOption )
  1140. 	Next
  1141.  
  1142. 	SelectTargetLanguage2.innerHTML = ""
  1143. 	For i = 0 To UBound( arrLang, 2 )
  1144. 		Set objNewOption  = document.createElement( "OPTION" )
  1145. 		objNewOption.text = arrLang( intIndex, i )
  1146. 		objNewOption.value = arrLang( 0, i )
  1147. 		objNewOption.title = arrLang( 3 - intIndex, i )
  1148. 		If UCase( objSettings.Item( "TransLang2" ) ) = UCase( arrLang( 0, i ) ) Then
  1149. 			objNewOption.selected = True
  1150. 		End If
  1151. 		SelectTargetLanguage2.options.Add( objNewOption )
  1152. 	Next
  1153.  
  1154. 	SelectTargetLanguage3.innerHTML = ""
  1155. 	For i = 0 To UBound( arrLang, 2 )
  1156. 		Set objNewOption  = document.createElement( "OPTION" )
  1157. 		objNewOption.text = arrLang( intIndex, i )
  1158. 		objNewOption.value = arrLang( 0, i )
  1159. 		objNewOption.title = arrLang( 3 - intIndex, i )
  1160. 		If UCase( objSettings.Item( "TransLang3" ) ) = UCase( arrLang( 0, i ) ) Then
  1161. 			objNewOption.selected = True
  1162. 		End If
  1163. 		SelectTargetLanguage3.options.Add( objNewOption )
  1164. 	Next
  1165.  
  1166. 	SelectTargetLanguage4.innerHTML = ""
  1167. 	For i = 0 To UBound( arrLang, 2 )
  1168. 		Set objNewOption  = document.createElement( "OPTION" )
  1169. 		objNewOption.text = arrLang( intIndex, i )
  1170. 		objNewOption.value = arrLang( 0, i )
  1171. 		objNewOption.title = arrLang( 3 - intIndex, i )
  1172. 		If UCase( objSettings.Item( "TransLang4" ) ) = UCase( arrLang( 0, i ) ) Then
  1173. 			objNewOption.selected = True
  1174. 		End If
  1175. 		SelectTargetLanguage4.options.Add( objNewOption )
  1176. 	Next
  1177. End Sub
  1. </script>
  2.  
  3. <body onhelp="HelpMsg()">
  4.  
  5. <div id="SettingsBlock">
  6.  
  7. <h3>
  8. <span name="Label_Settings" id="Label_Settings" onclick="OnClick_ButtonConfigure">Settings</span>
  9. <input class="Button Hidden">
  10. <input name="Button_Configure" id="Button_Configure" type="button" class="Button" value="Configure" onclick="OnClick_ButtonConfigure" style="vertical-align: middle;">
  11. </h3>
  12.  
  13. <div class="Group">
  14.  
  15. <table>
  16. <tr>
  17. 	<td class="Content">
  18. 		<input type="checkbox" name="UseLocalLanguageNames" id="UseLocalLanguageNames" onclick="OnClick_UseLocalLanguageNames"><label for="UseLocalLanguageNames" id="Label_UseLocalLanguageNames" title="Deselect to use English language names">Use local language names</label></td>
  19. 	<td class="Spacer">&nbsp;</td>
  20. 	<td class="Content">
  21. 		<select name="SelectNumTrans" id="SelectNumTrans" size="1" onchange="OnChange_SelectNumTrans" style="width: 3em;"></select> <span id="Label_SimultaneousTranslations">simultaneous translations</span></td>
  22. 	<td class="Spacer">&nbsp;</td>
  23. 	<td class="Control"><input type="button" class="Button" name="Button_HideSettings" id="Button_HideSettings" value="Hide Settings" onclick="OnClick_ButtonHideSettings"></td>
  24. </tr>
  25. </table>
  26.  
  27. </div>
  28.  
  29. </div>
  30.  
  31.  
  32.  
  33. <h3><span id="Label_Class">Class</span>:
  34. <select name="SelectClass" id="SelectClass" size="1" onchange="OnChange_SelectClass" style="width: 10em;">
  35. 	<option value="All">All</option>
  36. 	<option value="Actinopterygii">Ray-finned fishes</option>
  37. 	<option value="Amphibia">Amphibians</option>
  38. 	<option value="Aves">Birds</option>
  39. 	<option value="Chondrichthyes">Cartilaginous fishes</option>
  40. 	<option value="Mammalia">Mammals</option>
  41. 	<option value="Reptilia">Reptiles</option>
  42. </select></h3>
  43.  
  44. <div class="Group">
  45.  
  46. <table>
  47. <tr>
  48. 	<td class="Content"><select name="SelectSourceLanguage" id="SelectSourceLanguage" size="1" onchange="OnChange_SelectSourceLanguage" style="width: 20em;"></select></td>
  49. 	<td class="Spacer">&nbsp;</td>
  50. 	<td class="Content"><input type="text" name="SpeciesInput" id="SpeciesInput" style="width: 25em;" onchange="OnChange_SpeciesInput" onclick="OnChange_SpeciesInput" onkeyup="OnChange_SpeciesInput"></td>
  51. 	<td class="Spacer">&nbsp;</td>
  52. 	<td class="Control"><input type="button" class="Button" name="Button_Translate" id="Button_Translate" value="Translate" onclick="OnClick_ButtonTranslate" disabled></td>
  53. </tr>
  54. </table>
  55.  
  56. </div>
  57.  
  58.  
  59.  
  60. <h3 id="Label_ScientificName">Scientific Name</h3>
  61.  
  62. <div class="Group">
  63.  
  64. <table>
  65. <tr>
  66. 	<td class="Content"><select name="Spacer" id="Spacer" style="width: 20em; visibility: hidden;"></select></td>
  67. 	<td class="Spacer">&nbsp;</td>
  68. 	<td class="Content"><input type="text" name="ScientificName" id="ScientificName" onchange="OnChange_ScientificName" onkeyup="OnChange_ScientificName" style="width: 25em;"></td>
  69. 	<td class="Spacer">&nbsp;</td>
  70. 	<td class="Control"><input type="button" class="Button" name="Button_SearchScientificName" id="Button_SearchScientificName" value="Search Wikipedia" onclick="OnClick_ButtonSearchScientificName" disabled></td>
  71. </tr>
  72. </table>
  73.  
  74. </div>
  75.  
  76.  
  77.  
  78. <h3><span id="Label_Translation1">Translation</span><span id="Label_Trans1"> 1</span></h3>
  79.  
  80. <div class="Group">
  81.  
  82. <table>
  83. <tr>
  84. 	<td class="Content"><select name="SelectTargetLanguage1" id="SelectTargetLanguage1" size="1" onchange="OnChange_SelectTargetLanguage1" style="width: 20em;"></select></td>
  85. 	<td class="Spacer">&nbsp;</td>
  86. 	<td class="Content"><input type="text" name="Translation1" id="Translation1" style="width: 25em;" readonly></td>
  87. 	<td class="Spacer">&nbsp;</td>
  88. 	<td class="Control"><input type="button" class="Button" name="Button_SearchTranslation1" id="Button_SearchTranslation1" value="Search Wikipedia" onclick="OnClick_ButtonSearchTranslation1" disabled></td>
  89. </tr>
  90. </table>
  91.  
  92. </div>
  93.  
  94.  
  95.  
  96. <div id="TranslationBlock2" style="display: block;">
  97.  
  98. <h3><span id="Label_Translation2">Translation</span> 2</h3>
  99.  
  100. <div class="Group">
  101.  
  102. <table>
  103. <tr>
  104. 	<td class="Content"><select name="SelectTargetLanguage2" id="SelectTargetLanguage2" size="1" onchange="OnChange_SelectTargetLanguage2" style="width: 20em;"></select></td>
  105. 	<td class="Spacer">&nbsp;</td>
  106. 	<td class="Content"><input type="text" name="Translation2" id="Translation2" style="width: 25em;" readonly></td>
  107. 	<td class="Spacer">&nbsp;</td>
  108. 	<td class="Control"><input type="button" class="Button" name="Button_SearchTranslation2" id="Button_SearchTranslation2" value="Search Wikipedia" onclick="OnClick_ButtonSearchTranslation2" disabled></td>
  109. </tr>
  110. </table>
  111.  
  112. </div>
  113.  
  114. </div>
  115.  
  116.  
  117.  
  118. <div id="TranslationBlock3" style="display: none;">
  119.  
  120. <h3><span id="Label_Translation3">Translation</span> 3</h3>
  121.  
  122. <div class="Group">
  123.  
  124. <table>
  125. <tr>
  126. 	<td class="Content"><select name="SelectTargetLanguage3" id="SelectTargetLanguage3" size="1" onchange="OnChange_SelectTargetLanguage3" style="width: 20em;"></select></td>
  127. 	<td class="Spacer">&nbsp;</td>
  128. 	<td class="Content"><input type="text" name="Translation3" id="Translation3" style="width: 25em;" readonly></td>
  129. 	<td class="Spacer">&nbsp;</td>
  130. 	<td class="Control"><input type="button" class="Button" name="Button_SearchTranslation3" id="Button_SearchTranslation3" value="Search Wikipedia" onclick="OnClick_ButtonSearchTranslation3" disabled></td>
  131. </tr>
  132. </table>
  133.  
  134. </div>
  135.  
  136. </div>
  137.  
  138.  
  139.  
  140. <div id="TranslationBlock4" style="display: none;">
  141.  
  142. <h3><span id="Label_Translation4">Translation</span> 4</h3>
  143.  
  144. <div class="Group">
  145.  
  146. <table>
  147. <tr>
  148. 	<td class="Content"><select name="SelectTargetLanguage4" id="SelectTargetLanguage4" size="1" onchange="OnChange_SelectTargetLanguage4" style="width: 20em;"></select></td>
  149. 	<td class="Spacer">&nbsp;</td>
  150. 	<td class="Content"><input type="text" name="Translation4" id="Translation4" style="width: 25em;" readonly></td>
  151. 	<td class="Spacer">&nbsp;</td>
  152. 	<td class="Control"><input type="button" class="Button" name="Button_SearchTranslation4" id="Button_SearchTranslation4" value="Search Wikipedia" onclick="OnClick_ButtonSearchTranslation4" disabled></td>
  153. </tr>
  154. </table>
  155.  
  156. </div>
  157.  
  158. </div>
  159.  
  160. <p>&nbsp;</p>
  161.  
  162. <p class="Center"><input type="button" class="Button" name="Button_Clear" id="Button_Clear" value="Clear" onclick="OnClick_ButtonClear" disabled>
  163. <!-- IE 10 messes up spans, so we use an invisible button for spacer -->
  164. <input class="Button Hidden">
  165. <input type="button" class="Button" name="Button_Help" id="Button_Help" value="Help" onclick="HelpMsg"></p>
  166.  
  167.  
  168.  
  169. <!--{{InsertControlsHere}}-Do not remove this line-->
  170. </body>
  171. </html>

page last uploaded: 2017-04-06, 13:33