Reply
Logi Journeyman
h0rse
Posts: 430
Registered: ‎08-13-2010
0

Re: csv or

i just downloaded both versions again (b1000 and b1001). both rar files have this folder...!!

"llProject_sCmd_b1000\__System\data\lua" they work fine. try to download/unpack again or create this folder manually.

-------------- UPIA --------------->
Logi Visitor
josick
Posts: 26
Registered: ‎03-20-2012
0

Re: csv or

"....create this folder manually"

I did ! And it's ok now ! Thanks !

 

(I had been manually extracted and as there was no file to store in __System \ data \ lua, so I did not create this directory)

 

Tips with sCmd Lua Extensions

 

llas=1;ClearLog();llpp=[[C:\Users\josick\Documents\G2\server3\]];dofile([[C:\Users\josick\Documents\G2\server3\]]..[[__System\_Resources\lua\llProjectStart.lua]])
if not(ll==nil) then ll.sCmd("NirCmd",[[beep 600 50]]) end

Send a beep every time the script is run.

if not(ll==nil) then ll.sCmd("NirCmd",[[beep 600 50]]) end

 Or 

if not(ll==nil) then ll.sCmd("SoundPlay","tada.wav") end

 

 


 

 



Logi Visitor
josick
Posts: 26
Registered: ‎03-20-2012
0

Re: csv or

Test of copy from Excel sheet as the UI (screencopy of the Excel sheet).

  • First, make the copy in the clipboard,
  • Second, activate Lua Script :
moi =ll.sCmd("ClipBoardGet")
OutputLogMessage(moi.."\n")
  • And it's OK, the result is :
1	a	1	_Alt	_backspacemot	@
3	b	2	_corrigemot	_backspacedeux	
5	c	3	_menucontextuel	_backspacetrois	
33	d	4	_Tab	_backspacequatre	_ptinterog
17	e	5	_Escape	_ansi_�	_ptexclam
2	f	�	_etoile	_vermajuscule	_maj
6	g	�	&		_underscore
34	h	w			
42	i	�			
35	j	�			_ecrit(josick)
4	k	_=			
32	l	_actualisetable	_delete		#
21	m	}			
28	n	{			
7	o	_<			
14	p	_>			
16	q	_/			_basvers
56	r	(			
49	s	[			
20	t	]			_ecrit(target)
48	u	)	_deuxpoints		_ptvirgule
8	v	6		_backspaceseul	_point
10	_bascule2	7			
12	_bascule3	8	x		
40	_bascule4	9		y	
24	_bascule5	_zero	_�		z
9	_virgule	+			_apostrophe
18	_enter	^	_trema		_guillemet
36	_espace	%			_tiret
  •  After make first treatment (actualy, no time to do that -and I'm no good for this kind of treatment !-)

Obtain for example :

link = {
[1]={	"a",	"1",	"_Alt",		"_backspacemot",	"@",},
[2]={	"f",	"è",	"_etoile",	"_vermajuscule",	"_maj",},
[3]={	"b",	"2",	"_notused",	"_backspacedeux",	"_notused",},
}

 Then, Lua script that reads in data bases (Lua Table) to take what is necessary.

 And at the end, actualize my lili2 table !!! And dynamically, change my keyboard !

My next project !

Logi Visitor
josick
Posts: 26
Registered: ‎03-20-2012
0

Example of separation of the engine and data

Example of separation of the engine and data :

 

The engine (very simple) :

function OnEvent(event, arg, family)
if (event=="G_PRESSED" or event =="G_RELEASED" ) then data[arg][event]() end
end

 And the data (only for G1, G2, G3)

G7 changes the values ​​of G1, G2 and G3 (toggle between new values ​​or initial values​​)

data = {
[1]= {G_PRESSED = function() PressKey("e") end,
	G_RELEASED = function() ReleaseKey("e") end,
	},
[2]= {G_PRESSED = function() PressKey("f")  end,
	G_RELEASED = function() ReleaseKey("f") end,
	},
[3]= {G_PRESSED = function() PressMouseButton(3) end, --right click
	G_RELEASED = function() ReleaseMouseButton(3) end,
	},
[4]= {G_PRESSED = function() OutputLogMessage("4 \n") end,
	G_RELEASED = function() OutputLogMessage("4rel \n") end,
	},
[5]= {G_PRESSED = function() OutputLogMessage("5 \n") end,
	G_RELEASED = function() OutputLogMessage("5rel \n") end,
	},
[6]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[7]= {G_PRESSED = function()
	if (bascule==nil) then								--new value for the 3 first G-keys
		bascule= true
		data[1].G_PRESSED= function() PressKey("a") end
		data[1].G_RELEASED= function() ReleaseKey("a") end
		data[2].G_PRESSED= function() PressKey("b") end
		data[2].G_RELEASED= function() ReleaseKey("b") end
		data[3].G_PRESSED= function() PressKey("c") end
		data[3].G_RELEASED= function() ReleaseKey("c") end
	else													--initials values restored for the 3 first G-keys
		bascule=nil
		data[1].G_PRESSED= function() PressKey("e") end
		data[1].G_RELEASED= function() ReleaseKey("e") end
		data[2].G_PRESSED= function() PressKey("f") end
		data[2].G_RELEASED= function() ReleaseKey("f") end
		data[3].G_PRESSED= function() PressMouseButton(3) end
		data[3].G_RELEASED= function() ReleaseMouseButton(3) end	
	end
 end,
	G_RELEASED = function() OutputLogMessage("change values \n") end,
	},
[8]= {G_PRESSED = function() OutputLogMessage("8 \n") end,
	G_RELEASED = function() OutputLogMessage("8rel \n") end,
	},
[9]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[10]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[11]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[12]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[13]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[14]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[15]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[16]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[17]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[18]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[19]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[20]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[21]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[22]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[23]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[24]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[25]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[26]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[27]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[28]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
[29]= {G_PRESSED = function() OutputLogMessage("1 \n") end,
	G_RELEASED = function() OutputLogMessage("1out \n") end,
	},
}

 

Logi Visitor
josick
Posts: 26
Registered: ‎03-20-2012
0

Re: Example of separation of the engine and data

Exactly same, but compact presentation :

function OnEvent(event, arg, family)
if (event=="G_PRESSED" or event =="G_RELEASED" )then data[arg][event]() end
end

data={}
for x=1, 29 do
data[x]={}
data[x].G_PRESSED= function() OutputLogMessage(x.." \n") end
data[x].G_RELEASED= function() OutputLogMessage(x.."released \n") end
end

function basic_populate()
		data[1].G_PRESSED= function() PressKey("e") end --repeat key for e
		data[1].G_RELEASED= function() ReleaseKey("e") end
		data[2].G_PRESSED= function() PressKey("f") end --repeat key for f
		data[2].G_RELEASED= function() ReleaseKey("f") end
		data[3].G_PRESSED= function() PressMouseButton(3) ReleaseMouseButton(3) end --right click
		data[3].G_RELEASED= function()  end	
end

function second_populate()
		data[1].G_PRESSED= function() PressKey("a") end
		data[1].G_RELEASED= function() ReleaseKey("a") end
		data[2].G_PRESSED= function() PressKey("b") end
		data[2].G_RELEASED= function() ReleaseKey("b") end
		data[3].G_PRESSED= function() PressKey("c") end
		data[3].G_RELEASED= function() ReleaseKey("c") end
end

basic_populate()

data[7].G_PRESSED = function()
	if bascule==nil then		--new value for the 3 first G-keys
		bascule= true
		second_populate()
	else			--initials values restored for the 3 first G-keys
		bascule=nil
		basic_populate()
	end
 end

 

Logi Visitor
josick
Posts: 26
Registered: ‎03-20-2012
0

Re: Example of separation of the engine and data

New step (hope not the final) : Same, but with a second engine : data engine.

 

Simple presentation of data :

		fnt.alpha.used1={{--1rst col
			[1]="e", 
			[2]="f",},
			{--2nd col
			[1]="a",
			[2]="b",
			[3]="c", },
			}
		fnt.mouse.used1={{--1rst col
			[3]=3},}	

 They can be in the body of code (example below), or separated (second example) :

function OnEvent(event, arg, family)
	if (event == "PROFILE_ACTIVATED") then
		initialize_data("used1")
	end
	if (event=="G_PRESSED" or event =="G_RELEASED" )then 	
		data[clustera][arg][event]() 
	end
end

fnt={
alpha=	{
	PRESSED=function(x) PressKey(x) end,
	RELEASED=function(x) ReleaseKey(x) clustera=defaultCluster end,
	used1={{--1rst col
			[1]="e", [2]="f",},
			{--2nd col
			[1]="a",[2]="b",[3]="c", },
			},
		},
mouse={	
	PRESSED= function(x) PressMouseButton(x) ReleaseMouseButton(x) end,
	RELEASED= function()  end,
	used1={{[3]=3},},
	},
goto={
	PRESSED=function(x) defaultCluster=x end,
	RELEASED=function(x) clustera=defaultCluster  end,
	used1={{[7]=2,},{[7]=1,},},  
	},
gosub={
	PRESSED=function(x) clustera=x end,
	RELEASED=function(x) end,
	used1={{[6]=2,},{[6]=1,},},  
	},
}
function initialize_data(choix)
defaultCluster=1
clustera=defaultCluster
local listes={}
local cmax=0
for x,value in pairs(fnt) do
	if type(value[choix])=="table" then
		if #value[choix]>cmax then cmax=#value[choix] end
		table.insert(listes,{value,value[choix]})
	end
end
	if cmax==0 then OutputLogMessage("Data empty\n") else
		initialize_table(cmax)
		populate(listes)
	end
end

function initialize_table(numberColonn)
data={}
for y=1, numberColonn do
	data[y]={}
	for x=1, 29 do
		data[y][x]={}
		data[y][x].G_PRESSED= function() end
		data[y][x].G_RELEASED= function() clustera=defaultCluster end
	end
end
end

function populate(listes)
	for p, r in ipairs(listes) do
		for t,v in ipairs(listes[p][2]) do
			for i, value in pairs(listes[p][2][t]) do
				data[t][i].G_PRESSED= function() listes[p][1].PRESSED(value) end
				data[t][i].G_RELEASED= function() listes[p][1].RELEASED(value) end
			end
		end
	end
end

 

function OnEvent(event, arg, family)
	if (event == "PROFILE_ACTIVATED") then
		fnt.alpha.used1={{--1rst col
			[1]="e", [2]="f",},
			{--2nd col
			[1]="a",[2]="b",[3]="c", },
			}
		fnt.mouse.used1={{[3]=3},}	
		initialize_data("used1")
	end
	if (event=="G_PRESSED" or event =="G_RELEASED" )then 	
		data[clustera][arg][event]() 
	end
end

 More with the key 6go in the other column for the next keystroke and then return.

For the key 7: same than before !


What KGober (and the other) think of that?

Logi Journeyman
h0rse
Posts: 430
Registered: ‎08-13-2010
0

Re: Example of separation of the engine and data

hi josick ..

i followed this thread a little just to see some other coding styles/solutions. from what i read its very nice and i will use kens idea in the future (like many other things).

to get some feedback for your project it would be a great help to have a complete download-file to test it, or to have a little video that shows what it does / how to use.

-------------- UPIA --------------->
Logi Visitor
josick
Posts: 26
Registered: ‎03-20-2012
0

Re: Example of separation of the engine and data

hi h0rse,

Normaly, the central code (between the two short example) run. It's complete.

 

With G1 --> e  and repeat eeeeeeeeeeeeee

G2 -->f and ffffffffff

G3--> right click

 

G6-->apparently no effect but... after for example G2-->b  and then comeback normal G2 -->f  fffffffffffffffff

G7(toggle)-->apparently no effect but... after for example G2-->b  and then G2 -->b bbbbbbbbb

 

Exemple of change (3 colomns, adding a new function) :

function OnEvent(event, arg, family)
	if (event == "PROFILE_ACTIVATED") then
		fnt.alpha.used1={{--1rst col
			[1]="e", 
			[2]="f",},
			{--2nd col
			[1]="a",
			[2]="b",
			[3]="c",
			[4]="up",
			[11]="down",},
			{--3rd col
			[1]="x",
			[2]="y",
			[3]="z",
			},
			}
			
		fnt.mouse.used1={{--1rst col
			[3]=3},}
			
		fnt.goto.used1={{[7]=2,},{[7]=3,},{[7]=1,}} --for toggle colomns 1-->2-->3-->1
		
		fnt.ansi ={--adding a new function
			PRESSED=function(x) PressKey(0x38)  PressAndReleaseKey(x[1],x[2],x[3],x[4]) ReleaseKey(0x38)  end,--
			RELEASED=function(x) clustera=defaultCluster end,
			used1={{[8]={0x52,0x4f,0x4d,0x4c},},},--¥ yen on colomn 1 G8	
			}
			
		initialize_data("used1")
	end
	if (event=="G_PRESSED" or event =="G_RELEASED" )then 	
		data[clustera][arg][event]() 
	end
end

 


Logi Journeyman
h0rse
Posts: 430
Registered: ‎08-13-2010
0

Re: Example of separation of the engine and data

ahh, ok, with the code/lib from above its working ..

-------------- UPIA --------------->
Logi Visitor
josick
Posts: 26
Registered: ‎03-20-2012
0

Re: Example of separation of the engine and data

Extension : call external functions like this 2 functions (actualiseTable & onlyTest) in a table (fntLib):

fntLib = {
["actualiseTable"] = function ()
    ClearLog()
    --dofile(pathfile.."lili2.lua")
    OutputLogMessage("Actualisation non active\n")
end,
["onlyTest"] = function(x) OutputLogMessage(x.." from onlyTest\n") end,
}

 Just do that (affect actualiseTable at G10 & onlyTest at G11) :

		fnt.fntLib ={--adding another new function call external
			PRESSED=function(x) fntLib[x[1]](x[2]) end,
			RELEASED=function(x) clustera=defaultCluster end,
			used1={{[10]={"actualiseTable",""},[11]={"onlyTest","Bonjour"},},},
			}

( Put at the same place than the fnt.ansi above)