Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: gwbasic to vb  (Read 14158 times)

0 Members and 1 Guest are viewing this topic.

Salmon Trout

  • Guest
Re: gwbasic to vb
« Reply #30 on: April 08, 2012, 04:09:41 AM »
That last screen capture you posted has helped a lot, I've got a pretty good idea of what is needed now.

topsy99

    Topic Starter


    Beginner

    Re: gwbasic to vb
    « Reply #31 on: April 08, 2012, 04:45:05 PM »
    it is relatively straight forward my programming probably messy but it worked.

    you put in a name it checks the dat file to see if it is there it adds the end number by taking from 9 and adds them together. e.g. the same name may be in there 20 times and it adds 20 numbers or it may not be there at all. etc.
    thanks for looking at it for me.
    regards

    topsy99

      Topic Starter


      Beginner

      Re: gwbasic to vb
      « Reply #32 on: April 10, 2012, 04:49:54 AM »
      any news.

      Salmon Trout

      • Guest
      Re: gwbasic to vb
      « Reply #33 on: April 11, 2012, 01:42:08 PM »
      Code: [Select]
      Const ForReading = 1
      Wscript.StdOut.Write "Please input Filename:     "
      FileName = Wscript.StdIn.ReadLine
      Do Until UCase(SearchHorseName)="XXX"
      Wscript.StdOut.Write "Search Name or XXX to end: "
      SearchHorseName = Wscript.StdIn.ReadLine
      e=0
      q=0
      R=0
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set objInputFile = objFSO.OpenTextFile(FileName, ForReading)
      Do until objInputFile.AtEndofStream
      strHorseData = objInputFile.ReadLine
      q = q + 1
      strHorseData = Replace(strHorseData, Chr(34),"")
      If Left(strHorseData,LEN(SearchHorseName))=SearchHorseName Then
      wscript.echo strHorseData & " " & q
      Fstring = Left(Strhorsedata,9)
      strHorseData = Replace(strHorseData, ")(",",")
      strHorseData = Replace(strHorseData, "(",",")
      strHorseData = Replace(strHorseData, ")",",")
      ArrData=split(strHorseData,",")
      HorseName = ArrData(0)
      EndNumber = Val(ArrData(5))
      e=e+1
      If EndNumber > 0 Then EndNumber = 9- EndNumber
      R=R+EndNumber
      wscript.echo R & " " & e
      End If
      Loop
      objInputFile.Close
      wscript.echo Fstring & " " & R
      Loop
      Wscript.Quit

      Function Val(vValue)
      If len(vValue) = 0 then
      lResult = 0
      else
      if isnumeric(vValue) then
      lResult = cdbl(vValue)
      else
      lCount = 1
      do until (isnumeric(mid(vValue,lCount,1))=false) or (lCount > len(vValue))
      strResult = strResult & mid(vValue, lCount, 1)
      lCount = lCount + 1
      loop
      if len(strResult) = 0 then
      lResult = 0
      else
      lResult = cdbl(strResult)
      end if
      end if
      end if
      Val = lResult
      End Function

      save this as e.g. HorseAnalyse.vbs and run it like so from the prompt

      cscript //nologo HorseAnalyse.vbs

      The .dat file (e.g. Horse.dat) needs to be in the same folder

      Please give it a go and let me know if it works OK or if not what it does wrongly





      topsy99

        Topic Starter


        Beginner

        Re: gwbasic to vb
        « Reply #34 on: April 11, 2012, 05:08:21 PM »
        success. you are a genius.    I can do it now on windows 7 64 bit   (although i have only run on 32 bit vista so far.)  but you have done well.

        where can i send an easter card to.



        do you know that down here in Tasmania i dont know any programmers.  they seem to be scarce as hen's teeth.

        regards and very greatful to you.