mIRC Home    About    Download    Register    News    Help

Print Thread
some help with findfile #213916 11/07/09 08:44 PM
Joined: Jun 2009
Posts: 91
V
vinifera Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 91
if i do

//echo -s $findfile($mircdir,*.ini,0,echo -s $deltok($nopath($1-),-1,46))

i get bunch of INI's listed
but how to stop listing of last info given, which is
how many files there are ?

so its like

01.ini
02.ini
03.ini
04.ini
4

that "4", how to remove it from showing in data ?

Re: some help with findfile [Re: vinifera] #213919 11/07/09 09:10 PM
Joined: Jul 2006
Posts: 3,623
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,623
$findfile itself return how many file he found, you're using echo $findfile() so it echoes you the value, don't use echo to call $findfile, use /noop


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: some help with findfile [Re: vinifera] #213920 11/07/09 09:10 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Don't //echo the result of $findfile, which returns the number of matches.

/help /noop


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: some help with findfile [Re: argv0] #213943 12/07/09 11:30 AM
Joined: Jun 2009
Posts: 91
V
vinifera Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 91
hmm
wonder if anyone can help me a bit...

i have folder in which are .txt files
they are formated as "yyyy-mm-dd name" (without quotes)
like 2009-07-25 my text.txt
-

now i have dialog with List control and Edit control,
on init of dialog an alias uses findfile to GET list of all
files in that folder and loads them on List control by cutting
the date out and leaving only on List control the Name of file
-
Edit control is just for editing those files...
-
but my problem is, when i try to loadbuf of those files
i cant, because loadbuf is based on did.sel, and since selected
text is cut out (no date), mirc cannot loadbuf the filename smile

so can $findfile be used to find file simmiliar in names
to find a match (and loadbuf's me) ? :P

Code:
the load files:
---------------
"notes" is dialog name
"ID 3 is list control"

alias -l loadnotes { 
  did -r notes 3
  var %tempnotes $qt( $+ $findfile($mircdirnotes,*.txt,did -a notes 3,did -a notes 3 $gettok($deltok($nopath($1-),-1,46),2-,32)))
  did -ra notes 6 $findfile($mircdirnotes,*.txt,0) notes
}



here i tried to mix something but i screwed it up :P

Code:
List Control click (to loadbuf content)
----------------------------------------
"ID 3 is List control"
"ID 4 is Edit control where content of file goes"

on *:dialog:notes:sclick:*:{ 
  if ($did == 3) { 
    if ($did($did).sel == 0) { return }
    else { 
      loadbuf -ro $dname 4 $qt($nopath($findfile($mircdirnotes,*.txt,0,$deltok($mircdirnotes\ $+ $did($did).seltext $+ .txt),-1,46),-1,46))
    }
  }
}



any help would be apreciated smile

Re: some help with findfile [Re: vinifera] #213955 12/07/09 03:26 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Try this in place of your loadbuf line
Code:
loadbuf -ro $dname 4 $findfile(notes,$+(*,$did($did).seltext,.txt),0)


Re: some help with findfile [Re: RusselB] #213957 12/07/09 03:43 PM
Joined: Jun 2009
Posts: 91
V
vinifera Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 91
* /loadbuf: unable to open 'D:\mirc\1' (line 1162, dialogs.mrc)

(1162 is loadbuf line) :P

Re: some help with findfile [Re: vinifera] #213958 12/07/09 04:04 PM
Joined: Jul 2006
Posts: 3,623
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,623
use :

Code:
on *:dialog:notes:sclick:*:{ 
  if ($did == 3) { 
    if ($did($did).sel == 0) { return }
    else { 
noop $findfile($mircdirnotes,*.txt,$did(3).sel,loadbuf -ro $dname 4 $qt($1-))
    }
  }
}
/loadbuf -ro $dname 4 $findfile($mircdirnotes,*.txt,$did(3).sel) instead of the /noop will work too

Last edited by Wims; 12/07/09 04:05 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: some help with findfile [Re: Wims] #213961 12/07/09 04:19 PM
Joined: Jun 2009
Posts: 91
V
vinifera Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 91
this is close

now i get this (for both cases)

* /loadbuf: unable to open 'D:\mirc\notes\2009-07-11' (line 1162, dialogs.mrc)

so i guess it needs something to bind name with space to this date to get it complete smile (sorry if i sound like stupid hehe)

Re: some help with findfile [Re: vinifera] #213962 12/07/09 04:25 PM
Joined: Jul 2006
Posts: 3,623
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,623
did you used the /loadbuf or the /noop ? in the /loadbuf, I've missed a $qt(), looks like it's the problem here, updated code :


Code:

Code:
on *:dialog:notes:sclick:*:{ 
  if ($did == 3) { 
    if ($did($did).sel == 0) { return }
    else { 
    noop $findfile($mircdirnotes,*.txt,$did(3).sel,loadbuf -ro $dname 4 $qt($1-))
    ;or you can use this : loadbuf -ro $dname 4 $qt($findfile($mircdirnotes,*.txt,$did(3).sel)) 
    }
  }
}


Edit : maybe you are on a version prior to mirc 6.17 and you don't have the $qt, either use $shortfn or make a basic $qt alias like this
Code:
alias qt return $+(",$1-,")


Last edited by Wims; 12/07/09 04:27 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: some help with findfile [Re: Wims] #213991 13/07/09 03:34 PM
Joined: Jun 2009
Posts: 91
V
vinifera Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 91
thanks, this works nice. smile

if i find any help needed with this hope i can post here inside this laugh

Re: some help with findfile [Re: vinifera] #214006 13/07/09 09:51 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You can always reply to a topic if further information regarding that topic is required.
We do ask, however, that you not restart a topic that has been "closed" (ie: no messages) for a period of 6 months or more.

Re: some help with findfile [Re: RusselB] #214055 15/07/09 09:59 AM
Joined: Jun 2009
Posts: 91
V
vinifera Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 91
so im here again :P
but to keep all in 1 topic...

this is alias to load all those txt file names into dialog list

Code:
*ID 3 is listview

alias -l loadnotes { 
  did -r notes 3
    var %tempnotes $qt( $+ $sorttok($findfile($mircdirnotes,*.txt,did -a notes 3,did -a notes 3 $gettok($deltok($nopath($1-),-1,46),2-,32)),32,nr))
  did -ra notes 6 $sorttok($findfile($mircdirnotes,*.txt,0),32,nr) notes
}


and since all is loaded to list sorted by number (date)
i wish to it be sorted from newest to oldest
so i used $sorttok and reversed
but nothing is happening :P

any direction what i did wrong would be apreciated laugh


Last edited by vinifera; 15/07/09 10:03 AM.
Re: some help with findfile [Re: vinifera] #214065 15/07/09 08:24 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I don't believe you can do the sort you are wanting without changing the format of the date to a full numeric format.
Ex: July 15 2009 would have to be displayed, or have a reference to, the number 1247630400.
This is the $ctime equivalent of July 15 2009 12:00:00 am

Re: some help with findfile [Re: RusselB] #214406 03/08/09 04:21 PM
Joined: Jun 2009
Posts: 91
V
vinifera Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Jun 2009
Posts: 91
ok

thanks for info ^^