Hello! First of many stupid questions 8-)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Hello! First of many stupid questions 8-)
Hello. I'm a Visual Basic coder with 30 years IT experience, mental issues, and senility.
I want to read from a file containing 4-letter words:
abed
abet
able...
into a String:
open file specialFolderPath("desktop") & "/CatsDogs.txt" for read
read from file specialFolderPath("desktop") & "/CatsDogs.txt" until eof
put it into tAnswer
answer tAnswer
No joy 8-(
I want to read from a file containing 4-letter words:
abed
abet
able...
into a String:
open file specialFolderPath("desktop") & "/CatsDogs.txt" for read
read from file specialFolderPath("desktop") & "/CatsDogs.txt" until eof
put it into tAnswer
answer tAnswer
No joy 8-(
Re: Hello! First of many stupid questions 8-)
If you are going to read in the whole file in one go, the simple syntax is
Code: Select all
put url ("file:" & specialFolderPath("desktop") & "/CatsDogs.txt") into tAnswer
Re: Hello! First of many stupid questions 8-)
Ok Thanks. Will try that. Then I can Randomize an entry based on the length of tAnswer/4 

Re: Hello! First of many stupid questions 8-)
Nope. This doesn't work:
put url ("file:" & specialFolderPath("desktop") & "/CatsDogs.txt") into tAnswer
answer tAnswer
put url ("file:" & specialFolderPath("desktop") & "/CatsDogs.txt") into tAnswer
answer tAnswer
Re: Hello! First of many stupid questions 8-)
OK worked it out. The FilePath was wrong. But I didn't get a "File Not Found" 8-(
Re: Hello! First of many stupid questions 8-)
Code: Select all
open file specialFolderPath("desktop") & "/CatsDogs.txt" for read
put the result
Knowledge is meant to be shared.
Re: Hello! First of many stupid questions 8-)
Same for the URL syntax:
...
put url ("file:" & specialFolderPath("desktop") & "/CatsDogs.txt") into tAnswer
answer the result
...
"the result" will be empty on success!
...
put url ("file:" & specialFolderPath("desktop") & "/CatsDogs.txt") into tAnswer
answer the result
...
"the result" will be empty on success!