Page 1 of 1 1
Topic Options
#44519 - 2003-08-26 08:30 AM simple question (variable, write ini file )
Gremlin010 Offline
Fresh Scripter

Registered: 2003-08-26
Posts: 8
Hi all,
i have 3 simple point i cant program to my own.

1. I have a Question to the User !

?"How old are you ? example 25 = "

2. This nummber i want to save in a variable.

Gets $age

3. Now i want to save this variable in a text or ini file. Here is my main problem, i tried writeline, writeprofilestring and others but nothing happens. It´s possible that my "gets" is wrong ?
I´m afraid its a very simple syntax.

Thank you for helping me with my first stepps in kix programming.

Best regards
Gremlin

Top
#44520 - 2003-08-26 08:44 AM Re: simple question (variable, write ini file )
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, why don't you post what you have tried?
this way we don't feed you with ready code, if you know what I mean [Wink]
_________________________
!

download KiXnet

Top
#44521 - 2003-08-26 08:48 AM Re: simple question (variable, write ini file )
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Hello Gremlin and welcome to the board.

Please take some time and review the Manual that ships with KiXtart as well as the FAQ section on this board. It should prove to be very helpful in getting you started with KiXtart.

Here is an example that you can display in a DOS console window. Then writing to file is easy.

Please let us know if you need further assitance.

The $age var now holds what ever the user types in until they hit the enter key. However, this code does not check for invalid input but KiX does support validation checking as well.


break on
? 'What is your age? Please type in your age and then press the enter key ' ?
gets $age
? 'You entered '+$age

Top
#44522 - 2003-08-26 09:08 AM Re: simple question (variable, write ini file )
Gremlin010 Offline
Fresh Scripter

Registered: 2003-08-26
Posts: 8
WOOW this forum works fast *happy*
Thank u for helping me.

I think i read every fac abaout variable and write in files, but i´m afriad im only a stupid beginner. I dont want i complet programm i think i need only help with the syntax of my programm.

here my trys:
Please dont laugh [Smile]

My stupid simple script i cant program :/

?"How old are U ?? example 25 = "

Gets $age

$file= "t:\age.ini"
$rc=WriteProfileString($file, "$age")

or

WriteLine("t:\age.ini","$age")

shame on me :/

best regards

Gremlin

Top
#44523 - 2003-08-26 09:14 AM Re: simple question (variable, write ini file )
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Gremlin... relax guy. No one wanting to beat you up for being new and not understanding. Some guys get a little "short on manners" when someone shows or continues to show they don't take the time to read the manual or FAQs.

We all had to start out new at some time.

Anyways... please take a look at this post for more information on using an INI file.
Also, please take the time and read at least some of the FAQs here on Korg.

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=007101

Top
#44524 - 2003-08-26 09:45 AM Re: simple question (variable, write ini file )
Gremlin010 Offline
Fresh Scripter

Registered: 2003-08-26
Posts: 8
Thank u !
I must be blind. The Link works great.

now i use a ini file
[MyHeader]
age=

and the script

?"How old are u ? z.B 25 = "

Gets $age

Break On
$File="t:\text.ini"
If EXST $File
$nul=WRITEPROFILESTRING ("$File", "MyHeader", "age", "$age")

ELSE
? 'Unable to locate file '+@ERROR +' '+@SERROR
Endif

and it works [Frown] )

Thanks a lot

best regards
Gremlin

Top
#44525 - 2003-08-26 10:08 AM Re: simple question (variable, write ini file )
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Cool

Just a minor note. The "MyHeader" name can be anything you want. It was just an example.

For future postings with code please use either the [CODE] Tags to maintain your code layout or PostPrep.

There is a link in my signature for PostPrep.
Very cool app by Lonkero and Jochen for posting code to Korg.

Top
#44526 - 2003-08-26 02:30 PM Re: simple question (variable, write ini file )
Gremlin010 Offline
Fresh Scripter

Registered: 2003-08-26
Posts: 8
1. question solved 1000 new questions are open [Smile]

How i write in a blank file .
In the moment my file looks like this

[CODE]
[MyHeader]
age=25

but how i get only the 25 in my file ?
i tried this->

[CODE]
$nul=WRITEPROFILESTRING ("$File", "", "", "$age")

but it does´nt work [Frown]

any tips for me ?

best regard
Gremlin

Top
#44527 - 2003-08-26 04:32 PM Re: simple question (variable, write ini file )
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
code:
 
Break On
$File="t:\text.ini"
$nul=open(1, $File, 5)
$nul = writeline(1, $age + @crlf)
$nul = close(1)

_________________________
Eric

Top
#44528 - 2003-08-26 05:07 PM Re: simple question (variable, write ini file )
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
gremlin, with the code-tags he ment pressing the  - button and placing your code between the tags [Wink]
_________________________
!

download KiXnet

Top
#44529 - 2003-08-27 10:22 AM Re: simple question (variable, write ini file )
Gremlin010 Offline
Fresh Scripter

Registered: 2003-08-26
Posts: 8
Thank u maciep

it works [Smile]

best regards
Gremlin

Top
#44530 - 2003-08-28 12:41 AM Re: simple question (variable, write ini file )
Gremlin010 Offline
Fresh Scripter

Registered: 2003-08-26
Posts: 8
I´m back sorry

everything works good but now i have a new problem with my syntax.

How i write more as 1 variable in a row split by ",".

I try this:
code:
Break On
$File="t:\text.ini"
$nul=open(1, $File, 5)
$nul = writeline(1, $age,$name,$city + @crlf)
$nul = close(1)

But program said i need "(".
The ini-file should be
25,John,Houston,
`cause i wanted to make a xls evaluation.

Hope this is my last question for this week,
but i believe i will be back soon.

best regards
Gremlin

Top
#44531 - 2003-08-28 12:44 AM Re: simple question (variable, write ini file )
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
quess you should read some of the manual or the starters guide in faq...
over even try out... [Wink]

anyway:
code:
$nul = writeline(1, $age  + "," + $name + "," + $city + @crlf)

cheers
_________________________
!

download KiXnet

Top
#44532 - 2003-08-28 12:45 AM Re: simple question (variable, write ini file )
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
btw,
as you still keep talking about ini, you should not use writeline but writeprofilestring.
_________________________
!

download KiXnet

Top
#44533 - 2003-08-27 03:32 PM Re: simple question (variable, write ini file )
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Or use a txt file instead of an ini. All depends on what you want.
_________________________
Eric

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 557 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.07 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org