lotrointerface.com
Search Downloads

LoTROInterface SVN BusyBeeTasks

[/] [trunk/] [lua_to_excel/] [lualist_to_excel.m] - Rev 8

Compare with Previous | Blame | View Log

[filename,filepath]=uigetfile('*.lua');


keywords={'name','prefix','quantity','lvlmin','lvlmax','sellvalue','faction','zone','place','map'};
isnumber=[0,0,1,1,1,1,0,0,0,0];

datafile=fopen([filepath,filename],'r','n','UTF-8');

tline=fgetl(datafile);
while(isempty(strfind(tline,'BusyBeeTasks')))
    tline=fgetl(datafile);
end

clear cellarray
for i=1:length(keywords)
    cellarray{1,i}=keywords{i};
end
k=2;
while(~feof(datafile))
    tline=fgetl(datafile);
    if ~isempty(strfind(tline,'};'))
        break;
    end
    if size(tline,2)<30
        continue
    end
    for i=1:length(keywords)
        index=strfind(tline,keywords{i});
        if(isnumber(i))
           found1=find((tline(index:end)>='0')&(tline(index:end)<='9'));
           found2=find(tline(index:end)==',',2,'first');
           string=tline((index+found1-1):(index+found2-2));
        else
            found=find(tline(index:end)=='"',2,'first');
            string=tline((index+found(1)):(index+found(2)-2));
        end
        cellarray(k,i)={string};
    end
    k=k+1;
end
fclose(datafile);
numlines=k-1;

for i=1:numlines
    cellarray(i,1)={[cellarray{i,2},' ',cellarray{i,1}]};
end
cellarray(:,2)=[];
cellarray(1,1)={'name'};


xlsname=[filename(1:(end-4)),'.xls'];
xlswrite([filepath,xlsname],cellarray)


        

Compare with Previous | Blame


All times are GMT -5. The time now is 01:17 PM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui