Possible $findfile bug, alphabetic script - 14/11/14 12:52 PM
Hi there. I was a bit interested in Sparkz' post about making ini files in alphabetic order, so I decided to give it a try.
I have no idea how to work with /window or /filter so I can't create something like the famous Top 10 script:Thus I decided to use files and use the built-in windows alphabetical system.
Here's the script I made:
Result:Expected result:Note that this is accomplishable if I manually enter the 13th line replacing %file with the proper value.With this information I figured that there's probably a bug with $findfile not properly working when the same script created the file.
Tested using a fresh portable client as well, same result:
Now, if anyone would like to post a "real" version of this script using /filter and /window, I'd definitely appreciate it. I'd like to first and foremost study it and create scripts around it, as well as actually use the script.
Edit: I have tried using the script with a timer 1 5 before the $findfile without success as well. The timer starts and halts properly but nothing comes out of it.
I have no idea how to work with /window or /filter so I can't create something like the famous Top 10 script:
Click to reveal..
Here's the script I made:
Code:
on *:text:!organize &:#Nillen: { set %call # | organize $2- } ;Usage: /organize <file> ;/fill is used to rewrite the test.ini file to values used alias organize { if (!$1) { act Please specify a file. | halt } var %file $qt($1-) if (.ini !isin %file) { act This script only works with ini files. | halt } if ($ini(%file,0)) var %secs $v1 else { act Couldn't find specified file. %file | halt } if (!$isdir(temp)) mkdir temp handle_ini temp %file noop $findfile(temp\,*.ini,0,handle_ini %file $qt($1-)) unset %call } alias act { if (%call) msg $v1 $1- else echo -a $1- } alias fill { .remove test.ini writeini test.ini Loka Water Lemon writeini test.ini Bonaqua Water Natural Light Carbonation writeini test.ini Ramlösa Water Natural } alias handle_ini { tokenize 32 $1- var %file $2 var %secs $ini(%file,0) while (%secs) { var %sec $ini(%file,%secs) var %destination $iif($1 == temp,$+(temp\,%sec,.ini),$v1) var %items $ini(%file,%sec,0) while (%items) { var %item $ini(%file,%sec,%items) var %value $readini(%file,%sec,%item) writeini %destination %sec %item %value act wrote %destination %sec %item %value dec %items } dec %secs } .remove %file }
Result:
Quote:
[13:40] <Eepa> !organize test.ini
[13:40] <~Nillen> wrote temp\Loka.ini Loka Water Lemon
[13:40] <~Nillen> wrote temp\Ramlösa.ini Ramlösa Water Natural
[13:40] <~Nillen> wrote temp\Bonaqua.ini Bonaqua Water Natural Light Carbonation
[13:40] <~Nillen> wrote temp\Loka.ini Loka Water Lemon
[13:40] <~Nillen> wrote temp\Ramlösa.ini Ramlösa Water Natural
[13:40] <~Nillen> wrote temp\Bonaqua.ini Bonaqua Water Natural Light Carbonation
Quote:
[13:40] <Eepa> !organize test.ini
[13:40] <~Nillen> wrote temp\Loka.ini Loka Water Lemon
[13:40] <~Nillen> wrote temp\Ramlösa.ini Ramlösa Water Natural
[13:40] <~Nillen> wrote temp\Bonaqua.ini Bonaqua Water Natural Light Carbonation
[13:40] <~Nillen> wrote test.ini Bonaqua Water Natural Light Carbonation
[13:40] <~Nillen> wrote test.ini Loka Water Lemon
[13:40] <~Nillen> wrote test.ini Ramlösa Water Natural
[13:40] <~Nillen> wrote temp\Loka.ini Loka Water Lemon
[13:40] <~Nillen> wrote temp\Ramlösa.ini Ramlösa Water Natural
[13:40] <~Nillen> wrote temp\Bonaqua.ini Bonaqua Water Natural Light Carbonation
[13:40] <~Nillen> wrote test.ini Bonaqua Water Natural Light Carbonation
[13:40] <~Nillen> wrote test.ini Loka Water Lemon
[13:40] <~Nillen> wrote test.ini Ramlösa Water Natural
Code:
//noop $findfile(temp\,*.ini,0,handle_ini test.ini $qt($1-))
Tested using a fresh portable client as well, same result:
Quote:
7 7.36 0b98d50ad3b148e7dbe78a90ae8e3f2f ok 1 1 0 0
Now, if anyone would like to post a "real" version of this script using /filter and /window, I'd definitely appreciate it. I'd like to first and foremost study it and create scripts around it, as well as actually use the script.
Edit: I have tried using the script with a timer 1 5 before the $findfile without success as well. The timer starts and halts properly but nothing comes out of it.