Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  2008  Scripting  Games  Advanced  VBScript  Event  1  

 Content of 2008 Scripting Games Advanced VBScript Event 1.vbs
MD5 Hash: 96169D7C49555BA7AC5494B68BAFB974
' This is my Solution for the Scripting Games 2008
' For more Information look at
' http://www.microsoft.com/technet/scriptcenter/funzone/games/games08.mspx

Option Explicit

Dim ofso : Set ofso = Createobject("Scripting.FileSystemObject")
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8


Call Main()


' ---------------------------------------
Sub Main()

Dim arrWords, iCount

Dim iPhoneNumber : iPhoneNumber = InputBox("Could I Get Your Phone Number?","Your Phone Number?")

Select Case iPhoneNumber

Case false

Case Else

If iPhoneNumber > "" then

arrWords = ReadFileToArray("C:\Scripts\wordlist.txt")

If IsArray(arrWords) then

For iCount = 0 to UBound(arrWords)

If ConvertWords(arrWords(iCount)) = iPhoneNumber then

Msgbox arrWords(iCount)
Exit For

End if

Next

End if

End if
End Select

Set ofso = nothing

End Sub


' ---------------------------------------
Private Function ReadFileToArray(strFile)

Dim strNextLine, arrstrList
Dim arrLines()
Dim iCount : iCount = 0

If ofso.FileExists(strFile) then

Dim oFile : Set oFile = ofso.OpenTextFile(strFile, ForReading)

Do Until oFile.AtEndOfStream

Redim Preserve arrLines(iCount)
arrLines(iCount) = oFile.ReadLine
iCount = iCount + 1

Loop

oFile.Close

End if

Set oFile = nothing

If IsArray(arrLines) then ReadFileToArray = arrLines

End Function


' ---------------------------------------
Private Function ConvertWords(strWord)

Dim iCount, strLetter
Dim strNumber : strNumber = ""

If Len(strWord) = 7 then

For iCount = 1 to Len(strWord)

strLetter = UCase(Mid(strWord, iCount, 1))


Select Case strLetter

Case "A","B","C"
strNumber = strNumber & "2"

Case "D","E","F"
strNumber = strNumber & "3"

Case "G","H","I"
strNumber = strNumber & "4"

Case "J","K","L"
strNumber = strNumber & "5"

Case "M","N","O"
strNumber = strNumber & "6"

Case "P","R","S"
strNumber = strNumber & "7"

Case "T","U","V"
strNumber = strNumber & "8"

Case "W","X","Y"
strNumber = strNumber & "9"

End Select

Next

End if

If strNumber > "" then ConvertWords = strNumber

End Function


   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a