|
Joined: Aug 2004
Posts: 423
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2004
Posts: 423 |
hello ppl, okay first off i'm trying to mod a script that Online had done to fit my needs.. and what i'm trying to do with this atm is to call a trigger from an ini file by matching it's root directory with a directory thats stored in a txt file. example of .ini file: [Fserve.5] Access.Op= Access.Voice= Access.Reg= Status= Auto.Start= DCC.Watch= Ad.Delay= Note= Trigger= Root.Dir= Welcome.File= Channels= all i want to do is pull the trigger from this when the search criteria fids a match.. i figured the best way to accomplish this is by the root dir.. here's what i have thus far..:
On *:load: find
#find off
On *:text:@find *:%find.chanlist:{
window -h @@
filter -fwn find_f.txt @@ $+(*,$2-,*)
if !$filtered {
msg # Sorry - No results!
close -@ @@
return
}
.msg $nick [4@Find Results] %excursion
.msg $nick Found $filtered results. Listing...
if $filtered > %find.max_results {
dline @@ $calc(%find.max_results + 1) $+ -
aline @@ Too many results. Please restrict your query.
}
aline @@ [Trigger] :
savebuf @@ tmp
close -@ @@
play -a play_alias $nick tmp 500
.remove tmp
}
#find end
alias find dlg find
alias dlg dialog $iif($dialog($1),-v,-m) $1 $1
alias -l trig.match { }
alias -l play_alias {
if $2 isnum {
tokenize 32 $1 $+([10,File:,]) $3-
}
msg $1-
}
dialog find {
title "@find script"
size -1 -1 264 190
option dbu
check "Enabled", 3, 3 3 32 10
box "Folders", 1, 44 1 147 52
box "Files", 2, 2 53 189 132
button "Add", 4, 163 8 25 10
button "Del", 5, 163 19 25 10, disable
button "Reload", 6, 163 40 25 10
list 7, 47 8 113 48
list 8, 5 60 183 129, extsel vsbar
edit "", 9, 218 32 14 10
box "Max Results", 10, 206 20 40 31
combo 11, 199 71 57 50, sort
box "@find Channels", 12, 195 61 66 64
button "EXIT", 13, 208 173 37 12, ok
button "ADD", 14, 204 127 20 10
button "Remove", 15, 228 127 23 10
}
On *:dialog:find:init:0:{
didtok $dname 11 44 %find.chanlist
if (%find.max_results != $null) { did -a $dname 9 %find.max_results }
if $file(find_d.txt) {
loadbuf -o find 7 find_d.txt
if $file(find_f.txt) {
loadbuf -o find 8 find_f.txt
}
}
if $group(#find) == on {
did -c find 3
}
}
On *:dialog:find:close:0:{
savebuf -o $dname 7 find_d.txt
savebuf -o $dname 8 find_f.txt
}
On *:dialog:find:sclick:*:{
if $did == 3 {
$iif($did(3).state,.enable,.disable) #find
}
if $did == 4 {
if $sdir(\) {
var %d = $ifmatch
!.echo -q $findfile(%d,Thumbs.db,0, .remove -b $+(",$1-,") )
if !$didwm(7,%d) {
did -a $dname 7 %d
!.echo -q $findfile(%d,*,0,did -a $dname 8 $1- $bytes($file($1-),m).suf)
}
}
}
if $did == 5 {
did -b $dname 5
if $did(7).sel {
filter -cxio $dname 8 $dname 8 $$did(7).seltext $+ *
did -d $dname 7 $ifmatch
}
else {
if $did(8).sel { did -d $dname 8 $ifmatch }
}
}
if $did == 6 {
var %i = $did(7).lines
did -r $dname 8
while %i {
!.echo -q $findfile($did(7,%i),*,0,did -a $dname 8 $1-)
dec %i
}
}
if $did == 7 {
did -e $dname 5
var %l = $$didwm(8,$did(7).seltext $+ *)
if %l > 21 { did -c $dname 8 $calc(%l + 21) }
did -cf $dname 8 %l
}
if $did == 8 {
did -e $dname 5
did -u $dname 7
}
if $did == 14 {
if $did(11) {
$left($did(11),1) isin $chantypes
if $did(11) != $null {
set %find.chanlist $addtok(%find.chanlist,$did(11),44)
did -a $dname 11 $did(11)
did -d $dname 11 0
}
}
}
if $did == 15 {
if $did(11).seltext != $null {
set %find.chanlist $remtok(%find.chanlist,$did(11).seltext,1,44)
did -d $dname 11 $did(11).sel
}
}
}
on *:dialog:find:edit:*:{
if ($did == 9) { .set %find.max_results $did($dname,9).text }
}
if anyone has any suggestions.. please help.. thanks in advance
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
alias -l play_alias {
if $2 isnum {
var %filename = FILENAME.UNKNOWN.YOU.MUST.ADD.INI
var %m = 5 | ; set to max [Fserve.N] value if its more than 5
var %i = 1
while (%i <= %m) {
if ($readini(%filename,np,$+(Fserve.,%i),Root.Dir) isin $1) {
tokenize 32 $remove($1,$v1) $2- To access this file use the trigger $readini(%filename,np,$+(Fserve.,%i),Trigger)
break
}
inc %i
}
tokenize 32 $1 $+([10,File:,]) $3-
}
msg $1-
} * untested, looks right tho *
|
|
|
|
Joined: Aug 2004
Posts: 423
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2004
Posts: 423 |
hiya dave,
not to sound unapreciative for this but, it doesn't seem to be working it's still displaying like so:
« test » [@Find Results] « test » Found 2 results. Listing... « test » [File:] C:\test\test1\testfile.hlp 0.2MB « test » [File:] C:\test\test3\testfile3.hlp 0.7MB « test » [Trigger] :
but still not pullin the trigger.. need furter assistance please if you don't mind....
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
As to this line "[Trigger] :" i never even noticed it tell now, i was adding triggers to the line of the files are on. Why they dont show any might be in my script or it might be in that C:\test or c:\test\test1 or c:\test\test3 are not any of the root Root.Dir values. If none of these 3 folders are root.dir values then it wont be able to match a trigger to them, so they well remain as they wwere without one (if my code worked as expected).
So i can check which might have been the cause, please supply the INI file, remove all lines except for these below (to save space/keep privacy) [Fserve.N] Root.Dir=<and its value>
|
|
|
|
Joined: Aug 2004
Posts: 423
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2004
Posts: 423 |
okay dave, i'm not sure if this info would help but i probaly should've said this before... as you most likely can see that the script uses $sdir which allows a subfolders an files to be listed under the root dir and as result pulls it all together.. then you the dialog closes it saves the gathered list and the root dir into two sep files.. but when the dialog gets opened again it loads those two files into the buffer... at that point i dunno if there combined or not.. so maybe thats one issue?? but anyways heres the relevant info of the ini file: [Fserve.1] Root.Dir=C:\test\ like i said i'm not sure if it's reletive or not.. but thought i'd let ya know... and thanks for your help thus far on this..
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
alias -l play_alias {
if $2 isnum {
var %filename = FILENAME.UNKNOWN.YOU.MUST.ADD.INI
var %m = 5 | ; set to max [Fserve.N] value if its more than 5
var %i = 1
while (%i <= %m) {
if ($readini(%filename,np,$+(Fserve.,%i),Root.Dir) isin $3-) {
tokenize 32 $1-2 $remove($3-,$v1) To access this file use the trigger $readini(%filename,np,$+(Fserve.,%i),Trigger)
break
}
inc %i
}
tokenize 32 $1 $+([10,File:,]) $3-
}
msg $1-
} * tested * Simple mistake, I didnt take a close enough look at what was being sent to the alias, I assumed $1- was the file path/name, its actually $3-, now corrected for this.
|
|
|
|
Joined: Aug 2004
Posts: 423
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2004
Posts: 423 |
i dunno davec, i'm still having no luck with pulling the trigger... i'm now testing using a brand new clean ver of mirc and still the same results.. any further suggestions?
|
|
|
|
|