How to resolve the algorithm Rosetta Code/Find unimplemented tasks step by step in the VBScript programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Rosetta Code/Find unimplemented tasks step by step in the VBScript programming language

Table of Contents

Problem Statement

Given the name of a language on Rosetta Code, find all tasks which are not implemented in that language.

Note: Implementations should allow for fetching more data than can be returned in one request to Rosetta Code. You'll need to use the Media Wiki API, which you can find out about locally, here, or in Media Wiki's API documentation at, API:Query

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Rosetta Code/Find unimplemented tasks step by step in the VBScript programming language

Source code in the vbscript programming language

Set http= CreateObject("WinHttp.WinHttpRequest.5.1")
Set oDic = WScript.CreateObject("scripting.dictionary")

start="https://rosettacode.org"
Const lang="VBScript"
Dim oHF 

gettaskslist "about:/wiki/Category:Programming_Tasks" ,True
print odic.Count
gettaskslist "about:/wiki/Category:Draft_Programming_Tasks",True
print "total tasks " & odic.Count
gettaskslist "about:/wiki/Category:"&lang,False
print "total tasks  not in " & lang & " " &odic.Count & vbcrlf
For Each d In odic.keys
   print d &vbTab &  Replace(odic(d),"about:", start)
next
WScript.Quit(1)

Sub print(s): 
  On Error Resume Next
  WScript.stdout.WriteLine (s)  
  If  err= &h80070006& Then WScript.echo " Please run this script with CScript": WScript.quit
End Sub 

Function getpage(name)
  Set oHF=Nothing
  Set oHF = CreateObject("HTMLFILE")
  http.open "GET",name,False  ''synchronous!
  http.send 
  oHF.write ""
  oHF.body.innerHTML = http.responsetext 
  Set getpage=Nothing
End Function

Sub gettaskslist(b,build)
  nextpage=b
  While nextpage <>""
  
    nextpage=Replace(nextpage,"about:", start) 
    WScript.Echo nextpage
    getpage(nextpage)
    Set xtoc = oHF.getElementbyId("mw-pages")
    nextpage=""
    For Each ch In xtoc.children
      If  ch.innertext= "next page" Then 
        nextpage=ch.attributes("href").value
        ': WScript.Echo nextpage
      ElseIf ch.attributes("class").value="mw-content-ltr" Then
        Set ytoc=ch.children(0) 
        'WScript.Echo ytoc.attributes("class").value  '"mw-category mw-category-columns"
        Exit For
      End If   
    Next
    For Each ch1 In ytoc.children 'mw-category-group
      'WScript.Echo ">" &ch1.children(0).innertext &"<"
      For Each ch2 In ch1.children(1).children '"mw_category_group".ul
        Set ch=ch2.children(0)
        If build Then
           odic.Add ch.innertext , ch.attributes("href").value
        else    
           if odic.exists(ch.innertext) then odic.Remove ch.innertext
        End if   
           'WScript.Echo ch.innertext , ch.attributes("href").value
      Next 
    Next
  Wend  
End Sub

  

You may also check:How to resolve the algorithm Amicable pairs step by step in the GFA Basic programming language
You may also check:How to resolve the algorithm Even or odd step by step in the МК-61/52 programming language
You may also check:How to resolve the algorithm Arithmetic/Integer step by step in the DCL programming language
You may also check:How to resolve the algorithm Write language name in 3D ASCII step by step in the Nim programming language
You may also check:How to resolve the algorithm Loops/Continue step by step in the Oz programming language