AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Solved] Another Noob question from me... Iniwrite...

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
TalkieToaster



Joined: 17 Mar 2008
Posts: 15

PostPosted: Mon Apr 28, 2008 4:33 am    Post subject: [Solved] Another Noob question from me... Iniwrite... Reply with quote

I am struggling to find out how to overwrite on sertain rows in a file...

FileReadLine works perfect for me.

I Search for a command linke FileWriteLine...

Probably just me putting on the wrong search strings, but if any could help me i would appreciate it.

To make it clear, it is an .ini file where Defaults is stored, i can read it with FileReadLine good np there

But then i want the option for the user to click Save theese settings as Default, and then i want to save thoose variables to that file.

So what i search for is a command like FileOverwriteLine...

Think this is just me new at ahk and a noob question, but please answer anyway.


Last edited by TalkieToaster on Tue Apr 29, 2008 9:04 am; edited 2 times in total
Back to top
View user's profile Send private message
SomeGuy



Joined: 21 Apr 2008
Posts: 96
Location: somewhere

PostPosted: Mon Apr 28, 2008 4:36 am    Post subject: Reply with quote

search iniread and iniwrite
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Mon Apr 28, 2008 3:40 pm    Post subject: Reply with quote

is the INI file in the "standard" format?

can you post a small piece of it as an example?
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
joebodo



Joined: 28 Apr 2008
Posts: 45

PostPosted: Mon Apr 28, 2008 4:49 pm    Post subject: My code Reply with quote

Here's what I use to read/write to the ini file

Code:

STATE_READ(module, name, default="") {

   IniFile = %A_ScriptDir%\application.ini
   IniRead, var, %IniFile%, %module%, %name%

   if (var = "ERROR")
      var := default
   
   Return var
}

STATE_WRITE(module, name, var) {

   IniFile = %A_ScriptDir%\application.ini
   IniWrite, %var%, %IniFile%, %module%, %name%
}
Back to top
View user's profile Send private message
TalkieToaster



Joined: 17 Mar 2008
Posts: 15

PostPosted: Mon Apr 28, 2008 7:36 pm    Post subject: Reply with quote

Thanks all for your fast responce, Iniread and Iniwrite was just the commands i was searching for.

/TT
Back to top
View user's profile Send private message
SomeGuy



Joined: 21 Apr 2008
Posts: 96
Location: somewhere

PostPosted: Mon Apr 28, 2008 8:32 pm    Post subject: Reply with quote

I use this:
Code:
IniRead(pFile,pSection,pKey,pDefault=""){
   IniRead, Ret, %pFile%, %pSection%, %pKey%, %pDefault%
   Return Ret
   }
Back to top
View user's profile Send private message
Conquer



Joined: 27 Jun 2006
Posts: 385
Location: Canada

PostPosted: Mon Apr 28, 2008 9:54 pm    Post subject: Reply with quote

When it's solved, mark the title of the thread like this: (For easy readability)

[Solved] Thread Topic Here (Epic Win)

rather than

Thread Topic Here .. Solved (Epic Fail, like Titan's captcha. Very Happy)

Thx for listening. Cool
_________________
Back to top
View user's profile Send private message
TalkieToaster



Joined: 17 Mar 2008
Posts: 15

PostPosted: Tue Apr 29, 2008 9:06 am    Post subject: Reply with quote

KK changed it, think you are right there mate, easier to see it if Solved is in the beginning of the topic.

Thanks for your comment!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group