Hi,
i'm trying to write a script which opens all files from a
delphi-project-file.
here a such file:
program dfmedit;
uses
Forms,
SizerControl in 'sizecontrols\SizerControl.pas',
main_u in 'main_u.pas' {Form_DFMMain},
preview_u in 'preview_u.pas' {Form_DFMPreview},
...
unit_u in 'unit_u.pas';
{$R *.RES}
begin
...
end.
as you see, i need to parse all the stuff between '' till last character
in line is ; and open this using path of the project file.
my problem doing this is getting the string between ''
here my actual script:
function openPasFromDpr()
local path = props['FileDir'] --without trailing /\
--for ln = 0, editor.LineCount - 1 do
output:append(path)
ln=0
while ln < editor.LineCount do
local lbeg = editor:PositionFromLine(ln)
local lend = editor.LineEndPosition[ln]
local text = editor:textrange(lbeg, lend)
local p1= string.find(text,'\'')
local p2= string.find(text,'\'',p1+1)
--local c1,c2,c3 = split3(text,'\'')
c2=string.sub(text,p1+1,p2-p1)
-- if c2 <> '' then
output:append(path..'/'..c2..'\n')
scite.Open(path..'/'..c2)
-- end
if text[string.len(text)] ==';' then
ln=editor.LineCount
else
ln=ln+1
end
end
end
i get a 'attempt to perform arithmetic on local `p1' (a nil value)' on
line 22.
how do i get the string between ''?
Regards Frank
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest