Reply
Logi Guru
bystander
Posts: 1,121
Registered: ‎06-04-2010
0

Re: like select case in lua

I didn't realize you were using an excel sheet to read everything in.  That then makes a lot more sense.  Your Excel sheet is the UI in your case.

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

Re: like select case in lua

.. i followed this thread .. it gets more interesting every day :-)

@josick:

you could do step 1 with ll.sCmd("ConvertFile",...), that is actually a Read function. (if you use .csv format and a lua-explode function it would be very easy to get the data into an array)

.. the "WriteFile" function is not working 100% yet - if the string is larger then 900 characters and/or contains some illegal characters (e.g. %) .. i am working on the next update now, trying to fix this issue and adding some more functions.

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

Re: like select case in lua

In one of my partials exemples, you have this line (put in comment)

ll.sCmd("WriteFile", alphalist[xmax]..infoTime.."\n", pathfile..[[LuaTestFile.txt]], 1)

If I can have a quick look on tray tip time for each key pressed appears, with WriteFile, these results are then stored in a file. For example:

s	G5:	27	G1:	30	G6:	36
z	G1:	124	G2:	129
e	G1:	75	G2:	110
b	G1:	75	G2:	100
b	G1:	51	G2:	79
c	G1:	58	G3:	66
b	G1:	20	G2:	59
z	G1:	134	G2:	141
b	G1:	23	G2:	50
b	G1:	7	G2:	7

 But, sorry h0rse, I'm not tested yet ll.sCmd("ConvertFile",...)...

 

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

Re: like select case in lua

.. yes i have seen this line, so i just wanted to inform you about these possible bugs.

but the way you write (1=appending) each line, you shouldnt have problems.

i dont fully understand your project (i cant get the picasa sites?),

and i cannot compete with you guys in Lua-Code ...

but whenever you have problems/questions/suggestions about ll.sCmd i will try to help!

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

Re: like select case in lua

@ h0rse : "(i cant get the picasa sites?),"

It's ok now ? I supposed. Tanks !

https://picasaweb.google.com/josick.croyal/Lua#5724373870056636466 My table under Excel !

 

For example, used one element in the second row --> _bascule2

 

In my coding, a row (map) is a cluster.

I use :

clusterdefaut=1

 And the name of active cluster is clustera.

With _bascule2, the active cluster become the 2   (clustera=2)

And at the end of each execution https://picasaweb.google.com/josick.croyal/Lua#5724379568210199394

you have :

clustera=clusterdefaut

 Like that, after each action in a other cluster (not default), you come back in the default cluster (clusterdefaut).

 


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

Re: like select case in lua

okay, i am getting there ..

my idea was simply to get your excel-tables into a lua-table without VB could be to use ll.sCmd("ConvertFile", somewhere .. "ExcelFile.csv") with something like this

gL.com.explode = function(div,str) -- credit: http://richard.warburton.it
  if (div=='') then return false end
  local pos,arr = 0,{}
  for st,sp in function() return string.find(str,div,pos,true) end do
    table.insert(arr,string.sub(str,pos,st-1))
    pos = sp + 1
  end
  table.insert(arr,string.sub(str,pos))
  return arr
end

 since .csv is easy to read and explode .. by "\n" and ";"

...

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

csv or

csv or read directly to the clipboard :

moi = ll.sCmd("ClipBoardGet")
OutputLogMessage(moi.."\n")

 But at this time, I have this result :

ll.Project Modules: sCmd - loaded successfully!!!
cannot open C:\Users\josick\Documents\G2\server3\__System\data\lua\sCmdClipBoardGet.lua: No such file or directory

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

Re: csv or

Only this way :

ll.sCmd("ClipBoardSet", "Hello")

 is ok !

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

Re: csv or

[ Edited ]

hmmm .. your code works here ...

 

- is llpp=[[C:\Users\josick\Documents\G2\server3\]] the folder that contains ll.Server?

- maybe try with a single-word not containing any speical characters first?! (string-length and illegal chars may be a problem)

- the "__System\data\lua\" folder contains the .lua files read by the script. i suppose its not write-protected?!

- you can also check/modify the "__System\_Resources\lua" it contains the external Lua code, but i think the prob is somewhere else

- EDIT: are you running this in a poll?

 

do you copy the complete table of your excel sheet or just a single cell? i think "ConvertFile" would be the better solution if you copy a complete table.

 

 

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

Re: csv or

"- the "__System\data\lua\" folder contains the .lua files read by the script. i suppose its not write-protected?!"

 

not exist  : In llProject_sCmd_b1000.rar the "__System\data\lua\" folder not exist

 

Obiously, same problem with

local desktop = ll.sCmd("GetDesktop")

 cannot open C:\Users\josick\Documents\G2\server3\__System\data\lua\sCmdGetDesktop.lua: No such file or directory