Sign in to follow this  
Followers 0
tW34k

Using variables in iniwrite name possible?

10 posts in this topic

Just wondering if there is any way too use variables in the output filename.ini?

Like:

#include <Date.au3>

$2 = _nowcalc()

IniWrite ( @ScriptDir & "\files\Logg\$2.ini", "section", "key", "value" ) like that? (Obviously this doesn't work as I've tried it but you get the idea)

So, instead of "logg.ini" it would be "current time (_nowcalc)".ini

I am very new too autoit so please, help!

Pat.

Share this post


Link to post
Share on other sites



Should work like this:

#include <Date.au3>
$2 = _nowcalc()
IniWrite ( @ScriptDir & "\files\Logg\"&$2&".ini", "section", "key", "value" )

Share this post


Link to post
Share on other sites

It won't write any .ini with that script. Weird stuff.

Share this post


Link to post
Share on other sites

I'm pretty sure that the result of _NowCalc() usese illegal file name chars <_<


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Haha, my thoughts exactly. <_< My bad, sorry.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Haha, I didn't think of that. I'm going too see if I can work this out then.

Hell yea! I just took the _nowcalc function from the date.au3 and edited it inside my script so I won't need too include date.au3

Thanks for help=)

Edit:

How can I add more keys in one iniwrite command? Is that possible?

Like:

[section]

Key1=value1

Key2=value2

Key3=value3

Is that possible by only using the iniwrite command once?

Edited by tW34k

Share this post


Link to post
Share on other sites

I don't think so.. although you could use it just once inside a loop:

For $i=1 To 10
    IniWrite("MyIni.ini","Section","Key"&$i,"Value"&$i)
    Sleep(25);Just in case :P
Next

Share this post


Link to post
Share on other sites

Ok, I don't get that haha. Thanks anyway though, I guess one key will be enough.

Share this post


Link to post
Share on other sites

But didn't that do what you wanted? All it does is call IniWrite() 10 times and increase the value of $i every loop. This is what the ini looks like.

[Section]
Key1=Value1
Key2=Value2
Key3=Value3
Key4=Value4
Key5=Value5
Key6=Value6
Key7=Value7
Key8=Value8
Key9=Value9
Key10=Value10

Share this post


Link to post
Share on other sites

I see. Allright, I will try it. Thanks alot!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0