_______________________________[ "~~~^^~~~~~~~~~~~~~~~... Projektmonitor {=) Hier geht´s !noch! weiter
...~~~~~~~~~~~~~~~^^~~~" ]______________________________
_______________________________[ "~~~^^~~~~~~~~~~~~~~~... im Notepad++ (language LUA) wird´s bunt
...~~~~~~~~~~~~~~~^^~~~" ]_____________________________
- Code: Alles auswählen
--[[
\./
AH-Lua !
Herzlichen Dank für´s Mitdenken!
{Und das wollte ich mir für den Winter aufheben?}
-- { ... vorläufiger Traum schlafloser Nächte ... @title !Lunixe.lua-- ... } ~~==xxxxxxxxxx< 43496 >XXXXXXXXXX]]--
--- (LUA-Voodoo??, for..io.lines frißt Speicher... )
--- < ~~~~~ >
--- < \./~ >
--- < I >
--[[
@title scriptiX.Lua
@chdk_version 1.4
--- Speichermangel bei Ix230HS
--- (D,E,2,9,1,-2,F,0,0,0,C,A,Z,G,1,88
--(D,E,H,T,P, L,F,R,I,J,C,A,Z,G,W,U)
@param D Startordner
@values D SCRIPTS LOGS BOOKS HELP (.scX)
@param E Endung
@values E .Lua .bAs >>.tXt .baK .tmp .lOg .scX .XxX
@param H Helfix
@values H --- HELP/ LOGS/ SCRIPTS/ BOOKS/ german ???
@param T Trix & Errorix
@values T --- ???
@param P bearbiten +ab|0>_|-letzte
@default P 1
@param L edit Zeile xxx>_ (!-=^^=!)
@default L 2
@param F finde Zeile
@values F --- fun() for while until then else ---><: WOODTXT #^^%q%q
@param R --- /rem Zeilen?
@values R KEEP -cut- >Parse
@param I *?* Insertix
@values I nein JA
@subtitle :...,....1....,....2....,....3....,....4....,....5
@param J Layoutix?
@values J nein JA
@param C Kürzen (!-=RO=-!)
@default C 0
@param A Ab Zeile (|0=noNr|-noEd)
@default A 1
@param Z Bis Zeile (|0=crLf|-letzte)
@default Z 9999
@param G LOG_~.TXT (|0=gec|+Neu|-Anh)
@default G -999
@param W Laufzeitbremse
@default W 4
@param U {}@ (|0 bei lowMem)
@default U 1
--]]
--print_screen(-112)
function help(...)
local x=0
if G<21 then for ee,lin in pairs(_G) do x=x+1
if G<11 then if G and 1 then golog(ee) else golog(ee,lin) end end
print(x,-collectgarbage("count"),ee,lin)
wait(0) end
if G/2==3 then return 0 end end
repeat
local str=...
local l,K,x=t,0,0
collectgarbage()
if str==nil then str="X" end
if str=="" then str="L" end
local hfile="A/CHDK/HELP/"..str
if #str==1 then hfile=getstr("ß",str) end
for lin in io.lines(hfile) do x=x+1
if lin:find(find_str)~=nil then K=0; l=t end
local ii=1; wait(1)
while lin~="" do
if K==8 then ii=0 end
for i=1,ii do str=lin; print(-x,str)
if K~=8 then K=0 end
l=l+1+#str/44
while l>11 and K==0 do l=1; K,ti=getkey(4)
if K==2 then l=t
str=edlin(str); Go=golog(str)
if lstr(4,str)==" " then K=0 end end
if K>22 or K==6 then l=t end
while K==29 do K=0
if ti>t then prompt(0,str) elseif
ti>333 then prompt(42,str) end
Go=golog(str); ti=0 end
if ti>555 then return x end
end end --ii
lin="" end -- wh lin
end --io
K=getkey(5) --,collectgarbage("count"),err)
collectgarbage()
until K~=5
return x
end
function golog(...)
--local f,r=...
--if r~=nil and isfile(f) then return output(f,r) end
local l=get_exp_count()
if G~=0 then l=G end
if G>0 then Glog=stf("A/CHDK/LOGS/LOG_%04d.TXT",G); G=-G end
print_screen(l)
set_console_autoredraw(-1)
if type(...)=="table" then output(Glog,...) else
print(...) end
set_console_autoredraw(1)
print_screen(0)
return l
end
function img_info(x,...)
local str,dd="",get_image_dir()
if x>=1 then if (...) then print(...) end
print(os.date()); K=5 end
if x==t then str=file_browser(dd) or "" end
if str=="" then
str=printf("%s/IMG_%04d.JPG",dd,get_exp_count()) end
--return fpath(str)
return str,dd.."/"
end
function klix(x,...)
collectgarbage()
--[ [--<<LowMem Notschalter
shoot() -- Da geht dann SX210is wg. Speichermangels aus:
dd,mdI=img_info(t,...)
local str=... or ''
repeat
if 2>1 then --shoot(); file_browser(mdI) else
repeat
set_aelock(0); set_aflock(0)
press("shoot_half"); sleep(42)
while get_shooting() do sleep(42) end
repeat
iii=get_free_disk_space()
until not get_shooting() and not is_pressed("shoot_half")
set_aflock(1); set_aelock(1)
press("shoot_full")
play_sound(1)
release("shoot_full")
if (get_tv96()<1) and (get_raw_nr()~=1) then
sleep(tv96_to_usec(get_tv96())/t) end--Zeit f. Darkframe,
-- rettet Ixus300HS Kamerafehler E26 ?? --<Voodoo!
local K,u=0,0--; if get_raw() then K=1 end
-- for u=0,K do u=0
-- for u=0,(getkey(t,'^')*9) do u=0
for K=0,tonum(get_raw()) do u=0
repeat sleep(t); u=u+1
kkk=get_free_disk_space()
play_sound(4)
until iii>kkk or u==7
iii=kkk end --u
release("shoot_half")
until not is_pressed("shoot_half") end
repeat K=getkey(x*t+9); wait(0)
if K==8 or x>0 then local i=img_info(1,...)
if #str>1 then output(1,str); str='' end
output(1,stf("%s\n %s",i,os.date())) end
if x==t then return kkk else x=x%10 end
if K==5 then K=exitalt(5,"*<klix>") end
--x==1 notiert jedes Bild,10 nur das 1.
until K~=9
until K~=29 --]]--
return K
end
function exitalt(x,...)
play_sound(x,"exitalt");
local K=getkey(t);
if K==0 then set_aelock(0); set_aflock(0) end
repeat exit_alt(); sleep(444)
until get_alt_mode();
K=getkey(t);
K=getkey(5,...);
pau=t
return K
end
function wait(w)
if _HLP or (W<0) then return 0 end
if not get_alt_mode() then exitalt(0,"exitalt wait") end
wait_click(w*100+1,"wait")
local t=get_tick_count()
repeat wait_click(10)
until not is_pressed "right"
t=(get_tick_count()-t)/100
if t>2 and t<22 then W=t end
if is_pressed "down" then sleep(99)
collectgarbage()
if t>999 then find_str="" end
if W>0 then W=W-1 end end
return t
end
function lstr(x,...)
if x<0 then x=x-1 end
return string.sub(...,1,x)
end
function rstr(x,...)
if x<0 then x=string.len(...)+x end
return string.sub(...,-x,t)
end
function printf(...)
local str=string.format(...)
print(str)
return str
end
function stf(...)
local s,r=...
if r~=nil and string.find(s,"\%%",1)~=nil then
return assert(string.format(setarg(...)),...) end
return ...
end
function cut(...)
if not ... then return "\t" end
local x,str=0,...
repeat x=x+1 until x>=#str or str:sub(x,x)>"\30"
str=str:sub(x,t); str=str:gsub("\t"," ")
while str:find(" ")~=nil do str=str:gsub(" "," ") end
return str
end
function split(sep,str,...)
str=tostring(str)
if type(sep)=="number" then
return lstr(sep,str),rstr(-sep,str),#str-sep end
local spc=sep==" "
local x=str:find(sep,...)
if spc then str=cut(str) end
if x==nil then sep="" else
sep=str:sub(x+#sep,t); str=str:sub(1,x-1) end
if x==1 and spc then str=sep end
return str,sep,str:find(sep,...) or 0
end
function tonum(x,...)
local p,chr,str=0,'',...
if x==nil then tonumber() end
if type(x)~="number" then
if x=="" then return end
str=x; x=1 end
if type(str)=="boolean" then
if str==x==x then return 1,1 else return 0,1 end end
if str==nil then return nil,-t end
if type(str)=="table" then return #str or -1,str[x] end
if x*x>#str*#str then return 0,-#str end
repeat chr=str:sub(x,x)
if tonumber(chr)~=nil then if p==0 then p=x end else
if p>0 then str=str:sub(p,x-1); chr=lstr(p-1,...) end end
x=x+1 until x>#str
if x+1<string.len(str) then p=x+1 else p=1-x end
x=tonumber(str) or 0; if rstr(1,chr)=='-' then x=-x end
return x,p
end
--[ [--
function abs(x)
x=tonum(x or 0) or 0
if x>0 then return x end
return -x
end --]]--
function setarg(...)
if ...==nil then arg=nil
return collectgarbage("count") end
local X,sep,x,s=0,seP,...
if type(x)=="boolean" then
if s==nil then
if x==x==x then table.concat(arg,sep) else table.sort(arg) end
return unpack(arg) end
if x==x==x then
if type(s)=="boolean" then repeat X=X+1
if arg[X]~=nil then
if s==x==x then newline(t,arg[X]); writeln(arg[X])
else print(arg[X]) end end until X>=#arg
return unpack(arg) end
if type(s)=="table" then return unpack(s) else arg={...} end
end end
if isfile(x) then arg={}
for z in io.lines(x) do X=X+1; arg[X]=z end
collectgarbage(); return unpack(arg) end
if arg==nil then arg={...} end
local arg={}
if type(x)~="table" then arg={...} else repeat
if s==nil then return unpack(x) else
if type(s)=="table" then return unpack(x),unpack(s) end
local x,a,b,c,d,e,f,g,h,i=...
if tonumber(a)==nil then return unpack(x),a,b,c,d,e,f,g,h,i end
if tonumber(b)==nil then b=#x end
return unpack(x,a,b) end until 1<2 end
x=tostring(x)
if tonumber(x)==nil and #x==1 then sep=x end
if #arg==1 then X=0; s=...
if sep==' ' then s=cut(s) end
repeat X=X+1; arg[X],s=split(sep,s) until s=='' end
X=0
if tonumber(arg[1])==nil then
repeat X=X+1; arg[X]=tostring(arg[X]) until X>=#arg else
repeat X=X+1; arg[X]=tonum(arg[X]) until X>=#arg end
return unpack(arg)
end
--[[
function argum(K,x,y,...)
if (#arg or 0)==0 then return 0 end
if x<0 then x=#arg+x+1 end
if y<0 then y=#arg+y+1 end
if y>#arg then y=#arg end
if K<0 then K=getkey(-K,...) end
while x<=#arg and x<=y do
if K==K then x=x end
if K==24 then repeat writeln(arg[x]); x=x+1 until x>y end
x=x+1 end--wh
return x-1
end
--]]--
function output(f,...)
local X,str=0,stf([[%s]],...)
while type(f)=="number" do if
f<0 then newline(t,str); return writeln(str) elseif
f==0 then f=mdX.."!notiX.tXt" elseif
f==1 then f=mdI.."!notiX.tXt" elseif
f==2 then f=Glog
else print(str); f=f%10
if f>2 then return 0 end end--if
end--wh
print(' --',f,'--')
local out=io.open(f,"a") or io.open(erriX,"a")
if type(str)=="table" then
repeat X=X+1
if str[X]~=nil then out:write(str[X].."\n") end
until X>=#str
else X=1; out:write(str.."\n") end
out:close()
return X
end
--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
function begin(...)
local ubasic="fertiX"
if ...~=nil then print("*<",...,">") end
local K,l=0,0
basfile=log42
if U%t==0 then K=1; X=t*t; Z=X; rem="--- " else
for zeile in io.lines(log42) do X=X+1; l=l+#zeile
if zeile>"" and lstr(2,zeile)=="--" then
bug=-1-bug; rem="--- " end
for ee in zeile:gmatch("\34") do K=K+1 end
bug=bug or K%2
if bug>0 and L>=0 then L=-L
if P<X then P=X+1 end end
--- -
printf("%4d%5d%7d",X,collectgarbage("count"),l)-- so zum Zuschauen wie der Speicher schwindet.
--- - if X%42==0 then collectgarbage() end --!! genau hier u.U. sehr wichtig.
end end --forX
if K>0 then
if L==0 then L=t*t end
if L>0 then L=-L end end
if bug>0 then play_sound(6) end
collectgarbage()
if RW then wait(0)
if eXt==".scX" then os.mkdir(lstr(-1,mdX)) end
if eXt==".XxX" then ubasic="xyx00xyx" end
if type(E)=="string" then ubasic=""
if E:find('.')==nil then eXt=".tXt"; E=E..eXt; wa="a" end
if lstr(2,E)~="A/" then E=mdX..E end
basfile=E else
--- - ubasic=" |\\fertiX" -- die Striche können weg, sonst getstr...
ubasic=textbox(stf("%d rw%d %s",collectgarbage("count"),R,dd..pc..eXt)
,os.date(),ubasic,9); wait(0) end
if ubasic==nil then ubasic=""; basfile=erriX else
if tonumber(ubasic)~=nil then return 3 end
if ubasic==" " then ubasic="!!IXIXIX" end
if ubasic~="" then basfile=mdX..ubasic..eXt end end
if lstr(1,ubasic)==" " then ch4=string.sub(ubasic,2,1)
basfile,K=getfile(dd)
if K==3 then return 3 end end
if log42==basfile then print("*< >>--->"..mdX.."tempX"..eXt.." >")
basfile=mdX.."tempX"..eXt end
if log42==basfile then RW=false end end
if RW then ee="rw"; rw=1 else ee="RO"; rw=0 end
if type(F)=="string" then find_str=F else
if F>0 then
local Fnd={"function (x,...)",
"for =*+-,,???remd_---","while (<=~=>)","until (<=~=>)",
"if (<=*+-~=>) and or then","=elseif <=~=>gosubto##",
"--- 88><:","><WOOD.TXT","*:##==^^\34\34\\\\","???"}
if F>#Fnd then F=#Fnd end
find_str=textbox(basfile,pc..ee..lineal,Fnd[F],t)
Fnd=nil end
if find_str==nil then find_str=" " end end
find_str,rep_str=split("><",find_str)
collectgarbage()
sec=get_tick_count()
printf(rem.."<>> %d %s %d",X,basfile,-bug*t)
if A>X then A=X end
if P<0 then P=X+P end
if P>X then P=X+1 end
if Z<0 then A=X-Z; Z=X end
if Z>X then Z=X end
remV=rem.."<"; rC=lstr(1,rem)
basline=lineal
--basline=ubasic
return 0
end
function nubas(camera_name)
txt=io.open(log42,"r"); Li=0
if RW and not TF then Lo=0
bas=io.open(basfile,wa)
RV=P==P; writeln(rem.."< scriptiX für "..camera_name.." >")
RV=P==P; writeln(rem.."< "..os.date().." >") end
end
function head(...)
if ...~=nil then print(...) end
local bi=get_buildinfo()
nubas(bi.platform)
if RW then RV=P==P
writeln(printf("%s< %d@ %s%s ß%d >",rem,U,pc,basfile,-collectgarbage("count")))
else printf("%s %s ",remV,string.upper(bi.platform).." >") end
end
function readln(...)
local x=0
zeile=...
if Z-C*rw>Li then
if txt==nil or Li<0 then zeile=edlin(...) else
if A<Z then x=1
while x<A do x=x+1; ee=txt:read()
if string.find(ee,"*]",1,1)~=nil then A=0 end
if tpx~=nil then tpx:write(ee,crLf) end end
Li=Li+x-1 end
repeat zeile=txt:read(); Li=Li+1 until zeile~=remV end
if zeile==nil then zeile=remV; RV=1<2; Z=0 end
if rstr(1,zeile)=="\13" then zeile=lstr(-1,zeile) end
if RW and (if_x==t) and (L==Li or L==-Li) then
zeile=edlin(zeile) end
if zeile=="" then zeile=" " end
if if_x<t then
if lstr(5,zeile)==rem.."?" then zeile=stf([[%s]],edlin(zeile)) end
cb1=lstr(1,zeile)
if R==1 and tonumber(cb1)~=nil then cb1,zeile=split(seP,zeile)
x=string.find(zeile,"; %d") or 0 --entfernt Zeilennummern
if x>0 then zeile=lstr(x-1,zeile) end end
if cb1=="*" and not RV then zeile=ins_block(zeile) end
if cb1==rC and lstr(4,zeile)==rem and #zeile>4 then
zeile=rem_block(zeile) end end
size_r=size_r+#zeile end
return zeile
end
function play_string(x,...)
local str=...
lenz=string.len(...)
E=0
for i=1,bug*lenz do
if string.sub(...,i,i)=="\34" then E=E+1 end end
while E+bug==0 do E=2
if (L>=0) and (string.find(...,"^",1,1)~=nil) then str=""
for i=1,lenz do ee=string.sub(...,i,i)
if ee=="^" then E=E+1; ee="\34" end
str=str..ee
end end end
Err=E%2
for E=1,Err do Error=Error+t
str=str.."\34"
writeln(printf("%s %d %s %d",rem.."< "..pc,Li," EYn ^VV^ildsch^vv^eYn! >",Lo))
play_sound(2)
wait_click(W*t)
if RW and x~=0 then str=edlin(str) end end
return str
end
function newline(x,...)
if not W then return print('!!! ',...) end
if W<0 then return (...) end
local str=...
--print(Li,Lo,pc,str..";")
while (R==2) and rstr(3,str)=='---' do str=lstr(-3,str)..cut(readln()) end
if (bug==0) and (L>=0) and (str:find("^")~=nil) and (x<t)
then str=play_string(x,...) end
if not RW then cut(str) end
if #str>120 then local s,sr=str,""
repeat s,sr,x=split(120,s)
print(s); s=sr; wait(W+2) until x<1
else if TO or not Lo then print(str)
elseif Li==Lo+1 or Lo<0 then printf("%d%s%s;",Li,pc,str)
else printf("%d%s %d",Li,pc..str..';',Lo+1) end end
ti=wait(W)
if ti>t then II=II end
return str
end
function writeln(...)
local str=...
if str==nil or rep_str=="^" and not str:find(find_str)
or rep_str=="." then return end
if (find_str=="" or str:find(find_str)~=nil) and K~=t then repeat
if find_str=="" and isfile(mdX..rep_str) then
for wood in io.lines(mdX..rep_str) do K=t
str=fire(wood,seP,str) end; K=0
else if #find_str>0 then
str=fire(find_str,rep_str,...) end end
until o==o end
if Lo>=0 then
if R~=1 and (str=="") or str==("**") then
str=printf("%s%d %d",rem..":-)",Li,Lo) end
if io.type(bas)~="file" then TF=P==P; play_sound(6)
bas=io.open(erriX,"w") end
--tfil=io.tmpfile() end
--bas=io.open(basfile,"a") end
if RV or lstr(5,str)~=remV then
if repZ<0 then repZ=-repZ end
for x=1,repZ do Lo=Lo+1; bas:write(str..crLf)
size_w=size_w+#str end
RV=1<1; repZ=1 end
end
end
function tail(x)
play_sound(1-bug)
for i=1,rw do K=getkey(2200)
if K>19 then arX=newline(1,arX); writeln(rem..arX) end
if TF then --bas=io.open(basfile,"a")
--for z in io.lines(tfil) do
-- newline(z); writeln(z); collectgarbage() end
--os.remove(tfil)
end
---
end end
function done()
if (Lo>=0) and (eXt==".XxX") then RW=1<1
txt:close()
bas:close()
os.remove(log42)
os.rename(basfile,log42)
basfile=log42
RR=1<1 end
print(X,-Li,Lo,-size_r,size_w,-Error)
print(U,basfile," in s",(sec-get_tick_count())/t)
K=getkey(5005)
--- - if K>20 and eXt==".Lua" then run(6,basfile) end
for x=13,0,-1 do
set_console_layout(0,0,x*3,x)
console_redraw()
sleep(88) end
end
--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
function input(x,...)
local str=""
if type(x)=="string" then str=x else str=tostring(x) end
str=textbox("Input "..str,cut(...),"",t)
wait(0)
if str==nil then str=tostring(x) end
if str==" " then str=... end
if str=="@" then str=...; Z=0 end
if str=="G" then golog(...) end
if str=="P" then str=fpath(...) end
if str=="F" then str,E=getfile(mdX) end
if str==nil then str=tostring(x) end
if str=="A" then return edlin(...) end
if str=="R" then return readln(...) end
if str=="T" then x=readln(...); return input(...,x) end
return str,tonum(1,str)
end
function prompt(x,...)
local str=...
local z=0
if str==nil then str="" end
if x<0 then x=getkey(-x,...) end
while x==t do x=0; local fil,m,n=...
if m==nil then fil,m=split(cut(fil)) end
fil=fpath(fil)
if m~=nil then setarg(m,n) end
if str=="" or not isfile(fil) then x=1 else
for str in io.lines(fil) do z=z+1
if str>"" then cb1=lstr(1,str)
if cb1=="*" then str=ins_block(str) end
if cb1==rC and lstr(4,str)==rem and #str>4
then str=rem_block(str) end end
if rstr(5,str)~=remV then x=dostr(-z,str) end
collectgarbage() end--for
if x==0 then II=II else x=0; str=" " end end
end --wh
---
while x==42 do x=0
str=textbox(stf("%d:%s",Li,cut(basline)),cut(...),str,t) end--wh
if x>0 then
str=textbox(stf("%d:%s",-z,cut(basline)),cut(...),
[[--- < pc="> "; acT=0; repZ=1; --=*+-\\\\""; =*+-; --]]..str,t) end
if str~=nil and lstr(2,str)~=" " then dostr(-z,str) end
if repZ>1 then str=basline.." " end
wait(0)
return str,z
end
function dostr(x,...)
local str=...
if str==nil then str=edlin(...) end
--str=textbox(log42,cut(...),...,t) end
wait(0)
local i=#str
if i>2 then
local as,K=0,0
--print("\%--"..str)
--- - if isfile(str) then run(3,str) else
as=assert(loadstring(str,str))() ---
--- - end
print(str); wait_click(t)
if as~=0 then i=-i else
K=getkey(5,stf("%d:",x),str); ch4="E" end end
return i,K
end
function edlin(...)
if NE then return (...),tonum(1,...) end
local str=tostring(...)
if _HLP and bas then bas:flush() end
if #str>123 then printf("--- LINE %d TOO LONG TO EDIT (%d)",Li,#str)
return ... end
repeat
repeat ch4="üx"
repeat if str=="A" then str=... end
if str==" " then str=" A S" end
str=textbox(stf("%d:%s",Li,cut(basline)),cut(...),str,t)
if (str or "")=="" then str="-- -.-" end
until #str>2
while str:sub(1,3)==" A " do
ch4=str:sub(4,4)
str=str:sub(4,t)
if str=="" or lstr(2,str)=="AT" then str=" " end
if str~=" " and ch4~=nil then str=check(ch4,str)
if not _HLP then return edlin(str) end end
end wait(0)
until str~=" "
K=0; ce=rstr(1,str)
if ce==' ' and str~=" " and if_x<t*t then K=t
str=lstr(-1,str)
if #str>2 then newline(t,str); RV=P==P; writeln(str)
if rstr(1,str)~=';' then str=' ' end
else K=0 end end
if lstr(1,str)==";" then Go=golog(str) end
if ce==')' and lstr(1,str)=='(' then arX=str end
until K==0
if str~=... and Li and (L==Li or L==-Li) and if_x<t*t then
if L>0 then L=Li+1 end
if L<0 then L=Li-1 end end
return str,tonum(1,str)
end
function check(chr,...)
local str=...
ch4=chr
if chr=="(" then arx=str end
if string.find("/|\\_>GPRV",ch4)~=nil then str=rstr(-1,str) end ---<<~=!!
if chr=="V" then remV=str end
if chr==">" then find_str=str end
if chr=="_" then rep_str=str end
if chr=="G" then golog(str); str=rem..chr..str end
if chr=="P" then prompt(1,str); str=rem..chr..str end
--- - if chr=="R" then run(5,str); getkey(2,str) end
if string.find("RV(",chr)~=nil then str=rem.."<"..str end
while string.find("/|\\ABCDEF)HILMOSTXZ",ch4,1,1)~=nil do ch4="K" ---<<~=!!
str=getstr(chr,str) end --
if ch4=="E" then str=rem.." ??? Error --- ^ "..str end
if str=="" then str=rem end
while ch4=="K" do K=getkey(0,"<v> "..str)
if K==0 then return str end
while K<t and string.find(str,".")~=nil do --play_sound(3,"check")
if K==8 or K>20 then ee=fcopy(K,str) --letzte Zeile
if ee~="--" then K=getkey(0,ee); ch4="XX" end
end
while K==29 do run(6,str)
K=getkey(0,"<V> "..str)
if K==4 then str=textbox(stf("%d:%s",Li,cut(basline)),ee..lineal,str,t)
K=getkey(0) end end
if K==9 then basline=str; pau=t end
if K==6 then return str end
if K==5 then str=" A "..str end
if K==4 then str=rem.."?"..str end
if K==2 then Go=golog(str) end
if K<22 then K=t end end end
if ch4~="XX" then ch4="XX" else ch4="K" end
return str
end
-- Wird aktiviert, wenn Scriptix mit R ---/ == >Parse sich selbst filtert.
-- Dann kann man Lua-Scripte wie dieses, deren Parameterblock gegen nil abgesichert ist,
-- in den Ablauf einbinden - soweit der Speicher reicht.
-- Diese können auch hiesige functions aufrufen.
-- NICHT: SX210is (LowMem)
--- -
--[[
function run(K,exe,...)
local str=...
local d,e,h,tt,p,l,f,r,i,j,c,a,z,g,w,u,y=
D,E,H,T, P,L,F,R,I,J,C,A,Z,G,W,U,Y
local Rem,pC,bf,l42,li,lo,sr,sw,rW,go,tO,ii,x=
rem,pc,basfile,log42,Li,Lo,size_r,size_w,rw,Go,TO,II,X
if K==-t then K=2; ti=0 end
if tostring(D)==sX then D=0
if type(E)=="string" then E=0 end end
if Li>0 then txt:close(); if RW then bas:close() end end
Li,J,A,C,Z,rC,s=0,0 --=ACZ...=nil
if str~=nil then arX=... end
if arX=="" then arX="D,E,2,9,1,-2,F,0,0,0,C,A,Z,G,22,222" end
if exe:find(" ")~=nil then exe,arX=split(" ",exe) end
if not isfile(exe) then exe=fpath(exe) end
if (K==2) and arX~="()" then
arX=textbox(cut(basline)..lineal,exe,arX,t); wait(0) end
if arX==nil then arX="" end
collectgarbage()
print_screen (-44)
print(rem..os.date(),-K)
if string.sub(arX,1,2)==" " then arX="" end
if K==0 then K,ti=getkey(2,"-+-") end
if ti>555 then exe=sX end
print(rem,K,-Li,-Lo,exe,arX,collectgarbage("count"))
if K==9 then prompt(t,exe,arX) end
if K<8 then local gsub,err=loadfile(exe)
if not gsub then error(err,2); getkey(6,exe) end
if K>5 then gsub() end
if K<3 then assert(gsub)(arX) end
if K==3 then assert(gsub)(...) end
if K==4 then assert(gsub)(D,8,2,9,1,-2,F,0,0,0,0,0,0) end
if K==5 then assert(gsub)(setarg(arX)) end
end
if arX==nil then arX="" end
if str==nil then str=exe end
if K<t then newline(0,"--- ? "..str.." ("..arX..")") end
if K==t then writeln("--- ? "..str.." ("..arX..")") end
print(os.date(),-K)
getkey(1,ix,err,Li,Lo,lineal)
print_screen (0)
collectgarbage()
pc,basfile,log42,Li,Lo,size_r,size_w,rw,Go,TO,II,X,rem=
pC,bf,l42,li,lo,sr,sw,rW,go,tO,ii,x,Rem
D,E,H,T, P,L,F,R,I,J,C,A,Z,G,W,U,Y,t=
d,e,h,tt,p,l,f,r,i,j,c,a,z,g,w,u,y,1000
RW=rw==1; pau=t
remV=rem.."<"; rC=string.sub(rem,1,1)
for x=0,14 do
set_console_layout(0,0,x*3,x)
console_redraw(); sleep(77) end
set_console_layout(0,0,45,14)
if Li>0 then
for x=1,rw do bas=io.open(basfile,"a") end
txt=io.open(log42); for x=1,Li do txt:read() end end
end
---*]]
-- ...stenographische Elemente...
--- >^function fire><|
function fire(find,rep,...)
local K,str=0,...
if not rep then return ... end
-- if find=='"' then find,str=split('"',str); return split('"',str) --:(
if rep=="" then K=getkey(9)
if RW and (K<8) then pau=t;
if K>4 or _HLP then return edlin(str) end end end
if find=='"' then find,str=split('"',str,1,1)
return split('"',str,1,1) end
if rep==seP then find,rep=split(seP,find) end
if #rep==1 then local i=tonumber(rep)
if rep=="!" then golog(str) else
if i~=nil and repZ>-1 then repZ=i else
if rep=="@" and repZ>-1 then
find,str=split(seP,str); writeln(find) end
if rep==";" then str=readln(); str,rep=split(seP,str) end
if rep=="|" then bas:close(); Lo=0 end --fsplit>erroriX.tmp
if rep=="?" then rep=input(find,str) end
if rep=="/" then rep=fpath(find) end
if rep=="=" then rep=find end
if rep=="+" then rep=os.date() end
if rep=="§" then rep=img_info(0,"") end
if rep=="-" then return string.sub(str,6,t) end
if rep==":" then return string.sub(find,1,5)..str end
if rep=="~" then return string.reverse(str) end
if rep==">" then return string.upper(str) end
if rep=="<" then return string.lower(str) end
if rep=="{" then return split(seP,str) end
if rep=="}" then find,str=split(seP,str) end
if rep=="[" then return split(find,str,1,1) end
if rep=="]" then find,str=split(find,str) end
end end end
if #rep>1 then
if rep=="\59;" then rep="" end -- ;;
if rep=="\45+" then rep="\42" end -- -+ * Fehlen in textbox(): *,|,\
if rep=="\45/" then rep="\\" end -- -/ \
if rep=="\64@" then rep="\13\10" end -- @@
if lstr(4,rep)==rem or rstr(1,rep)==";" then str=rep..str
else repeat
if lstr(1,rep)==";" then str=str..rep
else if repZ>-1 then str=string.gsub(...,find,rep) end end
until o==o end
end
return str
end
function ch_block(get1,ch2,st3,...)
if ...~=nil then RV=P==P; writeln(rem.."<",...,">") end
local str=...
if ch2=="." then ch2=lstr(1,st3); acT=tonumber(ch2) or 0
return str end
if ch2=="-" then ch2=lstr(1,st3); K=tonumber(ch2) or 0
if K>0 then
if acT==K then st3=rstr(-1,st3) else st3=str end end
while st3=="" do Z=Z; st3=readln()
st3="--- :"..st3 end
return st3 end --- ---- -z=--- -z
if ch2==";" then st3=fpath(st3) end
if ch2==">" then find_str=st3
if st3:find("><")~=nil then find_str,st3=split("><",st3) end
ch2= "_" end
if ch2=="_" then
if st3:find("}{")~=nil then st3,ch2=split("}{",st3) end
rep_str=st3
if ch2~="_" then return ch2 end end
if ch2=="!" then
if st3:find("=")==nil then dostr(Lo,stf([[ee=%s]],st3))
else dostr(Lo,stf('ee=[[%s]]',st3)) end
dostr(-Lo,ee); K=getkey(2,ee)
if K==2 then ee=stf('%s',basline); writeln(ee); ee=dd end
if K==4 then ee=zeile end
if K==5 then prompt(42,ee) end
if K==6 then ee=prompt(42,dd) end
str=ee end
--II=II end
if ch2=="&" then dostr(Li,st3) end
if ch2=="%" then dostr(Li,[[ee=string.format(]]..st3..[[)]])
str=ee end
if ch2=="]" then pc=st3 end
if ch2==":" then if st3=="" then st3=lineal end
str=rem.."-"..rem.."-"..rem..":"..st3 end
if ch2=="^" then str=edlin(zeile); wait(1) end
if ch2=="+" then str=basline; repZ=tonum(st3); get1=1<1
if repZ==nil then repZ=1; writeln("--- +")
return rem..os.date() end
if repZ==0 then golog(str) end
if repZ<0 then II=II end end
if get1 then str=getstr(ch2,st3) end ---("/|\\ABCDEF)HILMOSTXZ")~=nil
if str==nil then str=erriX end
if ch2=="[" then A=Z-1;
if str:find(".",4,1)~=nil then tpx=io.open(st3,"w") end
readln(str)
if tpx~=nil then txp:close(); tpx=nil; tpX=st3 end
end --cut[&save] -> *]]--
--- - if ch2=="{" then run(3,st3) end
if ch2=="}" then str=prompt(t,st3) end
return str
end
function ins_block(...)
--[ [
local str=...
local st3=str:sub(3,t)
local get1=#str==3
ch2=string.sub(...,2,2)
zeile=rem.."< --- *"..zeile.." >"
for i=1,II do print(zeile)
if string.find("/|\\+-_.:;^>!%&{}[]",ch2,1,1)~=nil then
str=ch_block(get1,ch2,st3,...) end
if ch2=="(" then arX=st3 end
if ch2==">" or ch2=="_" then str=... end
if ch2=="*" then writeln(rem.."*? (]wwwwww> +|-|=)?") end
if ch2=="!" then K=getkey(3,str)
II=II end
if ch2=="?" then str=edlin(rem..str.."???:##(<=~=>)end") end
if ch2=="<" then RV=P==P; if st3~=nil then remV=st3 end
repeat readln(); print(zeile) until Li==Z or lstr(2,zeile)~="*<"
K=getkey(2); str=zeile end
---[ [ Reserviert f. keylogiX.bas :###include *#* Blox --- (!DIY!) ] ]--
if ch2=="\35" then II=II end
if ch2=="=" then II=II end
if ch2=="@" then II=II end
end --for II
if str==... then str=zeile end
--]]--
return str
end
function rem_block(...)
local str=...
local st3=string.sub(str,6,t)
local get1=#str==6
ch5=string.sub(str,5,5)
--while ch5=="<" and str==remV do str=readln() end -- temp. rem|Halt(find)
for i=2,R do --- rems auswerten?
if string.find("/|\\+-_.:;^>!%&{}[]",ch5,1,1)~=nil
then str=ch_block(get1,ch5,st3,...) end
if ch5=="?" then str=edlin(...) end
if ch5=="(" then arX=st3 end
if ch5==">" or ch5=="_" then repZ=-1
if str~="" and str~=... then str=rem..ch5..str end end
if ch5=="§" then klix(2,st3) end
if ch5=="*" then str="\42"..st3 end
if ch5=="@" then Z=0 end
if ch5=="!" then
while K>8 do K=getkey(2,str)
II=II end end
while string.sub(str,4,6)==" A " do ch4="Do"
str=string.sub(str,7,t)
str=check(ch4,str) end
end --for R
if R==1 then str=rem.."<>" end
return str
end
function fcopy(K,...)
local lin=...
local x=0
for str in io.lines(fpath(...)) do x=x+1
if str~="" and #str>5 then lin=str
if lstr(5,str)=="--- (" or lstr(5,str)==rem.."("
then lin=rstr(-5,str); arX=lin end end
if K<8 then output(K,str) end
if K==8 then if pc=="> " then printf("%d. %s",x,str) else print(str) end end
if K==22 then golog(str) end
if K==24 then str=newline(t,str); writeln(str) end
collectgarbage() end -- for
if K==8 then getkey(1,lin.." -- ",arX) end
return lin,tonum(lin)
end
function isfile(f,...)
if f==nil then return 2<1,"NIL" end
--if type(f)=="number" then return 2<1,tostring(f) end
-- local x,is="NIL",type(f)=="string" and os.stat(f) and (io.open(f)~=nil)
--[ [
local x,is,str="NIL",pcall(io.open(f)) -- nett, aber
is=str:find("userdata")~=nil -- Ix900Ti geht aus--]]-- ^^
if is then str=f; x=io.type(f) end
--getkey(0,tostring(is)..str)
return is,str,x
end
function fpath(f,...)
--mdX=mdX or ""; mdI=mdI or ""
if not rem then rem="--- " end
local dd,dir='',
mdX..";SCRIPTS;LOGS;BOOKS;HELP;DATA;LOGS/logiX;;SCRIPTS/TEST;"..mdI
-- while type(f)=="number" do II=II
-- return end
if isfile(f) then dd=f
while rstr(1,dd)~="/" do dd=lstr(-1,dd) end
return f,dd end
if lstr(2,f)=="A/" then return f,rem.."^nofile:"..f end
if path~=nil then dir=path..';'..dir end
repeat dd,dir=split(';',dir)
if lstr(2,dd)~="A/" then dd="A/CHDK/"..dd end
if rstr(1,dd)~="/" then dd=dd.."/" end
if isfile(dd..f) then return dd..f,dd end
until #dir==0
return getfile(dd,...)
end
function getfile(dd,...)
local E,ee=-1,dd
if ...~=nil then print(...); sleep(t) end
if isfile(dd) then return fpath(dd,...) end
if ee==nil then ee='ä' end
if lstr(2,ee)~="A/" then dd="A/CHDK/" end
if rstr(1,ee)~="/" then ee="SCRIPTS/" end
dd=dd..ee
repeat E=-1
repeat ee=file_browser(dd); wait(1)
E=E+1 until ee~=nil or E==3
if E==1 then
--- - if string.upper(rstr(3,ee))=="LUA" then run(-t,ee,...)
--- - else prompt(t,ee) end
II=II end
if E==2 then
prompt(42,stf([[L=%2d; F=%d; R=%d; T=%d; G=%d; acT=%d; ee=%s]],L,F,R,T,G,acT,[['="\\";=*;=']]))
if T==1 then II=II end
R=R and 2 end
until E==0 or E==3
return ee,E
end
function getstr(chr,...)
local K=1
local str=...
if str=="" then str="S" end
if str=="(" then str=rem..os.date() end
if str=="C" then str="A/CHDK/" end
if str=="A" then str,K=getfile(); if str==nil then str="E" end end
if str=="E" then str=rem.."< ??? Error --- ^ >"..basline; ch4="er" end
if str=="F" then str='--- ? function xyz(x,y,z,...)\\n-- -- /S\\nend\\n--- ? for u=1,11 do xyz(u,x,-z*(y+x),...) end; return yx end' end
if str=="I" then str=tpX; if str==nil then str="X" end end
if str=="X" then str=mdX end
if str==")" then str=arX end
if str=="O" then str=erriX end
if str=="B" then str="A/CHDK/BOOKS/" end
if str=="H" then str="A/CHDK/HELP/" end
if str=="L" then str="A/CHDK/LOGS/" end
if str=="S" then str="A/CHDK/SCRIPTS/" end
if str=="T" then str="A/CHDK/SCRIPTS/TEST/" end
if str=="Z" then str=sX end
if str=="M" then str="M=md_detect_motion(a,b,1,d,e,f,g,h, i,j,k,l,m, n,o,p)" end
if rstr(1,str)=="\n" then str=lstr(-1,str) end
if lstr(2,str)=="A/" then
while str:find(".",3,1)==nil do str=getfile(str) end
K=string.find("/|\\",chr,1,1) or 0
if K>0 then writeln(rem..str)
if K==1 then fcopy(24,str) end
if K==2 then prompt(t,str) end
--- - if K==3 then run(2,str) end
str=rem..str.." -- end "..ch4 end end
if K*#str>1 then str=textbox(cut(basline),cut(zeile),str,t) end
wait(1)
if #str==1 then ch4="E" end
--getkey(5,chr..ch4)
return str
end
function getkey(x,...)
local K,t=0,1000
console_redraw()
--print('--',...)
--if ...~=nil then print(stf('*<%s>',...)) end
if ...~=nil then print(setarg("*<",...,">")) end
if x==nil then x=42 end
if x<10 then sleep(33)
repeat wait_click(9) until is_key "no_key"
if x<8 then play_sound(x) end
wait_click(t*t)
if x~=8 then sleep(123) end end
if x>t then wait_click(x); K=x%100 end
local ti=get_tick_count()
while is_pressed "face" do K=1 end
while is_pressed "up" do K=2 end
while is_pressed "video" do K=3 end
while is_pressed "left" do K=4 end
while is_pressed "set" do K=5 end
while is_pressed "right" do K=6 end
while is_pressed "display" do K=7 end
while is_pressed "down" do K=8 end
while is_pressed "menu" do K=9 end
while is_pressed "help" do K=11 end
while is_pressed "playback" do K=13 end
while is_pressed "print" do K=16 end
while is_pressed "zoom_in" do K=22 end
while is_pressed "zoom_out" do K=24 end
while is_pressed "shoot_half" do K=29 end
ti=get_tick_count()-ti
while x==t do x=0
K=get_orientation_sensor()
if Go==nil then Go=K/90+99 end
if K==0 then G=Go else play_sound(1+K/90) end
if K==90 then G=G-1 end
if K==270 then G=G+1 end end
return K,ti
end
function menux(...)
local K,ti=getkey(2)
-- if ti>t*t then II=II end
--- - if ti>t then ti=pcall(run(2,basline)) end
--- - if K==24 then run(6,sX) end
--("D,8,2,9,1,-2,F,0,0,0,C,A,Z,G,11,111") end
--- - if K==22 then run(2,sX) end
repeat
if K==29 then klix(1,...); K=9 end
if K==13 then press "playback"; wait(8); release "playback"; K=9 end
if K==2 and ti>333 then help(""); K=9 end
if K==4 then if ti>333 then basline=rem..":-) ".. basline end
ti=t end
if K==5 and ti>333 then exitalt(5,"*<alt>"); K=9 end
if K==6 then basline=edlin(" A AT"..basline); ti=t end
if K==8 and ti>333 then W=0; WP=1<1
if ti>t then find_str="" end end
if K==9 then K,ti=getkey(t+9)
if ti>333 then K=submenu(K); ti=t end end
-- if not _HLP then console_redraw() end
wait(9) until K~=9
return K,ti
end
function submenu(K)
II=II
return K
end
--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
function scriptix(...)
--(D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y)
local function restore()
D,E=0,0
set_aelock(0); set_aflock(0)
if Li>=0 then
if RR then txt:close() end
if RR and RW then bas:close() end end
set_console_layout(0,0,25,5)
set_console_autoredraw(1)
print(U,"scriptiX:",Li,Lo,-Error)
K=getkey(2004,collectgarbage("count"),err)
collectgarbage()
return basfile
end
t=1000
arX=...
mdI=""
mdX="A/CHDK/SCRIPTS/"
if H>=0 then ee,mdI=img_info(t,arX)
Hf={"---","H","L","S","B","german.HLP"}
hfil=Hf[H+1]; Hf=nil end
if isfile(D) then log42=D else
log42=""
dir={"SCRIPTS/","LOGS/","BOOKS/","HELP/","LOGS/logiX/"}
dd=dir[D+1]; dir=nil end
--- ".XxX" gewählte Zeilen editieren; Datei direkt modifizieren.
if type(E)=="number" then
ext={".Lua",".bAs",".tXt",".baK",".Tmp",".lOg",".scX",".XxX",".xXx"}
eXt=ext[E+1]; ext=nil end
if eXt==nil then eXt=".eXt" end
if eXt==".lOg" then mdX="A/CHDK/LOGS/" end
if eXt==".scX" then mdX="A/CHDK/LOGS/logiX/" end
sX="A/CHDK/SCRIPTS/scryptiX.Lua"
if not isfile(sX) then sX="A/CHDK/SCRIPTS/scriptiX.Lua" end
dd=dd or "SCRIPTS/"
wa="w"; if eXt==".tXt" then wa="a" end
ch4="ö"
ee=""
basfile=""
Glog="A/CHDK/LOGS/!Glog.tXt"
seP=" "
crLf="\n"
rem="rem "; remV="rem <"
acT=U/t
bug=0
Err=0
Error=0
II=0
if_x=t*t
Go=0
K=0
Li=-1
Lo=-1
rw=1
repZ=1
size_r=0
size_w=0
sec=0
X=0
RR=1<2
RW=C>=0 and E>=0
TF=2<1
TO=A==0
NE=A<0
WP=W<0
if WP then W=-W end
if I>0 then II=1 end
if J==0 then A=1; C=0; Z=t*t end
if P==0 then P=t*t end
if A==0 then A=1 end
if A<0 then A=-A end
if Z==0 then Z=t*t; crLf="\13\n" end
if eXt==".XxX" and L>0 then L=-L end
if pc==nil then pc="> " end
if arX==nil then arX="(...)" end
if hfil==nil and H>0 then H=-H end
if find_str==nil then
find_str="@title><" end
if erriX==nil then erriX=mdX.."erroriX.tmp" end
if pau==nil then pau=0 end
if lineal==nil then lineal=":...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,...." end
basline=lineal
zeile=lineal
if type(Y)=="number" then Y=Y+1 end
if type(Y)=="string" then getkey(6,pc..Y) end
if Y~=nil then II=II end
--[ [
if H>=0 then for x=0,14 do
set_console_layout(0,0,x*3,x)
print(lineal)
console_redraw(); sleep(88) end end--]]--
set_console_layout(0,0,45,14)
if H>0 then help(hfil) end
collectgarbage()
--:...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....--begin txt2bas --
--isfile(fpath("scriptix.lua"))
--isfile(fpath("log_0123.txt"))
if not isfile(D) then log42,K=getfile(dd,...)
if K==3 then restore() end
wait(1) end
K=begin(...)
if K==3 then restore() end
wait(1); play_sound(rw)
head()
if string.find("/|\\",ch4,1,1)~=nil then getstr(ch4,log42)
--if ch4=="/" then P=0; Z=-t end
end
if_x=t; wait(1)
for x=A,P-1 do readln(); writeln(zeile) end
if Li>X then Z=0 end
if_x=1; wait(1)
while Li<Z-C do
repeat readln() until rep_str~="#" or zeile~=basline or Li>=Z
if RW and (L==Li or L==-Li) then zeile=edlin(zeile); pau=t end
basline=newline(1,zeile)
if (WP and (Li%10==0)) or (is_pressed "menu") or (pau>333) then
K,pau=menux(basline) end
writeln(basline)
collectgarbage() --!!
--- - if pau>t then run(6,sX," D,4,8,9,1,-2,F,2,1,0,0,0,0,G,1,333")
--- - K=getkey(2222,not IX,Lo,err) end
end --wh
tail()
done()
ee=os.date()
restore()
return ee
end--txt2bas
-- end --scriptix(...)
---
if t==nil then repeat IX,err=pcall(scriptix())
-- if not IX then error(err,1) end
K=getkey(2002,not IX); P=1
until K<21
else ---T=t
if OOO==nil then --local x,pc=...
--if type(x)=="number" then
D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y=... end --end
--if OOO==nil then D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y=... end
UUU=U
t=1000
if pc==nil then pc="| " else pc="0"..pc end
mdX,mdI="",""
print("D=",D," type:",type(D),pc,XXX)
print("E=",E,"H",H,"Mem:",collectgarbage("count"))
print("T",T,"P",P,"L",L,"F",F,"R",R,"I",I)
print("J",J,"C",C,"A",A,"Z",Z,"G",G,"W",W,"U",U); --getkey(1,D)
lineal=":...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;...."
if type(D)=="string" and D:find(")",1,1)==nil
and isfile(fpath(D)) then
D,mdX=fpath(D); rC="-"; rem="--- "; print(lineal)
if D:upper()~="A/CHDK/SCRIPTS/SCRIPTIX.LUA" and ((H or 0)>=0) then
if E==nil then prompt(t,D)
--- - else run(2,D,...); XXX=1 ---
end
K=getkey(1,D); if K<20 then XXX=t end
end end
if E==nil then D=nil end
if D==nil then D=0 end --- 1=/LOGS/
if E==nil then E=0 end --- 2=>>.tXt; =anhängen
if H==nil then H=0 end --- Helfix
if T==nil then T=0 end --- Testschalter
if P==nil then P=0 end --- 0=>t*t; nur Suche&edit
if L==nil then L=0 end --- edit in_Zeile Nr.
if F==nil then F=1 end --- edit out_Textsuche
if R==nil then R=2 end --- 2=rems auswerten
if I==nil then I=1 end --- *? Zeilen -"-
if J==nil then J=0 end --- Vorsicht!
if C==nil then C=0 end --- -= ReadOnly
if A==nil then A=0 end --- 0=Ohne Zeilenummern
if Z==nil then Z=t*t end --- =|0=crLf|-letzte
if G==nil then G=0 end --- 0=LOG_get_exp_count().TXT
if W==nil then W=4 end --- wait
if U==nil then U=get_exp_count() end
if XXX==nil then
if UUU==nil then
print("D",D,"E",E,"H",H,"T",T,"P",P,"L",L,"F",F,"R",R,"I",I," ß",collectgarbage("count"))
print("J",J,"C",C,"A",A,"Z",Z,"G",G,"W",W,"U",U,"Y",Y,":",type(Y)) end
if H<0 then if Y==nil then Y=0 end
scriptix(D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y)
else wait_click(W*t)
repeat IX,Y=xpcall(scriptix(),scriptix())
K=getkey(4002,not IX,err); P=1
until K<21 end end
end
--[[
--- >blah
--- blahbla blah --- 88
--- +
--- _sleep(t) ;
--- blahbla blah --- 88
--- +3
--- ---- ---- -
--- ---- _; --false
--- blahbla blah ---88
--- _fasel
--,D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y
--- % "---D%s,E%s,H%s,T%s,P%s,L%s,F%s,R%s,I%s,J%s,C%s,A%s,Z%s,G%s,W%s,U%s",D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U
--- % "---Li%s, Lo%s, Mem%s, geC%4d %s",Li,Lo,collectgarbage("count"),get_exp_count(),lineal
--- ---- &R=0; --:)
--- % "acT=%d; d=%3d; e=%d; f=%d; p=%d; --=",acT or 0,d or 0,e or 0,f or 0,p or 0
--- &dd=stf('%s',basline)
--- !dd=textbox('blah',dd,dd,t)
--- ---- ---- &dd=stf('%s',basline)
--- !dd
--- % "acT=%d;d=%d;e=%d;f=%d;p=%d; ---=*",acT or 0,d or 0,e or 0,f or 0,p or 0
--]]--
--- (D,E,2,9,1,-2,F,0,0,0,C,A,Z,G,1,111,Y
--- :---------------------------------------
--- <
--[[
-- ... Runtimeminimierung vorerst maximiert ...
P.S. {^myTodo^}
? Bisserl rechnen {X=Y*is_valid_verregnetes_Wochenende+Z*is_involved_Bitschmied+?)
(Dieses Glasperlenspiel fand eine Fortsetzung bei HostluaPortable notepad++>)
]]--
_______________________________[ "~~~^^~~~~~~~~~~~~~~~...
CHDK mit Kommandozeilenfeelinx
...~~~~~~~~~~~~~~~^^~~~" ]______________________________
- Code: Alles auswählen
--[[
@title scryptiX.lua
@chdk_version 1.4
@param s ??? >|<
@default s 0
@param T Testschalter
@default T 0
]]--
play_sound(1)
--if (s or 0)<0 then reboot("A/CHDK/SCRIPTS/scriptiX.Lua") end
t=1000
if scriptix~=nil or s==nil then lineal=... end
if scriptix~=nil then
if lineal==nil then lineal=[[3,9,2]] end
-- D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y=...
if s==nil and lineal:find(")",1,1)==nil then
dostr(0,stf([[D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y=%s]],lineal)) end
print("D=",D," type:",type(D),pc,Li)
print("E=",E,"H",H," ß",collectgarbage("count"))
print("T",T,"P",P,"L",L,"F",F,"R",R,"I",I,"J",J,"C",C,"A",A,"Z",Z,"G",G,"W",W,"U",U)
lineal=":...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;...."
if pc==nil then pc="| " else pc="0"..pc end
if isfile(D) then
rC="-"; rem="--- "; print(pc,...)
if D~=sX then local D,E=...
if E==nil then prompt(t,D) else run(2,...); XXX=1 end
k=getkey(z,D); if k<20 then XXX=t end
end end
if E==nil then D=nil end
if D==nil then D=0 end --- 0=/LOGS/
if E==nil then E=0 end --- 2=>>.tXt; =anhängen
--ext={".Lua",".bAs",".tXt",".baK",".Tmp",".lOg",".scX",".XxX",".xXx"}
if H==nil then H=0 end --- Helfix
if T==nil then T=0 end --- Testschalter
if P==nil then P=0 end --- 0=>t*t; nur Suche&edit
if L==nil then L=-3 end --- edit in_Zeile Nr.
if F==nil then F=1 end --- edit out_Textsuche
if R==nil then R=2 end --- 2=rems auswerten
if I==nil then I=0 end --- *? Zeilen -"-
if J==nil then J=0 end --- Vorsicht!
if C==nil then C=0 end --- -= ReadOnly
if A==nil then A=0 end --- 0=Ohne Zeilenummern
if Z==nil then Z=t*t end --- =|0=crLf|-letzte
if G==nil then G=0 end --- 0=LOG_get_exp_count().TXT
if W==nil then W=4 end ---
if U==nil then U=get_exp_count() end
if XXX==nil then
if UUU==nil then
print("D",D,"E",E,"H",H,"T",T,"P",P,"L",L,"F",F,"R",R,"I",I,"ß",collectgarbage("count"))
print("J",J,"C",C,"A",A,"Z",Z,"G",G,"W",W,"U",U,"Y",Y,":",type(Y)) end
getkey(0,collectgarbage("count"))
repeat IX,Y=xpcall(scriptix(),scriptix())
k=getkey(4002,not IX,err); P=1
until k<21 end--XXX
else local F=T; collectgarbage()
-- Da sind SX210is & Ixus230HS Mangels Speichers schon aus dem Rennen...
local gsub,err=loadfile("A/CHDK/SCRIPTS/scriptiX.Lua")
if not gsub then error(err,2)
getkey(0,collectgarbage("count")); s=t end
if s< 0 then assert(gsub)(1,1,0,T,1,-1,F,0,0,0,-1,1,0,10,8,0) elseif --<-RO!
-- D,E,H,T,P, L,F,R,I,J,C,A,Z,G,W,U,Y
s==0 then assert(gsub)(0,0,0,T,1, 1,F,2,1,0,0,0,0,0,3,0) elseif
s==1 then assert(gsub)(0,0,0,T,1,-2,F,2,0,0,0,1,0,0,3,0) elseif
s==2 then assert(gsub)(2,8,2,T,1,-2,F,0,0,0,0,0,0,10) elseif
s==3 then assert(gsub)(1,1,0,T,1,-2,F,0,0,0,0,0,0) elseif
s==4 then assert(gsub)("scriptiX.Lua","fertiX.Lua",-1,T,1,0,F,2,0,0,0,0,0,G,1,0)
elseif s==5 then assert(gsub)("log_0042.tXt",1,-1,T,1, 1,F,2,1)
elseif s<t then assert(gsub)() end
play_sound(0)
II=II
end
______________________________ [ "~~~^^~~~~...
Wohin damit?? Baustein/Intro zum Platzieren des md_Blocks
...~~~~^^~~~" ] ______________________________
- Code: Alles auswählen
--[[
@title platziX.Lua
@chdk_version 1.4
@subtitle Im UniVersum fehlt a Byte!
@subtitle Wo ist das? Sag was!
@subtitle Ist es noch weit?
@subtitle Jede Sekunde Lebenszeit
@subtitle ist eine Leihgabe der Ewigkeit.
]]--
function look(x)
set_aelock(0); set_aflock(0)
press("shoot_half")
repeat sleep(42) until not get_shooting()
set_aflock(1); set_aelock(1)
release("shoot_half")
if x>0 then -- ubasic:
-- print get_min_stack_dist;"mm",get_near_limit,-get_focus,-get_far_limit
print(get_exp_count(),-get_focus(),"-av",get_av96()/32,"-tv",get_tv96()/32) end
x=get_free_disk_space()
wait_click(999)
return x
end
function place(...)
local a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,X=...
if a==nil then a=3 end
if b==nil then b=3 end
c=1
if d==nil then d=60000 end
if e==nil then e=20 end
if f==nil then f=3 end
if g==nil then g=2 else g=g-1 end
h=0
if i==nil then i=1 end
if j==nil then j=(a+1)/2 end
if k==nil then k=(b+1)/2 end
if l==nil then l=j end
if m==nil then m=k end
if n==nil then n=0 end
if o==nil then o=3 end
if p==nil then p=16 end
if X==nil then X=0 end
local ab=a+b
repeat
local a2=0; if a==2 then a2=1 end
local b2=0; if b==2 then b2=1 end
if j>a then j=a end
if k>b then k=b end
l=j+1-a%2-a2; m=k+1-b%2-b2; g=g%3+1
local T=get_tick_count()
h=md_detect_motion(a,b,1,200,e,f,g,h,i%3,j,k,l,m,0,o,9)
if (h>0) or (ab~=a+b) and (X<2) and (f<99) then
print(e,-f,"(",a,-b,")",h,T-get_tick_count())
ab=a+b
while is_pressed("shoot_half") do
sleep(42); II=II end
else console_redraw() end
wait_click(9)
if is_key("zoom_in") then a=a%12+1 end
if is_key("zoom_out") then b=b%12+1 end
if is_key("left") and j>1 then j=j-1 end
if is_key("right") and j<a then j=j+1 end
if is_key("up") and k>1 then k=k-1 end
if is_key("down") and k<b then k=k+1 end
if is_key("set") then i=(i+1)%3 end
if is_key("menu") then look(1) end -- oder Alt-Modus für Einstellungen verlassen.
if is_key("display") then --<-- use Your key!
-- a=(a+1)/2; b=(b+1)/2 end --oder
if a>1 then a=a-1 end
if b>1 then b=b-1 end end
repeat sleep(222) until get_alt_mode()
until (h==0) and (is_key("shoot_half") or (X>0)) --!
g=3; if i==2 then g=1 end
wait_click(999)
return a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p
end
--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
--- :Anwendungsbeispiel
function restore()
set_aelock(0); set_aflock(0)
print(Z,-collectgarbage("count"),-get_vbatt())
end
if t~=nil then local
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,I,Z=... end
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p=
place(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,0)
local t=1000
if I==nil then I=1 end
if Z==nil then Z=t end
collectgarbage()
print(collectgarbage("count"))
sd1=look(1)
repeat local T=get_tick_count()
h=md_detect_motion(a,b,1, d, e,f,g,h,i,j,k,l,m,n,o, p)
while h>0 and get_alt_mode() do
if n==0 then -- Auslöseverzögerung mit Bewegungsfilter
repeat local hh=md_detect_motion(place(7,7,1,90,30,1,2,0,0,1,1,7,7,0,2,16,1)) until hh==0
sd1=look(1)
shoot(); sleep(t) end --- < Ixus300HS (lowlight):....> Kamerafehler E26,shutdown
-- S90 & G7 seltsam
-- sd870 anders seltsam
if n==9 then sleep(tv96_to_usec(get_tv96())/t)
release("shoot_full") end
if get_tv96()<1 then sleep(tv96_to_usec(get_tv96())/t) end--Zeit f. Darkframe, rettet E26 ??
h=-1 end --wh else
while h==-1 and get_alt_mode() do Z=Z-1
repeat h=h+1
sd2=get_free_disk_space()
play_sound(4); sleep(t)
until (sd1>sd2) or (h==6)
if h==6 then playsound(6); sleep(t) else sd1=look(1) end
sd1=look(1) end--wh
repeat sleep(t) until get_alt_mode() and ((get_tick_count()-T)/t>I)
while is_pressed("menu") do sleep(42); II=II end
until (Z<=0) or (get_vbatt()<3333) or (get_tv96()<0)
restore()
--[[ ubasic Version via gosub "##place"
:##place
do
T=get_tick_count+20
md_detect_motion a,b,c,200,e,f,random 1 3,h,i,j,k,j+(a%2=0)-(a=2),k+(b%2=0)-(b=2),0,o,9
if h*(z=0)*(f<99) then print get_capture_mode,f,"(";a;"*";b;") ",h,T-get_tick_count
j=(j-is_pressed "left"+is_pressed "right"-(j>a))|(j<2)
k=(k-is_pressed "up"+is_pressed "down"-(k>b))|(k<2)
a=((a+is_pressed "zoom_in")%13)|(a<2)
b=((b+is_pressed "zoom_out")%13)|(b<2)
i=(i+is_pressed "set")%3
if is_pressed "menu" then gosub "##look"
until is_key "shoot_half"
if i=2 then g=1 else g=3
l=j+(a%2=0)-(a=2)
m=k+(b%2=0)-(b=2)
sleep 999
return
]]--
--- +
--- (7,7,1,60000,20,2,1,0,2,4,4,4,4,1,2,16,10,100
- Code: Alles auswählen
--[[
@title nd_test.Lua
@subtitle :...,....1....,....2....,....3....,....4....,....5
@param N ND AUS ein
@values N AUS ein
]]--
for i=1,9 do
set_nd_filter(1+i%2)
click("shoot_half")
print (i,-get_av96(),-get_tv96())
wait_click(999)
sleep(999) end
set_nd_filter(2-(N or 0)%2)
sleep(2018)
_______________________________[ "~~~^^~~~~~~~~~~~~~~~...
Kleinigkeit mit aufschlußreicher Log-Datei
...~~~~~~~~~~~~~~~^^~~~" ]______________________________
- Code: Alles auswählen
--[[
@title enviriX.lua
@chdk_version 1.4
@param o Zahl:
@default o 0
]]--
Mem=collectgarbage("count")
print("---",o,-Mem)
print_screen(9999)
print("--- < enviriX.lua; Mem",collectgarbage("count"),o)
print("--- < ",os.date())
if t==1000 then print("--- < ",...); o,x=... end
o=tonumber(o) or 0
x=0
if o>=0 then print("--- > ><@}{fun><0}{0x><0}{") end
set_console_layout(0,0,50,14)
for ee,lin in pairs(_G) do x=x+1
if o>=0 then print(ee,lin) else print(ee) end
while is_pressed("menu") do sleep(200) end
sleep(99) end
print("--- ::",x,"Mem",collectgarbage("count"))
collectgarbage()
set_console_layout(0,0,25,5)
print_screen(0)
wait_click(99)
wait_click(9999)
_______________________________[ "~~~^^~~~~~~~~~~~~~~~...
& ein einfacher Zeilensortierer
...~~~~~~~~~~~~~~~^^~~~" ]______________________________
- Code: Alles auswählen
--[[
@title sortiX.lua
@chdk_version 1.4
@subtitle :...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;....
@param s ??? >|<
@default s 0
]]--
function fsort(s,sfil)
local lin,x,X,S,abs={},0,0,0,s
if s<0 then abs=-s end
for ee in io.lines(sfil) do if abs<#ee then
if s~=0 or ee~=lin[x] then x=x+1; lin[x]=ee; S=S+#lin[x] end
end end
print("--- < ",collectgarbage("count"))
collectgarbage()
table.sort(lin); X=x
if s<0 then repeat print(lin[x]); x=x-1 until x<=0
else repeat print(lin[X-x]); x=x-1 until x<=0
end
lin=nil
return -X,S end
if t==1000 then sfil,s=... end
s=tonumber(s) or 0
if io.type(sfil)~="file" then sfil=file_browser("A/CHDK/LOGS/") end
if sfil~="A/CHDK/LOGS/LOG_0123" then print_screen(0123) else print_screen(0124) end
print("--- < ",collectgarbage("count"),sfil,fsort(s or 0,sfil))
collectgarbage()
print("--- < ",collectgarbage("count"))
print_screen(0)
EsGibtKeinenErdaufgangAufDemMond! SoSimpel...