Page 1 of 1 1
Topic Options
#17610 - 2002-02-18 11:32 PM ?Change an INI file on the fly?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Here is a good one.. I need to edit an ini file on the fly.

Let say for example that the ini file is at \\server\share\file.ini and that the file contains various settings... I want to change the setting for DBNAME=

After the DBNAME= it could be anything.. I need to be able to modify that so basically echo a variable into that slot after the = and clear out whatever else is left in case the new name is shorter.. make sense?

Can anyone offer advice?

Thanks for the help in advance.

_________________________
Austin Henderson

Top
#17611 - 2002-02-19 12:10 AM Re: ?Change an INI file on the fly?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
$RC = WriteProfileString("\\server\share\file.ini","section", "DBNAME", $WhatEverThisNeedBe )
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#17612 - 2002-02-19 12:47 AM Re: ?Change an INI file on the fly?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
You are the coolest.. I will try
_________________________
Austin Henderson

Top
#17613 - 2002-02-19 12:56 AM Re: ?Change an INI file on the fly?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
We all think Les is very cool [even though he is from Fort Frances, Ontario]

We think Les's new sig should be:

"You get more, with Les!"

Les is also known for having a great sense of humour !

-Shawn

Top
#17614 - 2002-02-19 04:05 AM Re: ?Change an INI file on the fly?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
More or Les

hehe We love ya Les or is that MORE?

Top
#17615 - 2002-02-19 04:15 AM Re: ?Change an INI file on the fly?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
No Les ?

No More ?

Top
#17616 - 2002-02-19 04:17 AM Re: ?Change an INI file on the fly?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
So then that would be

JUST THE SAME if not Les or More?

Top
#17617 - 2002-02-19 05:21 AM Re: ?Change an INI file on the fly?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
rofl mol
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#17618 - 2002-02-19 04:59 PM Re: ?Change an INI file on the fly?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
how about if I want to read in a variable that I will put back out into this ini file... get simply reads in one character.

HELP

Thanks

_________________________
Austin Henderson

Top
#17619 - 2002-02-19 05:04 PM Re: ?Change an INI file on the fly?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
I should qualify... a string that I want to read in.

Thanks

_________________________
Austin Henderson

Top
#17620 - 2002-02-19 05:26 PM Re: ?Change an INI file on the fly?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Come on,
I know reading manuals is tough, but you're a "Network Administrator" - you know hardship.

The next command in the manual after "Get" is...

Top
#17621 - 2002-02-19 06:00 PM Re: ?Change an INI file on the fly?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Austin,
If you are dicouraged from reading the doc that ships with KiX, try the html version from http://www.scriptlogic.com/kixtart/

It is so easy to use, you'll woder how you ever did without it.

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#17622 - 2002-02-19 06:28 PM Re: ?Change an INI file on the fly?
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Be nice guys... Nowhere in the manual does it say that you have to read the manual... Of course, you'd have to read the manual to know that you don't have to read the manual.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#17623 - 2002-02-19 06:49 PM Re: ?Change an INI file on the fly?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
I suppose I have hit a nerve by asking questions on a board designed for such. I will look into the manual for the answers that I am needing.

Thank you all for your help.

_________________________
Austin Henderson

Top
#17624 - 2002-02-19 07:13 PM Re: ?Change an INI file on the fly?
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
now now.. don't get upset (or snippy) I have been using kix for over 2 years, and I read the manual EVERY day. It takes up half the space of my desk, and almost every day I have to move it to get my keys so I can go home.

No one here minds any one asking questions, however sometimes it seems that there are 4 kinds of questions\posters here.

1> I'm stuck and I can't figure this out.

2> Will kix perform some action that I need to accomplish

3> Will someone write my logon script for me

4> can someone use the jedi mind trick on me to determine what I want AND then write my script for me

Without pointing any fingers, nor assigning blame, sometimes it annoys some people when it seems that someone isn't even TRYING to figure out their code problems.

My patience isn't the greatest thing either, and I have mortally offended many of my users with my attitude toward their obvious and plentiful shortcomings.

Don't get pissed, just try a tad bit harder to not post questions that are BLATANTLY obvious with even a casual review of the manual.

With that in mind... I wonder if Shawn can patch together a method to have Merlin Read the manual to new users..
.

[ 19 February 2002: Message edited by: Radimus ]

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#17625 - 2002-02-19 07:23 PM Re: ?Change an INI file on the fly?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
wha ? you mean like this ?

break on

$merlin_path = "%windir%\msagent\chars\merlin.acs"

$agent = createobject ("agent.control.2")

$agent.connected = "1"

$= $agent.characters.load("merlin","$merlin_path")

$merlin = $agent.characters.character("merlin")

$= $merlin.moveto(400,200)

$= $merlin.show()

$wait = $merlin.play("announce" )

if $wait do sleep 1 until $merlin.wait($wait) <> 0 endif

$manual = "
Implicit declaration
Variables don’t have to be declared before they
can be used. You can also implicitly declare them
simply by assigning a value to them. Note that all
variables that are declared in this way have a global
scope (see below for details on scope).

Scope of variables
Depending on how and where they are declared,
variables can have a local or a global scope.
Variables with a global scope are visible anywhere
in any script during the entire KiXtart session.
Variables with a local scope are only visible to the
script or script segment in which they were created.
"

$wait = $merlin.speak("$manual")

if $wait do sleep 1 until $merlin.wait($wait) <> 0 endif

exit 1

Oh yeah and Austin ... don't sweat it my friend ... you keep posting whatever questions you think need to be posted ... and when someone tells you to read the manual, just go read the manual ... and if you still have questions, post another one !

-Shawn

[ 19 February 2002: Message edited by: Shawn ]

Top
#17626 - 2002-02-19 07:35 PM Re: ?Change an INI file on the fly?
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
I am not meaning to be upset or snippy as you stated. I am simply stating a fact that I appreciate the help I have been given.. note my immediate response to the sugguestion given by LLigetfa. I understand that your patience level may not be the best and I am sorry for trying that level... however I was taught that if you have nothing good to say then simply say nothing. I do not recall posting an email to you on this topic.. although you have helped me on other topics all of which I was very grateful.. basically all that I am saying is that I did not force you to answer the question or even to read the question. You monitor this board because you are good.. you know the stuff.. and this is a good thing. This is the best BB I have seen in some time... but if you are frustrated by a request simply move on.. venting frustration offers nothing to further this board.. only hinder future posts and this the development of the product. At any rate I appreciate the wonderful help you have given me.. I will look into the manual more in the future.

Thank you for your time... and Shawn thank you for the humor and professionalism you have used in your responses.

_________________________
Austin Henderson

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
1 registered (mole) and 598 anonymous users online.
Newest Members
Raoul, Timothy, Jojo67, MaikSimon, kvn317
17875 Registered Users

Generated in 0.152 seconds in which 0.106 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