%ver 2.0
%decimale
srt=0;
miss=0;
srtvl=0;
if ncase

	h_1  = WndCreat ([], "Gentab Marks", [NaN,NaN,320,408], 2);
	h_2  = CtrCreat (h_1, 110, [249,357,59,23], "Paste","paste");
	h_3  = CtrCreat (h_1, 110, [183,357,59,23], "Cancel","WndClose(h_1)");
	h_4  = CtrCreat (h_1, 110, [117,357,59,23], "OK","ok");
	
	CtrCreat (h_1, 510, [11,11,144,13], "All varaibles in file:");
	h_5  = CtrCreat (h_1, 320, [8,25,113,186], lcase(GetVarName(1:nvar)));
	CtrCreat (h_1, 510, [196,11,100,13], "Varaible(s):");
	h_6  = CtrCreat (h_1, 320, [193,25,113,82], "");
	CtrCreat (h_1, 510, [196,115,100,13], "Columns:");
	h_7  = CtrCreat (h_1, 320, [193,129,113,82], "");
	
	h_8 = CtrCreat (h_1, 150, [136,053,41,23], "","");
	h_9 = CtrCreat (h_1, 150, [136,153,41,23], "","");
	
	CtrConect(h_8,h_5,h_6);
	CtrConect(h_9,h_5,h_7);
	
	CtrCreat (h_1, 140, [187,221,121,69], "Number of decimals","");
	CtrCreat (h_1, 510, [195,240, 80,13], "First column:");
	h_19 = CtrCreat (h_1, 410, [275,237,21,19], "1");
	CtrCreat (h_1, 510, [195,264, 80,13], "Other columns:");
	h_20 = CtrCreat (h_1, 410, [275,261,21,19], "0");
	
	CtrCreat (h_1, 140, [9,221,169,69], "Marks","");
	CtrCreat (h_1, 510, [30,240,130,13], "Number of marks on scale:");
	h_13 = CtrCreat (h_1, 410, [69,261,49,19], "5");
	
	CtrCreat (h_1, 140, [9,292,300,61], "Parameters","");
	h_11 = CtrCreat (h_1, 130, [21,310,169,17], "Show missing values in output","miss=~miss;");
	CtrCreat (h_1, 510, [ 21,330,241,13], "Number of significant levels for coloring (1, 2 or 3):");
	h_15 = CtrCreat (h_1, 410, [263,326,39,19], "2");
else
	MsgBox([],"Morate prvo ucitati SPSS podatke");
end

macro paste
	vars=CtrGet(h_6);
	if size(vars,1)==0
		MsgBox(h_1,"Fale varijable za obradu!",1);
		return;
	end
	kol1=CtrGet(h_7);
	str = "\n\n!gentabo vars=";
	for i=1:max(size(vars))
		str = str+" "+vars(i);
	end
	if size(kol1,1)
		str = str+"/\n         kol1=";
		for i=1:max(size(kol1))
			str = str+" "+kol1(i);
		end
	end
	if miss
		str = str+"/\n         miss= yes";
	end
	
	brkat = CtrGet(h_13);
	if size(brkat,1)
		str = str+"/\n         brkat= "+brkat;
	else
		MsgBox(h_1,"Morate specifirati broj ocena");
	end
	
	color = CtrGet(h_15);
	if size(color,1)
		if strcmp("3",color)
			str = str+"/\n         color= "+color;
		end
	else
		str = str+"/\n         color= 3";
	end
	str = str + "/\n         decimal= " + CtrGet(h_19) + " " + CtrGet(h_20);
	str = str+" .";
	syntax(str);
	WndClose(h_1);
end

macro ok
	vars=CtrGet(h_6);
	if size(vars,1)==0
		MsgBox(h_1,"Fale varijable za obradu!",1);
		return;
	end
	kol1=CtrGet(h_7);
	if miss
		miss = "YES";
	else
		miss = "NO";
	end
	
	brkat = CtrGet(h_13);
	if ~size(brkat,1)
		MsgBox(h_1,"Morate specifirati broj ocena");
		return;
	end
	
	color = CtrGet(h_15);
	decimal= [CtrGet(h_19),CtrGet(h_20)];
	WndClose(h_1);
	gentabo(vars,kol1,[],[],brkat,miss,color,decimal);

end