on $*:text:/!quran \[(\d+)\x3A(\d+)(-(\d+))?\]/:#:{
var %line.length = 300
var %line.range.size = 100
var %chapt = $regml(1)
var %line_from = $regml(2)
var %line_to = $iif($regml(4),$v1,%line_from)
if ($calc(%line_to - %line_from) > %line.range.size) || ($v1 < 1)) {
echo -st msg # Try keeping the range within real limits!
}
else {
;
;*** Lets get it done! ***
;
var %filesize = $file(quran.txt).size
.fclose quran.txt*
.fopen quran.txt quran.txt
echo -st msg # S eTahoma;7 Bismillahi Arahmani Araheem
var %line_at = %line_from
while (%line_at <= %line_to) {
var %find = $+([,%chapt,:,%line_at,])
.fseek quran.txt 0
.fseek -w quran.txt $+(%find,*)
if ($fopen(quran.txt).pos == %filesize) {
if (%line_from == %line_to) {
;say it dont exist only if its was only one line requested
msg # %find No Ayah exists.
}
}
else {
!.echo -q $fread(quran.txt,10240,&binvar)
breplace &binvar 13 0
breplace &binvar 10 0
var %line.end = $calc($iif($bfind(&binvar,1,0),$v1,10241) - 1)
var %line.start = $calc($len(%find) + 1)
while (%line.start <= %line.end) {
msg # %find $bvar(&binvar,%line.start,%line.length).text
inc %line.start %line.length
}
}
inc %line_at
}
.fclose quran.txt*
}