mIRC Home    About    Download    Register    News    Help

Print Thread
$iif in $findfile #198731 03/05/08 08:07 PM
Joined: Dec 2003
Posts: 12
A
aca20031 Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Dec 2003
Posts: 12
Code:
//tokenize 32 Testing | noop $findfile($mircdir,*,1,echo -a $1-)


Echos the file path as expected

Code:
//tokenize 32 Testing | noop $findfile($mircdir,*,1,$iif($true,echo -a $1-,))


Echos Testing instead of the file path

Re: $iif in $findfile [Re: aca20031] #198732 03/05/08 08:26 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Indeed. The actual problem is that whenever the [command] parameter of $findfile starts with an identifier/variable, mirc evaluates that parameter an extra time:

//var %a = ec $!+ ho | tokenize 32 Testing $!version | noop $findfile($mircdir,*,1,%a $1-)
echoes "Testing 6.31", indicating that %a and $1- were 'pre-evaluated' once, so that $findfile executes the result of that first evaluation (and as it does, it (re)evaluates the contents like normal).

This also poses a security risk, in cases where $findfile is used like that inside an on TEXT event or any other place where $1- contains unknown content.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com