If Left(HerNum,3) = "863" then MsgBox("BLAH") End if
that never worked so I thought about using a File System object to create a text file and then read it.. but I'm lost on how to save it to a variable to later compare if that 3 digit number is the right area code.
Here is my code so far...
On Error Resume Next 'PHONE NUMBER PLEASE :D/> 'Created by McLovin ' Create the objects that we'll be using.. Set Shell = WScript.CreateObject("WScript.Shell") 'Got to get access to them FILES :o/> Set FSO = WScript.CreateObject("Scripting.FileSystemObject") 'This will more than likely come in handy later :D/> Set NET = WScript.CreateObject("WScript.Network") ' Lets get our user directory User = Shell.ExpandEnvironmentStrings("%USERPROFILE%") 'Why not grab this one too, may need it... WindowsHome = Shell.ExpandEnvironmentStrings("%WINDIR%") 'Let get to know eacho other a little Gname = InputBox("What's your name?", Name) 'Lets Woo her MsgBox("What a pretty name, "+Gname) 'Set our loop Do Until Len(HerNum) >= 10 And Len(HerNum) < 12 'Shoot to kill HerNum = InputBox("What is your number?") if Len(HerNum) <= 9 then MsgBox("Please enter a full 10 diget number") End if 'MsgBox(Mid(HerNum, 2, 1)) 'We don't like fake nubers nor random numbers.. if Left(HerNum,3) <> "863" then MsgBox'what' End if 'Check if it is fake or not.. I could get Len() nor Left() etc to work :(/> 'Create a test file witch will get deleted Set Cfile = FSO.CreateTextFile( User + "\Desktop\real.txt", True ) Cfile.write(Left(HerNum,3)) Cfile.Close 'Read the test file Set Rfile = objFSO.OpenTextFile(User + "\Desktop\real.txt", 1) ExecuteGlobal Area = Rfile.ReadAll Rfile.close if Area = "123" then MsgBoxStyle.Critical("Wrong Area Code!") End if if Len(HerNum) > 12 then MsgBox'Number is too long' End if 'if Mid(HerNum, 1, 1) <> "8" And Mid(HerNum, 2,1 ) <> "6" then 'MsgBox'Fake numbers are not talerated!' 'End if loop 'Now lets save our # in our phonebook Set Dial = FSO.CreateTextFile( User + "\Desktop\PhoneBook.txt", True ) Dial.Write (Gname+"'s number is: "+HerNum) Dial.WriteLine ("") Dial.Close ' Clean up Set Shell = Nothing Set FSO = Nothing Set NET = Nothing ' Done!
If any one could help or point me into the right direction, thanks