forums

TNT Basic Forums > Programming Q&A
How to read a preferences file?
< Last Thread     Next Thread >
Author
Thread        Post A Reply

09-27-2006 12:57

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

How to read a preferences file?
My code doesn't work.... As you can see, I tried setting "Type" to "Text", but it doesn't work... Neither does finding the file's type and then using it. It says the type is longer than 4 characters.. >< help? Thanks...
[code]Set Directory User Preferences
str preferences

if File Exists ("InterPlanetaryWarfare:Preferences")
'preferences=File Read String (ask open file(true,"TEXT","TEXT"))
'print preferences
preferences=File Read String (open file (":InterPlanetaryWarfare:Preferences",true,"TEXT","TEXT"))
print preferences
else

end if
[/code]

09-27-2006 13:56

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

After reading the forums...
it worked, only if I used "pref". So, what are the file type name for "TEXT", (which doesnt work)?

09-27-2006 14:22

Posted by:
Orteil

Location:
Somewhere in France

Find more posts by Orteil

I had tried many things and it worked with
"TEXT","text"
I'm almost sure you have to type it with the right upper and lower case.
It's a pretty weird system; once I tried something and it created an Illustrator file with a text layer displaying the string I saved !

09-27-2006 17:27

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

"It's a pretty weird system; once I tried something and it created an Illustrator file with a text layer displaying the string I saved !"

Not so weird, it's probably simply that Illustrator can read text files ;)

09-27-2006 20:20

Posted by:
Orteil

Location:
Somewhere in France

Find more posts by Orteil

Well, I couldn't read it with anything else !

09-28-2006 08:58

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

Thanks.... but tnt can only open text files it had created it self. How do you open files with type "document"?

When I modify a file with TextEdit, its type becomes "document", not text, even though its plain text already. Can some one make an TNT app that can make files text?

09-28-2006 09:41

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

I am forced to use script editor....

09-28-2006 12:22

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

hum, i remember being able to edit files, but it was way back on os 9... maybe try 'hex edit'

file i/o in tnt is to improve a lot, i believe

10-21-2006 04:53

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

Dammit... I hit this snag again... I need to be able to open text document files... Whats the 4 letter type for that?

10-21-2006 05:20

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

hehehe.... I put the ability to save as pure text into my tbEdit app...

but it also means I can no longer save with fonts/colors...

10-21-2006 14:02

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

"it also means I can no longer save with fonts/colors..."

ohh that wa why it wasn't working ;) pure text can't include fonts/color

10-21-2006 22:17

Posted by:
appleide

Click Here to Email appleide   Find more posts by appleide

But in Textedit, even if you type in plain text it doesnt save as "text", but as "plain text", which is not TEXT. So you can not use Text Edit even without fonts and colours.

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.