[Lua] portable Entwicklungsumgebung für Windows

CHDK-Skripte, CHDK-Entwicklung, PC-Zusatzprogramme, Informationen für Tüftler

Re: portable Entwicklungsumgebung für Windows

Beitragvon rudi » 29.11.2017, 18:43

neue Version 4.1.010 mit folgenden Änderungen:
  • Update auf chdkptp Rev. 787
  • keypad.exe, Version 0.4.3, änderbare Hintergrundfarbe im Display mit Klick auf den Displaybereich
  • Hintergrundbild in Graustufen geändert
  • Formatkorrekturen in keypad.au3, grid_viewer.lua
  • liesmich.txt, readme.txt aktualisiert
Die Datei befindet sich im ersten Beitrag.

Gruß rudi
Benutzeravatar
rudi
CHDK-Spezialist
CHDK-Spezialist
 
Beiträge: 510
Registriert: 11.09.2009, 11:27
Kamera(s): A590IS_101B, SX260_100B

Re: portable Entwicklungsumgebung für Windows

Beitragvon rudi » 11.12.2017, 22:14

neue Version 4.1.011 mit folgenden Änderungen:
  • Fehlerbehebung für CHDK-Schlüsselwortliste, Grund: unmaskiertes "<" und ">" in XML-Attribut der Datei stylers.xml ab NPP 7.5.x
  • Aktualisierung auf NPP 7.5.3
  • Aktualisierung chdkptp Lua-Dateien auf Rev. 792
  • Aktualisierung CHDK-Dateien auf Rev. 4957
  • lokale Kopie der LUA-Dokumentationen Lua 5.1 [en], Lua 5.2 [en] und Lua 5.1 [de] in NPP-Menü "Ausführen" hinzugefügt, Quellennachweis in /docs/lua/source.txt
  • liesmich.txt, readme.txt aktualisiert
Die Datei befindet sich im ersten Beitrag.

Gruß rudi
Benutzeravatar
rudi
CHDK-Spezialist
CHDK-Spezialist
 
Beiträge: 510
Registriert: 11.09.2009, 11:27
Kamera(s): A590IS_101B, SX260_100B

Re: portable Entwicklungsumgebung für Windows

Beitragvon rudi » 05.11.2018, 12:27

neue Version 4.1.012 mit folgenden Änderungen:
  • Aktualisierung 7zip auf Rev. 18.05
  • Aktualisierung chdkptp auf Rev. 795,lua scripts Rev. 844
  • Aktualisierung CHDK-Dateien auf Rev. 5104
  • Aktualisierung Notepad++ auf Rev. 7.5.9
  • Aktualisierung NppExec auf Rev. 06-RC2
  • NEU: stdeditor.cmd - Funktion zum Umschalten von hostluaPortable als Windows Standarteditor, ab NPP 7.5.9, Funktionalität in stdeditor.vbs, mit UAC und evtl. REG-Sicherung
  • camera_funcs.lua um rawop erweitert, fehlende Farbdefinitionen
  • Skript hostlua_info.lua - Ãœberarbeitung und Erweiterung um Bibliotheken und Aufrufkonventionen
  • Aktualisierung Autovervollständigung und Schlüsselwortliste
  • Syntaxprüfung bei lua-local und lua-remote erfolgt nicht mehr über temporäre Datei
  • liesmich.txt, readme.txt aktualisiert
Die Datei befindet sich im ersten Beitrag.

Gruß rudi
Benutzeravatar
rudi
CHDK-Spezialist
CHDK-Spezialist
 
Beiträge: 510
Registriert: 11.09.2009, 11:27
Kamera(s): A590IS_101B, SX260_100B

Re: portable Entwicklungsumgebung für Windows

Beitragvon Caefix » 23.02.2019, 20:15

portable %ENTWICKLUNGSUMGEBUNG% für Windows
frei interpretiert & choreographiert...
---------------------------------------
<<< Process finished. (Exit code 0)
--[[Sorry, Spoileralarm, ... da bewegt sich was ...]]--

--[[ If and only if You a coin in the SD-slot stuck have then and only then are You here sowhat from false; return tohandy end ]]--
--[[ elseif You the three green lines from page 1 mastered have or too not then You could one mouseevent more invest and enjoy(...) ]]--
--[[ (Lua)Skripten ohne hostluaPortable ist digitale Askese, fast wie Canon ohne CHDK.]]-- #-o
--[[ Das ist für jeden Skripter was, der eine Kanone (trans)portieren kann, sogar rückwirkend vermisse ich das noch... ]]--
Syntax: [ Download ] [ Verstecken ]
Benutze Lua Syntax Highlighting
--- < ~~~~~ >
--- <  \./~ >
--- <   I   >
--[===========[
@title scriptiX.Lua
@chdk_version 1.4
--- Speichermangel bei Ix230HS, [SX210is: NICHT MEHR MIT-1.5.0-5163]
--- (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 D Startordner
 @default D 0
 @values  D SCRIPTS LOGS BOOKS HELP (.scX)
@param    E E Endung
 @default E 0
 @values  E .Lua .bAs >>.tXt .baK .tmp .lOg .scX .XxX
@param    H H Helfix
 @default H 0
 @values  H --- HELP/ LOGS/ SCRIPTS/ BOOKS/ german ???
@param    T T Trix & Errorix
 @default T 0
 @values  T --- ???
@param    P P process  +ab|0>_|-letzte
 @default P 1
@param    L L edit Zeile  xxx>_ (!-=^^=!)
 @default L 0
@param    F Find_str  [find[><rep]]
 @default F 0
 @values  F --- fun() for while until then else ---><: WOODTXT #^^%q%q
@param    R R --- /rem Zeilen?
 @default R 2
 @values  R KEEP -cut- >Parse
@param    I I *?* Insertix
 @default I 0
 @values  I nein JA
@subtitle :...,....1....,....2....,....3....,....4..
@param    J J Layoutix?
 @default J 0
 @values  J nein JA
@param    C 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 99999
@param    G G LOG_~.TXT (|0=gec|+Neu|-Anh)
 @default G 0
@param    W W Laufzeitbremse (-1=noEcho)
 @default W 4
@subtitle DON&#39;T PANIC!
@param    U U {}@   (|0 bei lowMem)
 @default U 1
--]===========]

--[ [--:) [PC] z.B. wenn man scriptiX selbst oder extern (scryptiX) starten möchte. _HLP
if not sleep then _HLP=O==O; function compat()
 function get_exp_count(...)
   return ... or 9999 end
 function get_tick_count(...)
   return ... or 0 end
 function get_image_dir(...)
   return ... or "" end
 function console_redraw(...)
   return ... end
 function set_console_layout(...)
   return ... end
 function file_browser(s,...)
    print (">Startup dir:<", s,...); io.stdout:flush()
   return io.stdin:read() or "" end
 function play_sound(...)
   return ... or 4 end
 function sleep(...)
   return ... end
 function is_pressed(...)
   return nil end
 function wait_click(...)
   return ... or 9999 end
 function textbox( t, m, d, l) --line 825
    print (">Title:<", t)
   if t and m and not t:find(m,1,1) then
    print (">Message:<", m) end
   if d and m and (m~=cut(d)) then
    print (">Default string<", d) end
    local res = d; io.stdout:flush()
    res=d or io.stdin:read()
    return res or "" end
-- if not unpack then function unpack(t)--Lua 5.3
--    return table.unpack(t) end end
print(_VERSION,compat)
end compat() end--]]--
--- :

--print_screen(-112)
--function restore(x) return x end
 
function help(...)
local x=0
 if G<21 then for ee,lin in pairs(_G) do x=x+1
    if G*G<111 then
       if G*G%2==0 then golog(ee) else
       golog(stf([[%s %q]],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 return x 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
 if _HLP or G*G<111 or type(...)=="table" then output(12,...) else
  print_screen(l)
  set_console_autoredraw(-1)
   print(...)
  set_console_autoredraw(1)
  print_screen(0) end
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 str,dd.."/"
end
 
function klix(x,...)
 collectgarbage()
--[ [--:)<<LowMem Notschalter
 shoot() -- Da geht dann [SX210is wg. Speichermangels aus: NICHT MEHR MIT-1.5.0-5163]
 dd,mdI=img_info(t,...)
local str=... or &#39;&#39;
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
    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) end
        output(1,stf("%s\n %s",i,os.date()))
        if lstr(1,str)=="?" then
        output(1,textbox(basline,...," Motiv:",t) or " cat!") end
        str=&#39;&#39; 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(333)
 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")
 w=get_tick_count()
 repeat wait_click(10)
 until not is_pressed "right"
 w=(get_tick_count()-w)/100
 if w>2 and w<22 then W=w end
 if w>40 then pau=t end
 if is_pressed "down" then sleep(199)
    collectgarbage()
    if (W>0) and (Li>0) then W=W-1 end end
return w
end
 
 
 
 
function lstr(x,...)
--if type(...)~="string" then error([[ EYn ^VV^ildsch^vv^eYn! ]],2) end
  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 and string.find(s,"%",1,1) then
   return assert(string.format(setarg(...)),...)  end
return ...
end
 
function cut(...)
if not ... then return "\t" end
local x,str=0,tostring(...)
   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("  ") 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,&#39;&#39;,...
  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)==&#39;-&#39; 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 or &#39;,&#39;,...
  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) or 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 getkey(1,x[1])
     if x[1]==nil then--x==_G then
        for ee,lin in pairs(x) do X=X+1
            if G*G%2==0 then arg[X]=ee else
            arg[X]=(stf([[%s%s%s]],ee,s or seP or &#39;,&#39;,lin)) end end
        table.sort(arg)
        if s then output(13,arg)
        return unpack(arg) end end
     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==&#39; &#39; then s=cut(s) end
     repeat X=X+1; arg[X],s=split(sep,s) until s==&#39;&#39; 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,t,str=0,2<1,stf(...)
if not tonumber(f) then str=f; f=9 end
  while type(f)=="number" do if
   f<0 then newline(0,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 elseif
   f==3 then f=mdX.."!Environ.tXt" --elseif
        else print(str); f=f%10; t=1<2
          if f>3 then return 0 end end--if f
   end--wh
 --  print(' -->',f,'--')
  local out=io.open(f,"a") or io.open(erriX,"a")
  if type(str)=="table" then
     if str[1]==nil then
        for ee,lin in pairs(str) do
          if t then print(ee,lin) end
          out:write(ee..(seP or " ")..tostring(lin).."\n") end
        else repeat X=X+1
          if t then print(str[X]) end
          if str[X]~=nil then out:write(str[X].."\n") end
        until X>=#str end
     else X=1; out:write(str.."\n") end
out:close()
return X
end
 
 
--- :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
 
function begin(...)
local bn=BN or "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 X%100==0 then wait(0) end
       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,"^VV^ildsch^vv^eYn?") end
   collectgarbage()
 
   if RW then wait(0)
      if eXt==".scX" then os.mkdir(lstr(-1,mdX)) end
      if eXt==".XxX" then bn="xyx00xyx" else
      if type(E)=="string" then
         if E:find(&#39;.&#39;)==nil then eXt=".tXt"; E=E..eXt; wa=&#39;a&#39; end
         if lstr(2,E)~="A/"  then E=mdX..E end
         basfile=E; bn=E else
         --if _HLP then bn=" Enter Target:" end--:)
--- -         if not _HLP then bn=" |\\"..bn end-- die Striche können weg, sonst getstr...
         bn=textbox(stf("%d rw%d %s",collectgarbage("count"),R,dd..pc..eXt)
           ,os.date(),bn,9) or ""; wait(0) end end
      if bn=="" then basfile=erriX else
         if tonumber(bn)~=nil then return 3 end
         if bn==" " then bn="!!IXIXIX" end
         if lstr(2,bn)~="A/" then basfile=mdX..bn..eXt end end
      if lstr(1,bn)==" " then ch4=string.sub(bn,2,1)
         basfile,K=getfile(dd)
         if K==3 then return 3 end end
      if log42==basfile then basfile=mdX.."tempX"..eXt
         print("*<< = >>--->"..basfile.." >") end
      if log42==basfile or bn==&#39;&#39; 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
      find_str=find_str or "><" 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=bn
return 0
end
 
function nubas(camera_name)
local n=camera_name or "PC"
txt=io.open(log42,&#39;r&#39;); Li=0
if RW and not TF then Lo=0
   bas=io.open(basfile,wa)
   RV=P==P; writeln(rem.."< scriptiX für "..n.." >")
   RV=P==P; writeln(rem.."< "..log42..&#39; -- '..os.date().." >") end
end
 
function head(...)
if ...~=nil then print(...) end
local bi=_HLP and "PC" or 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 %s >",remV,ee,string.upper(bi.platform or "You")) end
end
 
 
function readln(...)
local x=0
zeile=...
if Z-C*rw>Li then
   if txt==nil or Li<0 then zeile=edlin(zeile or "") 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,...)
return ... end
--[[-- Ubasic spec. only
local E,str=0,...
   lenz=string.len(...)
   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(&#39;!!! &#39;,...) end
   if W<0 then return (...) end
local str=...
--print(Li,Lo,pc,str..";")
   while (R==2) and rstr(3,str)==&#39;---' 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..&#39;;&#39;,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
   if find_str=="" and isfile(mdX..rep_str) then str=filter(str)
      else if #find_str>0 then
          str=fire(find_str,rep_str,...) end end 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,erriX)
      bas=io.open(erriX,"w"); basfile=erriX 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,"tail")
 for i=1,rw do K=x or getkey(2200)
   if K==2 and isfile(erriX) then fcopy(24,erriX) end
   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)
 if _HLP then return end
 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)
  if _HLP then str=io.stdin:read() end
  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(&#39;,&#39;,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,...) -- CAM only (wg."Environment" _G)
local str=...
if not tonumber(x) then str=x; x=Li or 0 end
if str==nil then
   str=edlin(""); wait(0) end
   --str=textbox(log42,cut(...),...,t) or "" end
local i=#str
if i>2 then
   local as,K=0,0
 --  print("--.- \%"..str)
     if isfile(split(&#39; &#39;,str)) then run(6,str)
     else as=assert(loadstring(str,str))() end
     print(str); wait_click(t,"dostr")
  if as~=0 then i=-i else
     K=getkey(5,stf("%d: %s",x,str)); ch4="E" end end
return i,K
end
 
function edlin(...)
if NE then return (...),tonum(1,...) end
--if not ... then error(' EYn ^VV^ildsch^vv^eYn!',2) 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==&#39; &#39; 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)~=&#39;;&#39; then str=&#39; &#39; end
        else K=0 end end
  if lstr(1,str)==";" then Go=golog(str) end
  if ce==&#39;)&#39; and lstr(1,str)==&#39;(&#39; 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.
 -- Adapterzeile  f. SHOOT.lua: a=a or 2
 --   -- " --     f. EDI.lua: a=a or 0; b=b or 0; n=n or 0; s=s or 1; x=x or 44; y=y or 13
 -- Diese können auf der CAM (wg. Environment _G) auch hiesige functions aufrufen.
--- -
--[ [--:)
function run(K,exe,...)
local ex,ret,str=0,"",...
local d,e,h,tt,p,l,f,r,i,j,c,a,z,g,w,u,y,ti=
      D,E,H,T, P,L,F,R,I,J,C,A,Z,G,W,U,Y,0
local Rem,pC,bf,l42,li,lo,sr,sw,rW,go,tO,ii,sep,x=
      rem,pc,basfile,log42,Li,Lo,size_r,size_w,rw,Go,TO,II,seP,X
 
 t=1000
 if not tonumber(K) then exe=K; K=5 end--:)
 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 io.type(txt)=="file" then txt:close()
    if (Lo or 0)>0 then bas:close() end end--RW
 Li,J,A,C,Z,rC,s=-t,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,Li=split(" ",fpath(exe))
    if Li~="" then arX=Li end end
 if (K==2) and arX~="()" then
    arX=textbox(cut(basline)..lineal,exe,arX,t); wait(0) end
 arX=arX or ""
 collectgarbage()
 print_screen (-44)
 
   print(&#39;--- '..os.date(),-K)
   if string.sub(arX,1,2)=="  " then arX="" end
   if K==0 then K,ti=getkey(2,"-+- "..exe) end
   if ti>555 then exe=sX end
   print(rem,K,Li,Lo,exe,arX,-collectgarbage("count"))
   --[= =[--PC
   if _HLP then
      if K<0 then print(exe,&#39; &#39;,arX)
         repeat K=K+1 until isfile(exe) end--:)
      if lstr(2,exe)~="A/" then K=t
        os.execute(&#39;%COMSPEC%/T:4E/C&#39;..exe..&#39; &#39;..arX) end
      end --]==]--
   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==7 or _HLP then seP=&#39;,&#39;
         ex,ret=pcall(gsub,setarg(arX))
         print(&#39;----',ex,ret) else
      if K<3  then ex,ret=assert(gsub)(arX) end
      if K==3 then ex,ret=assert(gsub)(...) end
      if K==4 then ex,ret=assert(gsub)(D,8,2,9,1,-2,F,0,0,0,0,0,0) end
      if K==5 then seP=&#39;,&#39;; ex,ret=assert(gsub)(setarg(arX)) end
      if K==6 then ex,ret=assert(gsub)() end
   end end
 
   arX=arX or ""; str=str or exe
   if K<=t then newline(0,"--- ? "..str.." ("..arX..")") end
   if K>=t then writeln("--- ? "..str.." ("..arX..")") end
   print(-K,os.date(),-collectgarbage("count"))
   getkey(1,ex,err,Li,Lo,lineal)
 
 print_screen (0)
 collectgarbage()
 pc,basfile,log42,Li,Lo,size_r,size_w,rw,Go,TO,II,seP,X,rem=
 pC,bf,l42,li or -2,lo,sr,sw,rW,go,tO,ii,sep,x,Rem or &#39;--- '
 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)
 if not _HLP then 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) end
 if Li>0 then
    for x=1,rw do bas=io.open(basfile,&#39;a&#39;) end
    txt=io.open(log42); for x=1,Li do txt:read()
    if x%42==0 then collectgarbage() end end end
    wait(W+1)
return ex,ret,err
end --end
---*]]
 
 -- ...stenographische Elemente...
function filter(str,fil)
fil=fil or rep_str
while type(fil)=="number" do
   if fil==0 then fil=rep_str elseif
      fil==1 then fil="complete.tXt" elseif
      fil==2 then fil="shortcut.tXt" elseif
      fil==6 then fil="edlin.tXt" --elseif
      else fil="wood.tXt" end end
if not isfile(fil) then fil=mdX..fil --fil=fpath(fil)
if not isfile(fil) then return str end end
--[ [--:) _HLP
if _HLP and not WOOD then WOOD={setarg(fil)} end
if WOOD then for x=1,#WOOD do K=t; --print(collectgarbage("count"))
       str=fire(WOOD[x],seP,str) end; K=0 else --]]--!
   for wood in io.lines(fil) do K=t
       str=fire(wood,seP,str) end; K=0   end --;)
collectgarbage()  -- end --:(!
return str
end
 
 --- >^function fire><|
function fire(find,rep,...)
local K,str=K,...
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==&#39;"' then find,str=split('"&#39;,str,1,1)
   return split(&#39;"',str,1,1) end
if rep==seP then find,rep=split(seP,find)
   if K==t and lstr(2,find)=="
--" then return str end 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
      if rep=="#" then find_str=find; rep_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
        if lstr(1,rep)==";" then str=str..rep
        else if repZ>-1 then str=string.gsub(...,find,rep) end end
        end end
return str
end
 
function ch_block(get1,ch2,st3,...)
if _HLP and string.find(&#39;%&?!;&#39;,ch2,1,1) then return zeile end -- CAM only
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("><") then find_str,st3=split("><",st3) end
     ch2= "_" end
  if ch2=="_" then WOOD=nil
     if st3:find("}{") 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(Li,stf([=[ee=%s]=],st3))
        else dostr(Li,stf("ee=[[%s]]",st3)) end
     dostr(-Li,ee); K=getkey(2,ee)
     if K==2 then ee=stf(&#39;%s&#39;,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(&#39;--- +')
                 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 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) 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)
if R==2 then --- 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 K=0 --:)
      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 --if R==2
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,str="NIL",type(f)=="string" and os.stat(f) and (io.open(f)~=nil)
 --[[-- not _HLP
 local x,is,str="NIL",pcall(io.open(f)) -- nett, aber G7 &
 is=str:find("userdata")~=nil           -- Ix900Ti gehen 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 ""
local dd,dir=&#39;&#39;,
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,"--- ^nofile:"..f end
  if path~=nil then dir=path..&#39;;&#39;..dir end
  repeat dd,dir=split(&#39;;&#39;,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
  ee=ee or &#39;ä&#39;
  if lstr(2,ee)~="A/" then dd="A/CHDK/" end
  if rstr(1,ee)~="/" then ee="SCRIPTS/" end
  if dd~=ee then dd=dd..ee end
 
  repeat E=-1
     repeat ee=file_browser(dd) or ""; wait(1)
        E=E+1 until ee~="" or E==3
     if _HLP and not isfile(ee) then ee=dd..ee end
     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,[[&#39;="\\";=*;=&#39;]]))
        if T==1 then II=II end end
  until E==0 or E==3
return ee,E
end
 
function getstr(chr,...)
local K=1
local str=...
--if not str  then return "" end
  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 or "X" 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)=="\13" then str=lstr(-1,str) end
  if lstr(2,str)=="A/" then
     while str:find(".",3,1)==nil do str=getfile(str)
        if _HLP then break end 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 str and K*#str>1 then str=textbox(cut(basline),cut(zeile),str,t) end
  wait(1)
if str and #str==1 then ch4="E" end
--getkey(5,chr..ch4)
return str
end
 
 
function getkey(x,...)
local K,ti,t=0,0,1000
--print('--',...)
--if ...~=nil then print(stf('*<%s>',...)) end
if ...~=nil then print(setarg("*<",...,">")) end
if x<t and W and P and (W<0 or P==t*t)
and not _HLP then
   print("*<",... or zeile,">") end
collectgarbage()
--[==[--:)
if _HLP then io.stdout:flush()
   K=tonum(io.stdin:read(2)) -- or 0
  -- print(remV,K) -- zB auch 02040042
 --if K==42 then II=II end etc.. _HLP
   end
--]==]--
if _HLP then return K,0 end
x=x or 42
if x<10 then sleep(33)
      console_redraw()
      repeat wait_click(9) until is_key "no_key"
   if x<8 then play_sound(x) end
   wait_click(t*t,"getkey")
   if x~=8 then sleep(123) end end
if x>t then wait_click(x); K=x%100 end
 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(prompt,42,basline) and 0 or t 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(5); 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 menux>"); 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 and _HLP or get_alt_mode()
return K,ti
end
 
function submenu(K)
II=II --opt. Touchscreen?
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)
-- Zum Experimentieren:
print(D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y); --error('##',2)
--print('--- <',collectgarbage("count"),'>',type(...),setarg(...))
--G=7; print('--- <',collectgarbage("count"),'>',setarg(_G," "))
if arg then print(&#39;--- <',collectgarbage("count"),'>',#arg,...) end
 
local function restore(...)
 D,E,ee=0,0,... or os.date
 if not _HLP then
    set_aelock(0); set_aflock(0)
    set_console_layout(0,0,25,5)
    set_console_autoredraw(1) end
 if Li>=0 then
    if RR then txt:close()
    if RW then bas:close() end end end
 print(U,"scriptiX:",Li,Lo,-Error)
 K=getkey(2004,collectgarbage("count"),...)
 collectgarbage()
return ee
end
 
t=1000
arX=(...)
mdI=""
mdX="A/CHDK/SCRIPTS/"
sX=mdX.."scryptiX.Lua"
if compat or not isfile(sX) then sX=mdX.."ScriptiX.Lua" end
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/"}
--if type(D)~="number" then error([[ EYn ^VV^ildsch^vv^eYn! ]]..tostring(D),2) end
  --(~~[[File not found:]]
   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 else eXt="" end
eXt=eXt or ".eXt"
if eXt==".lOg" then mdX="A/CHDK/LOGS/" end
if eXt==".scX" then mdX="A/CHDK/LOGS/logiX/" 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=((type(E)=="string") or (E>=0)) and (C>=0)
TF=2<1
TO=A==0
NE=A<0
WP=W<-1
 
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 hfil==nil and H>0 then H=-H end
if find_str==nil then
   find_str="@title><" end
rep_str=""
erriX=erriX or mdX.."erroriX.tmp"
arX=arX or "(...)"
pc=pc or "> "
pau=pau or 0
lineal=lineal or ":...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,...."
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--]]--
if not _HLP then
   set_console_layout(0,0,45,14) end
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) end
     --if ch4=="/" then P=0; Z=-t end
 
  if_x=t; wait(1)
for x=A,P-1 do readln(); writeln(zeile) end--CGA unnötig?!
 --  print(-P,CGC)
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
-- if _HLP then basline=string.reverse(basline) end--:)
   --if basline:find(':\\',2,1) then basline=rstr(-3,basline:gsub("\\","/")) end -- -19--:)
  -- while basline:find("    ") do basline=basline:gsub("    ","\t") end
   --while basline:find("\t") do basline=basline:gsub("\t","    ") end
         writeln(basline)
         if W>0 then collectgarbage() end--!!
--- -         if pau>t then run(6,sX," D,4,8,9,1,-2,F,2,1,0,0,0,0,G,1,333")--:)DIY)
--- -            K=getkey(2222,not IX,Lo,err) end
end --wh
 
tail()
done()
ee=collectgarbage
restore(ee)
return xpcall(ee,ee)
end--txt2bas
-- end --scriptix(...)
 
 
_HLP=tostring(tostring):find(" 00")~=nil
--[ [--:) hostluaPortable _HLP :...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;....
 
--if _HLP and (is_key "up" or 1) then _HLPK=1<2 end
 --find_str='function' --
if _HLP then find_str=&#39;_HLP&#39; end-- "space"? -->>
-- find_str='textbox' --
--G=7; help()
 --run(6,"A\\CHDK\\SCRIPTS\\envirix.lua") --NOGO
 --run(7,"A/CHDK/SCRIPTS/envirix.lua") --NOGO
 
--LUA_INIT='A/CHDK/SCRIPTS/luaInit.lua'
--LUA_INIT='A/CHDK/SCRIPTS/luaInit.lua'
--LUA_INIT=printf('%s',textbox('LUA_INIT',tostring(tostring),LUA_INIT,99))

--if _HLP then ?Voodoo? end --:) Using CHDKhostlua-npp+++ in 30 lives todorial.

-- Enter next level!
-- get_shooting() or not get_shooting()?     Caefix 22.03.19

if LUA_INIT then --t=1000
   print(LUA_INIT)
   if isfile(LUA_INIT) then print(run(5,LUA_INIT))
      else dostr(-1,LUA_INIT)
   OOO=U
end end
 
 
--[=[--:)  
function testprog(...)
print(&#39;--- <- BEGIN testprog',...)
--)
 --G=7; help()
print(&#39;Mem=&#39;,collectgarbage("count"),...)
collectgarbage()
dostr(99,&#39;T=99; print("T=",T)&#39;)
print(" Hier könnten Deine Zeilen sein...")
local x,y,z=run(5,"A/CHDK/SCRIPTS/luaInit.lua abc,_HLP,...")
--local x,y,z=run(6,file_browser('A/CHDK/SCRIPTS'))
print()
 print(&#39;>> Mem=&#39;,collectgarbage("count"))
return print(x,&#39;--- <- ENDE testprog:',setarg(y),z)
--)
end    print(testprog(setarg(...),_HLP))
--]=]--
 
--[==[--:)
if _HLP then function errorism(...)
   if lstr(2,find=="--") then return ... end
end errorism() end
--]==]--
--]]-- hostluaPortable :...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....
 
 
 
if not _HLP and Z and U then
              repeat IX,K=pcall(scriptix() or ":)")
              K=getkey(2002,IX or K); P=1
              until K<21
 
else --OOO=U--:) test _HLP @default
     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
mdX,mdI="",""
if pc==nil then pc="| " else pc="0"..pc end
print("D=",D," type:",type(D),pc,XXX)
print("E=",E,"H",H,"Mem:",collectgarbage("count"),_HLP)
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
--- :
--[= ===[ Makro--:)                 []CONSOLE[PC]      HostLuaPortable _HLP
--Text v.Console heraufziehen O.K, nach hinab (zu StdIn) >>Bearbeiten Rückgängig!
--if compat then P=0 end
 if _HLP and not compat then
  --[= =[--
    local mdC="%WINDIR%\\system32\\"
    os.execute(&#39;set PATH=%cd%\\;%PATH%;C:\\WINDOWS\\system32\\&&echo --%PATH%')--NOGO
    os.execute(&#39;echo %PATH% &&cd&& dir/b&#39;)
   -- os.execute('echo %COMSPEC% /T:1F/K type %0 %*>%cd%\\ListiX.Cmd')
    os.execute(&#39;echo.if %~x1?==? (cmd /T:4E/Kdir/b/ad/s/on %1) else (cmd /T:1F/Ktype %0 %*)>%cd%\\ListiX.Bat&#39;)
    os.execute(&#39;dir /b/s *.Lua>LuaDiriX.tXt&#39;)
    os.execute(&#39;dir /b/ad/s/o/n|&#39;..mdC..&#39;find.exe /I "X"&#39;)
    os.execute(&#39;%COMSPEC% /Z/?&#39;)
    os.execute(&#39;for %a in (%COMSPEC% assoc ftype call) do %a/?&#39;) --:)
    os.execute(&#39;echo.for %%a in (start assoc ftype call goto exit copy del dir if for in do md rd path cd pushd popd ren set setlocal endlocal shift echo color type rem verify) do @%%a/? %~1%cd%\\cmdHLP.Cmd>%cd%\\cmdHelp.Cmd&#39;)
    os.execute(&#39;echo cmd /T:0E/K type %0>%cd%\\cmdHLP.Cmd&#39;)
    os.execute(&#39;%COMSPEC% /?>>%cd%\\cmdHLP.Cmd&#39;)
    os.execute(&#39;%COMSPEC% /C%cd%\\cmdHelp.Cmd ">>"&#39;)
    os.execute(&#39;echo %date% : %time%>>%cd%\\cmdHLP.Cmd ">>"&#39;)
    os.execute(&#39;assoc && set&#39;)
    os.execute(&#39;@echo --%CMDCMDLINE% [%CMDEXTVERSION%] %CD% (%ERRORLEVEL%)')
  --]==]--
    BN="fertIX"; P=0 -- 01 oder ..
    E=0; H=-1; F=0; A=1; W=0;  --U=42--:) MemWatch
    D="A/CHDK/SCRIPTS/SCRIPTiX.LUA"
  --  D="A/CHDK/SCRIPTS/fertiX.LUA"; P=1
  --  D="A/CHDK/SCRIPTS/tempX.LUA"
--    D="A/CHDK/SCRIPTS/YourProg.LUA"
--    D="A/CHDK/BOOKS/LuaDokde.tXt"; P=1
  --    D="A/CHDK/BOOKS/LuaDiriX.tXt"; P=1
--    D="A/CHDK/SCRIPTS/MyDir.tXt"; P=1
  --  D="npp\\plugins\\APIs\\lua.xml"; P=1; find_str='"><"'
 --   D="A/CHDK/BOOKS/KeyWords.Lua"; P=1; E=-1; A=0; find_str='"><^'
  --  D="A/CHDK/SCRIPTS/SCRiPTiX.LUA"; P=01; find_str='><WOOD.TXT'
    if isfile(TAG) then D=TAG end
    if _HLPK then P=t*t end
 end
--]====]--
--- :
 --P=0
 if E==nil then D=nil end
 D=D or 0    ---  1=/LOGS/
 E=E or 0    ---  2=>>.tXt; =anhängen
 H=H or 0    --- Helfix
 T=T or 0    --- Testschalter
 P=P or 1    ---  0=>t*t; nur Suche&edit
 L=L or 0    --- edit in_Zeile Nr.
 F=F or 1    --- edit out_Textsuche
 R=R or 2    ---  2=rems auswerten
 I=I or 1    --- *? Zeilen -"-
 J=J or 0    --- Vorsicht!
 C=C or 0    --- -= ReadOnly
 A=A or 0    ---  0=Ohne Zeilenummern
 Z=Z or t*t  --- =|0=crLf|-letzte
 G=G or 0    ---  0=LOG_get_exp_count().TXT
 W=W or 4    --- wait
 U=U or get_exp_count()
 
if not XXX then
if not UUU 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 Y=Y or 0
            IX,K=scriptix(D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y)
       else wait_click(W*t,lineal)
               repeat IX,K=xpcall(scriptix(),scriptix())
               -- wOw? *< error in error handling > [?That´s ttoo human!]--
               K=getkey(4002,IX or K); P=1
               until K<21 end end
 --print(D,E,H,T,P,L,F,R,I,J,C,A,Z,G,W,U,Y)
return IX,K
end
 
--- @--:)
--[[
--- >blah
--- blahbla blah --- 88
--- +
--- _sleep(t) ;
--- blahbla blah --- 88
--- +3
--- ---- ---- -
--- ---- _; --false
--- blahbla blah ---88
--- _fasel
--- blahbla blah ---88
    --,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
--- :---------------------------------------
--- @
 
--[=[
print(&#39;--- << BEGIN A/CHDK/SCRIPTS/luaInit.lua (',...,')')
print(&#39;_HLP=&#39;,_HLP,&#39; Mem=&#39;,collectgarbage("count"))
_HLP=tostring(tostring):find(" 00")~=nil
T=123; print(&#39;_HLP,T=&#39;,T)
if not _HLP then
  -- dostr(99,'T=99; print("T=",T)')
   end
print(&#39;--- < END luainit.lua',...)
return T,_HLP
--]=]--

--[[--A/CHDK/SCRIPTS/wood.tXt starten mit Suche "--- >><wood.tXt"
PCGC print(collectgarbage("count"))
CGC collectgarbage("count")
CGA collectgarbage()
z.B. mit Keywords.Lua auffüllen.
and UND
break ABBRUCH
do MACHMALBITTE
else SONST
end ENDE
false FALSCH
for FÃœR
function FUNKTION
--if WENN
--in IN
%Lif WENN
%Lin%L IN
local LOKAL
nil NIX
not NICHT
or ODER
repeat WIEDERHOLE
return RÃœCKGABE
then DANN
true WAHR
until BIS
while WÄHREND
wOw ~
UND soweiter...
TAUSCHE mit wasauchimmer textweit bis "--- _[...]"|"--- >blah[><fasel]"
AUF Reihenfolge achten, sonst isniX!
--]]
--


--[=[ Nützliches für hostluaPortable/bin/camera_funcs.lua  _HLP

function camera_funcs.file_browser(s,...) --line 607
    print(">startup dir:<", s,...); io.stdout:flush()
    return io.stdin:read() or ""
end
 
function camera_funcs.textbox( t, m, d, l) --line 825
    print(">title:<", t)
 if t and m and not t:find(m,1,1) then
    print (">Message:<", m) end
 if d and m and (d~=m) then
    print(">default string<", d) end
 if l and (l<999) then print(">max len:<", l) end
    local res = d; io.stdout:flush()
    if d==nil then res=io.stdin:read() end
    return res or ""
end

-- echo ... good for tracing, not disturbing Camscreen --

function camera_funcs.play_sound(n,...) --481
    print(">beep<", n, ...)
end

function camera_funcs.wait_click(n,...) --577
    print(">wait click<", n, ...)
return n end

function camera_funcs.sleep(n)  --686
    camera_state.tick_count=camera_state.tick_count+n
return n end -- etwa: if sleep(1) then return n end -->2 x OO@@@@

function camera_funcs.print_screen(n,...) --764
    local _n = on_off_value(n)
    if _n == 0 then
        print(">write log file off<",...)
    elseif _n < 0 then
        print(">write log file append<",n,...)
    else
        print(">write log file on: <",n,...)
    end
end


Patch for hostluaPortable/bin/emu.lua (Ende:)
if not status then io.stdout:flush()
--]=]--
[/code]:...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....[  Sowas geht auch! ]:...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;....
<dl class="codebox"><dt>Code: <a href="#" onclick="selectCode(this); return false;" class="postlink-local">Alles auswählen</a></dt><dd><code>--- < scriptiX für PC >
--- < npp\plugins\APIs\lua.xml -- 03/09/19 18:18:56 >
--- < 1000@ | A/CHDK/SCRIPTS/Keywords.Lua ß-259 >
<!-- LUA & CHDK libraries, functions and variables -->
<!-- create by createNppLuaFiles.lua on 11/04/18 10:46:52 -->
1.0
<NotepadPlus>
yes
LUA
      <!-- lua keywords -->
and
break
do
else
elseif
end
false
for
function
if
in
local
nil
not
or
repeat
return
then
true
until
while
      <!-- hostlua -->
_VERSION
assert
collectgarbage
dofile
error
gcinfo
getfenv
getmetatable
ipairs
load
loadfile
loadstring
newproxy
next
pairs
pcall
print
rawequal
rawget
rawset
require
select
setfenv
setmetatable
tonumber
tostring
type
unpack
xpcall
coroutine.create
coroutine.resume
coroutine.running
coroutine.status
coroutine.wrap
coroutine.yield
debug.getfenv
debug.gethook
debug.getinfo
debug.getlocal
debug.getmetatable
debug.getregistry
debug.getupvalue
debug.setfenv
debug.sethook
debug.setlocal
debug.setmetatable
debug.setupvalue
debug.traceback
imath.pi
imath.pi2
imath.pi_2
imath.scale
imath.acosd
imath.acosr
imath.asind
imath.asinr
imath.atand
imath.atanr
imath.ceil
imath.cosd
imath.cosr
imath.deg
imath.div
imath.floor
imath.frac
imath.int
imath.log
imath.log10
imath.log2
imath.mul
imath.muldiv
imath.pold
imath.polr
imath.pow
imath.rad
imath.recd
imath.recr
imath.round
imath.sind
imath.sinr
imath.sqrt
imath.tand
imath.tanr
io.stderr
io.stdin
io.stdout
io.close
io.flush
io.input
io.lines
io.open
io.output
io.read
io.type
io.write
math.abs
math.max
math.min
math.pow
math.random
math.randomseed
os.date
os.difftime
os.execute
os.exit
os.getenv
os.idir
os.listdir
os.mkdir
os.remove
os.rename
os.stat
os.time
os.utime
package.loaded
string.byte
string.char
string.dump
string.find
string.format
string.gfind
string.gmatch
string.gsub
string.len
string.lower
string.match
string.rep
string.reverse
string.sub
string.upper
table.concat
table.foreach
table.foreachi
table.getn
table.insert
table.maxn
table.remove
table.setn
table.sort
      <!-- camera_funcs.lua -->
aperture_to_av96
autostarted
av96_to_aperture
bitand
bitnot
bitor
bitshl
bitshri
bitshru
bitxor
call_event_proc
call_func_ptr
click
cls
console_redraw
draw_clear
draw_ellipse
draw_ellipse_filled
draw_line
draw_pixel
draw_rect
draw_rect_filled
draw_string
enter_alt
exit_alt
file_browser
get_IS_mode
get_alt_mode
get_autostart
get_av96
get_buildinfo
get_bv96
get_config_value
get_curve_file
get_curve_state
get_day_seconds
get_disk_size
get_dofinfo
get_draw_title_line
get_drive_mode
get_ev
get_exp_count
get_flash_mode
get_flash_params_count
get_flash_ready
get_focus
get_focus_mode
get_focus_ok
get_focus_state
get_free_disk_space
get_gui_screen_height
get_gui_screen_width
get_histo_range
get_image_dir
get_iso_market
get_iso_mode
get_iso_real
get_jpg_count
get_levent_def
get_levent_def_by_index
get_levent_index
get_live_histo
get_meminfo
get_mode
get_movie_status
get_nd_present
get_orientation_sensor
get_parameter_data
get_partitionInfo
get_prop
get_prop_str
get_propset
get_raw
get_raw_count
get_raw_nr
get_raw_support
get_sd_over_modes
get_shooting
get_sv96
get_temperature
get_tick_count
get_time
get_tv96
get_usb_capture_support
get_usb_capture_target
get_usb_power
get_user_av96
get_user_av_id
get_user_tv96
get_user_tv_id
get_vbatt
get_video_button
get_video_recording
get_zoom
get_zoom_steps
init_usb_capture
is_capture_mode_valid
is_key
is_pressed
iso_market_to_real
iso_real_to_market
iso_to_sv96
load_config_file
md_af_led_control
md_detect_motion
md_get_cell_diff
md_get_cell_val
peek
play_sound
poke
post_levent_for_npt
post_levent_to_ui
press
print_screen
raw_merge_add_file
raw_merge_end
raw_merge_start
read_usb_msg
reboot
release
save_config_file
seconds_to_tv96
set_aelock
set_aflock
set_autostart
set_av96
set_av96_direct
set_backlight
set_capture_mode
set_capture_mode_canon
set_config_autosave
set_config_value
set_console_autoredraw
set_console_layout
set_curve_file
set_curve_state
set_draw_title_line
set_ev
set_exit_key
set_file_attributes
set_focus
set_focus_interlock_bypass
set_iso_mode
set_iso_real
set_lcd_display
set_led
set_levent_active
set_levent_script_mode
set_mf
set_movie_status
set_nd_filter
set_prop
set_prop_str
set_raw
set_raw_develop
set_raw_nr
set_record
set_remote_timing
set_sv96
set_tv96
set_tv96_direct
set_usb_capture_timeout
set_user_av96
set_user_av_by_id
set_user_av_by_id_rel
set_user_tv96
set_user_tv_by_id
set_user_tv_by_id_rel
set_yield
set_zoom
set_zoom_rel
set_zoom_speed
shoot
shot_histo_enable
shot_histo_write_to_file
shut_down
sleep
sv96_market_to_real
sv96_real_to_market
sv96_to_iso
swap_partitions
switch_mode_usb
textbox
tv96_to_usec
usb_force_active
usb_msg_table_to_string
usb_sync_wait
usec_to_tv96
wait_click
wheel_left
wheel_right
write_usb_msg
hook_preshoot.continue
hook_preshoot.count
hook_preshoot.is_ready
hook_preshoot.set
hook_raw.continue
hook_raw.count
hook_raw.is_ready
hook_raw.set
hook_shoot.continue
hook_shoot.count
hook_shoot.is_ready
hook_shoot.set
rawop.create_histogram
rawop.ev_to_raw
rawop.fill_rect
rawop.get_active_height
rawop.get_active_left
rawop.get_active_top
rawop.get_active_width
rawop.get_bits_per_pixel
rawop.get_black_level
rawop.get_cfa
rawop.get_cfa_offsets
rawop.get_jpeg_height
rawop.get_jpeg_left
rawop.get_jpeg_top
rawop.get_jpeg_width
rawop.get_pixel
rawop.get_pixels_rgbg
rawop.get_raw_height
rawop.get_raw_neutral
rawop.get_raw_width
rawop.get_white_level
rawop.meter
rawop.raw_to_ev
rawop.set_pixel
rawop.set_pixels_rgbg
   </AutoComplete>
</NotepadPlus>
--- <

</code></dd></dl>:...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....[  Es reimt sich nicht, sonst wär´s ein Gedicht! ]:...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;....
Erstellt in 0.144 Sekunden, mit GeSHi 1.0.8.9

Auf welcher Seite des Möbiusbandes fängt man denn da an?
-- /HOME/BOOKS/REGAL/IMPORTANT/G.Dueck: Lean Brain Management | Omnisophie | Copy & Paste ...
-- /HOME/BOOKS/REGAL/IMPORTANT/G.Hüther:Bedienungsanleitung für ein menschliches Gehirn...

Dieser Skriptix ist auch ein -- Zeilengenerator, Programmierhelferle, Cocommentator, CAM-only oder
-- StandAllone Plugin für die PC/ hostluaPortable npp+++ Umgebung und [mittelfristig] nicht nur selbsterklärend.
Formular oder Wunschzettel? ask_scriptiX, get_answer.
Wer mag, kann auch am Ende anfangen oder einfach mal das Makro nutzen...
TODO: Actiongrafik hat´s leider nicht, zu Gunsten des Spaßfaktors. (kann halt u.A. auch ein Konsolenspiel sein;)

--Auf der Kamera braucht´s noch scryptiX.Lua von Ubasix zum Comfort, dort ist auch eine kleinere CAM-only Version,
falls diese zu groß ist.
Speicherbedarf: Wenn EDI.lua läuft ist das ein gutes Zeichen aber kein Muß. Da fehlt mancherorts ein garbagecollect().
Mit Adapterzeile kann man u.U. auch den durch skriptiX aufrufen &...

~~ 8 Mrd. Leuten entgeht das hier eh leider alles völlig am Focus vorbei, leider, leider...
O
0 | O
\|/ >> Enter next level! <<
--V-- DA startet die Maus!
[/code]:...;....1....;....2....;....3....;....4....;....5....;....6....;....7....;[Nur eine binäre Skulptur ? :oops: Nicht nur zum Staunen]:...,....1....,....2....,....3....,....4....,....5....,....6....,....7....,
Dateianhänge
scriptiX.lua
(51.93 KiB) 791-mal heruntergeladen
ListiX.Bat
--[[ ?Fleder?Maustrainer ]]--
(72 Bytes) 778-mal heruntergeladen
scryptiX.lua
--[=[scriptiX Starter[PC]-&Lander[PC|Cam]]=]--
-- needs scriptiX.lua
(3.36 KiB) 783-mal heruntergeladen
comment.lua
=======================================

--- SYNTAX ERROR ----------------------
File: comment.lua
Line: 1
Msg: unfinished long comment near '<eof>'
---------------------------------------

================ READY ================
(19 Bytes) 802-mal heruntergeladen
Keywords.lua
--[[ Liste für cam (../BOOKS) &npp++ ]]--
(5.73 KiB) 783-mal heruntergeladen
luadokde.txt
--[[ stark reduziert für cam (../BOOKS) ]]--{8)
(91.73 KiB) 790-mal heruntergeladen
Zuletzt geändert von Caefix am 18.10.2021, 15:04, insgesamt 22-mal geändert.
EsGibtKeinenErdaufgangAufDemMond! SoSimpel...
Benutzeravatar
Caefix
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 78
Registriert: 15.06.2018, 19:14
Kamera(s): Einige!

Re: portable Entwicklungsumgebung für Windows

Beitragvon rudi » 23.02.2019, 21:27

Hallo Caefix,

bitte keine unkommentierte Skripte einstellen!


Einen Zusammenhang mit der portablen Entwicklungsumgebung kann ich nicht herstellen!
Andere Kameramodelle bekommen schon bei kleineren Skripten Probleme mit dem Speicher.

rudi
Benutzeravatar
rudi
CHDK-Spezialist
CHDK-Spezialist
 
Beiträge: 510
Registriert: 11.09.2009, 11:27
Kamera(s): A590IS_101B, SX260_100B

Re: portable Entwicklungsumgebung für Windows

Beitragvon rudi » 17.12.2019, 23:17

neue Version 4.1.013 mit folgenden Änderungen:

  • NEU: 'ursprüngliches' Lua ('Native Lua') von lua.org in Version 5.3.5 hinzugefügt, Module werden im Skript-Verzeichnis und in /bin/nativelua/lua/ gesucht
  • NEU: Dokumentation für Lua 5.3 hinzugefügt
  • Aktualisierung 7zip auf Rev. 19.00
  • Aktualisierung chdkptp auf Rev. 921, Lua Skripte Rev. 924
  • Aktualisierung CHDK-Dateien auf Rev. 5345
  • Aktualisierung NppExec auf Rev. 06-RC3
  • Fehler bei 'Lua local (chdkptp)' ohne libusb behoben
  • Fehler bei der Erstellung des hostlua-Kontextmenüs im NPP behoben
  • Anpassungen in /bin/npes/sub.npes
  • Schreibweise für 'Lua' berichtigt
  • liesmich.txt, readme.txt aktualisiert
Die Datei befindet sich im ersten Beitrag.

Gruß rudi
Benutzeravatar
rudi
CHDK-Spezialist
CHDK-Spezialist
 
Beiträge: 510
Registriert: 11.09.2009, 11:27
Kamera(s): A590IS_101B, SX260_100B

Re: portable Entwicklungsumgebung für Windows

Beitragvon c_joerg » 22.12.2019, 12:58

Hallo Rudi,

schön das sich immer noch dran arbeitest…
Zum Entwickeln ist hostluaPortable einfach ideal.
Allerdings bekomme ich das Update nicht hin. Ich gehe dann immer über eine neue Installation.

rudi hat geschrieben:
AKTUALISIERUNG (ab Version 1.4.005)
  1. neue Datei hostluaPortable_x.x.xxx.zip im Hauptverzeichnis speichern
  2. update.cmd ausführen
  3. Datei hostluaPortable_x.x.xxx.zip kann gelöscht werden
[/list]


Bei mir befindet sich die Entwicklungsumgebung unter
C:\Tools\hostlua
Muss ich dann in diesem Fall hostluaPortable_x.x.xxx.zip unter c: auspacken?

Grüße Jörg
c_joerg
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 456
Registriert: 14.08.2014, 06:50
Wohnort: Bremen
Kamera(s): S110 103a
S45
2 * G1X 101a, 100e
G9xII 1.00c,
SX230 101a
SX50hs 100c
EOS M3 101a
EOS M100 100a

Re: portable Entwicklungsumgebung für Windows

Beitragvon msl » 22.12.2019, 15:16

Hallo Jörg,

was bedeutet, du bekommst es nicht hin?

Du kopierst die aktuelle Hostlua-Zip-Datei in das Hostlua-Verzeichnis,also bei dir C:\Tools\hostlua, und führst update.cmd aus. Ein manuelles Entpacken ist nicht notwendig. Das erledigt das Skript. update.cmd startet das VBS-Skript update.vbs aus dem Verzeichnis .../bin/config. Möglicherweise verhindern die Sicherheitseinstellungen von Windows diesen Vorgang. Das Ausführen mit Admin-Rechten kann helfen.
Ähnliches erfolgt auch bei der Erstinstallation. Hier hast du den Vorgang evt.irgendwann einmal als Admin freigegeben, was sich dein Windows gemerkt hat.

Prinzipiell funktioniert das Update der neuesten Installation. Ich bin quasi Beta-Tester von rudi und hatte keinerlei Probleme. Wenn du jetzt mit der aktuellen Version ein Update versuchst, sollte das mit einem Hinweis quittert werden, dass bereits die aktuelle Version installiert ist.

Gruß msl
Benutzeravatar
msl
Super-Mod
Super-Mod
 
Beiträge: 4567
Bilder: 271
Registriert: 22.02.2008, 11:47
Wohnort: Leipzig
Kamera(s): A720 1.00c
SX220 1.01a

Re: portable Entwicklungsumgebung für Windows

Beitragvon c_joerg » 22.12.2019, 16:48

Hallo msl,
vielen Dank für die Hilfe.
msl hat geschrieben: Du kopierst die aktuelle Hostlua-Zip-Datei in das Hostlua-Verzeichnis,also bei dir C:\Tools\hostlua, und führst update.cmd aus. Ein manuelles Entpacken ist nicht notwendig.

Das war mein Problem. Ich hatte die ZIP manuell entpackt.
msl hat geschrieben:Prinzipiell funktioniert das Update der neuesten Installation.

Ich konnte bisher auch keine Probleme feststellen.
msl hat geschrieben:Prinzipiell Wenn du jetzt mit der aktuellen Version ein Update versuchst, sollte das mit einem Hinweis quittert werden, dass bereits die aktuelle Version installiert ist.

Jetzt hats funktioniert.

Grüße Jörg
c_joerg
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 456
Registriert: 14.08.2014, 06:50
Wohnort: Bremen
Kamera(s): S110 103a
S45
2 * G1X 101a, 100e
G9xII 1.00c,
SX230 101a
SX50hs 100c
EOS M3 101a
EOS M100 100a

Re: portable Entwicklungsumgebung für Windows

Beitragvon c_joerg » 31.12.2019, 12:15

Hallo,

eine Sache ist mir noch aufgefallen.
In älteren Versionen wurden mit
Code: Alles auswählen
print_screen(1234)

bei print Ausgaben Log Dateien erstellt.
Das scheint aber schon länger nicht mehr zu funktionieren.

Grüße Jörg
c_joerg
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 456
Registriert: 14.08.2014, 06:50
Wohnort: Bremen
Kamera(s): S110 103a
S45
2 * G1X 101a, 100e
G9xII 1.00c,
SX230 101a
SX50hs 100c
EOS M3 101a
EOS M100 100a

Re: portable Entwicklungsumgebung für Windows

Beitragvon rudi » 03.01.2020, 17:48

Hallo c_joerg,

Code: Alles auswählen
print_screen(1234)
erstellt die Logdatei LOG_1234.TXT in A\CHDK\LOGS immer noch. Das Skript muss dazu mit CHDK Lua local keypad ausgeführt werden.

Gruß rudi
Benutzeravatar
rudi
CHDK-Spezialist
CHDK-Spezialist
 
Beiträge: 510
Registriert: 11.09.2009, 11:27
Kamera(s): A590IS_101B, SX260_100B

Re: portable Entwicklungsumgebung für Windows

Beitragvon Caefix » 03.01.2020, 21:09

:...;....1....;....2....;....3....;....4.. [Laden, Makro starten, Console anklicken, ENTER...]:...;....1....;....2....;....3....;....4..
Syntax: [ Download ] [ Verstecken ]
Benutze Lua Syntax Highlighting
--[[
@title !sortiX.lua
@chdk_version 1.4
@subtitle :...;....1....;....2....;....3....;....4..
@param s min #zeile | 0=Environment
 @default s 0
@range s -1 128
@param o >|<
 @default o 0
@range o 0 1
@param D neg. default ignored -->
 @default D -1
]]
--
 
 
function fsort(s,sfil)
local lin,x,X,abs={},0,0,s
   if s<0 then abs=-s end
   if s==0 then
     for var,ee in pairs(_G) do x=x+1
      if o==1 then lin[x]=(var.." "..tostring(ee)) else lin[x]=var end end
   else 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 end
       end end end
   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 end
 
--- :

set_console_layout(0,0,50,14)
if t==1000 then sfil,s,o=...; s=s or 0; o=o or 0 end
if io.type(sfil)~="file" then sfil=file_browser("A/CHDK/LOGS/") end
if sfil==nil then sfil="A/CHDK/LOGS/LOG_9999.txt" end
if sfil~="A/CHDK/LOGS/LOG_0123.txt" then print_screen(0123) else print_screen(0124) end
collectgarbage()
print("--- < ",collectgarbage("count"))
print("--- < ",sfil,-fsort(s or 0,sfil),collectgarbage("count"))
collectgarbage()
print("--- < ",collectgarbage("count"))

print_screen(0)
set_console_layout(0,0,25,5)

--[[ s>0!: zum Kopieren, ans Ende der Console ziehen, Enter... & wieder einfügen | Bearbeiten/rückgängig...
--
--A/CHDK/LOGS/LOG_0007.txt
--A/CHDK/LOGS/LOG_1234.txt
--A/CHDK/LOGS/LOG_2020.txt
--
--]]
--
Erstellt in 0.005 Sekunden, mit GeSHi 1.0.8.9

--[[ neues in LUA (& uBasic#5394 (&!!!uBasic.zip)), angehängt in angehängter /bin/camera_funcs.Lua
get_imager_active
get_nd_current_ev96
get_nd_value_ev96
get_current_av96
get_current_tv96
get_max_av96
get_min_av96
--]]--
& die Vorschläge aus dem Scriptix Appendix sind da auch mit drin...\:D/
Dateianhänge
!cafu_swap.Bat
Rem Doppelklick- Schalter
zum Tauschen mit ...
(153 Bytes) 697-mal heruntergeladen
!camera_funcs.lua
der Alternative :)
(48.19 KiB) 667-mal heruntergeladen
!SortiX.lua
20:20 Die Witznummer des Jahres!
(1.48 KiB) 693-mal heruntergeladen
Zuletzt geändert von Caefix am 18.10.2021, 15:07, insgesamt 6-mal geändert.
EsGibtKeinenErdaufgangAufDemMond! SoSimpel...
Benutzeravatar
Caefix
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 78
Registriert: 15.06.2018, 19:14
Kamera(s): Einige!

Re: portable Entwicklungsumgebung für Windows

Beitragvon c_joerg » 04.01.2020, 13:16

Hallo Rudi,

rudi hat geschrieben:Das Skript muss dazu mit CHDK Lua local keypad ausgeführt werden.

stimmt, mit CHDK Lua local keypad geht's.
Hat das einen Grund, warum es mit CHDK Lua local nicht geht?
Grüße Jörg
c_joerg
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 456
Registriert: 14.08.2014, 06:50
Wohnort: Bremen
Kamera(s): S110 103a
S45
2 * G1X 101a, 100e
G9xII 1.00c,
SX230 101a
SX50hs 100c
EOS M3 101a
EOS M100 100a

Re: portable Entwicklungsumgebung für Windows

Beitragvon msl » 04.01.2020, 19:08

Hallo Jörg,

das hat historische Hintergründe. print_screen wurde unter uBASIC eingeführt und für Lua als Funktion angepasst, um CHDK-Textaugaben auf der CHDK-Konsole in eine Datei umzuleiten. Deshalb wird zur Emulation hier auch das Keypad-Programm genutzt. Unter Lua gibt es eigentlich bessere Möglichkeiten, Logs zu erstellen. Diese würden dann auch unter Lua local funktionieren.

Gruß msl
Benutzeravatar
msl
Super-Mod
Super-Mod
 
Beiträge: 4567
Bilder: 271
Registriert: 22.02.2008, 11:47
Wohnort: Leipzig
Kamera(s): A720 1.00c
SX220 1.01a

Re: portable Entwicklungsumgebung für Windows

Beitragvon Caefix » 30.05.2020, 20:38

!Edi.Lua, jetzt auch noch praktischer... :roll:
https://chdk.setepontos.com/index.php?t ... #msg143417
Dateianhänge
!EDI.lua
Pure on the rocks :)
(29.79 KiB) 560-mal heruntergeladen
EsGibtKeinenErdaufgangAufDemMond! SoSimpel...
Benutzeravatar
Caefix
CHDK-Begeisterter
CHDK-Begeisterter
 
Beiträge: 78
Registriert: 15.06.2018, 19:14
Kamera(s): Einige!

VorherigeNächste

Zurück zu Code-Ecke

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 6 Gäste

cron