Help With a Length Formula
Author |
Message |
Guest
|
Posted: Sat May 27, 2006 9:59 am Post subject: Help With a Length Formula |
|
|
Ok I got this program here that I am creating, it's kinda pointless, but I can see it being for some use in the future. But I'm having trouble determining a formula involving the length of a message. Here is my code:
code: |
var window1 := Window.Open ("title: Website Orgainizer")
var fileID, connection : int
var msg, address, IP : string
var name := "Website's IP's.txt" %text file
put "Enter the address you wish to retrieve their hosts IP address."
get address %address to connect to
if File.Exists (name) then
open : fileID, name, get
loop
exit when eof (fileID)
get : fileID, msg : * %gets all information from the text file
end loop
close : fileID
end if
open : fileID, name, put, get, mod
loop
exit when eof (fileID)
get : fileID, msg
if (msg = address) then %checks the address variable if it's already been entered
close : fileID
Window.Close (window1)
var window2 := Window.Open ("title:Display Websites")
open : fileID, name, get
loop
exit when eof (fileID)
get : fileID, msg : *
for i : 5 .. 8 %used to read 4 matching characters
if msg (i) = address (i) and msg (i + 1) = address (i + 1) then
colour (brightred)
else
colour (black)
end if
end for
put msg
end loop
close : fileID
return %returns true if address was entered
end if
end loop
connection := Net.OpenConnection (address, 25) %if address wasn't entered then connects and enters it
IP := Net.HostAddressFromName (address)
if not (IP = "") then %determines if the site exists before recording it
locate (2, 1)
put ""
put address, " = ", IP
put : fileID, address, " = ", IP
put "Address successfully entered!"
else
put "Address does not exist!"
end if
|
The problem is where the for i : 5 .. 8 is, instead of 8, i wish to have it like this for i : 5 .. length(msg), or something of that matter. I tried for i : 5 .. length (msg) - 21, but then when I had two websites, I think it was putfile and hotmail, they both highlighted! Help would be highly appreciated. It may be small, but if you enter a website with 1 letter, it gives an error. Plus I want it to be more automated like .
If you wish to have less lag when entering an address, download the attached file with a list of websites and IP's, save the program, and then place the text file in the same place where you saved the Turing program. Then enter any of the website's pre-listed in my file.
WARNING: May lag up computer while entering a new address. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Guest
|
Posted: Sat May 27, 2006 10:31 am Post subject: (No subject) |
|
|
In addition, when it's connecting, I want to put a message "Connecting to website . . ." and have the 3 dots moving while it's connecting. I tried a process but that didn't work.
When the list is full of addresses, it starts to remove the one at the top because it scrolls down, but there's no scroll bar. But if I have the screen in text mode, I cannot have colours. Is there a way to colour in text mode, or making a scroll bar for non-text mode? And I don't mean making like a PicScroll or whatever, just a normal blue scroll bar.
Also this forumla I am requesting is needed, because if I type www.google.ca and I already have www.google.ca and www.google.com entered, it will highlight both of them, since it checks for goog, the 4 letters... Thanks |
|
|
|
|
|
|
|