I am using lLuaMacros to trigger my python scripts, but parameters are required for my scripts.
Therefore, lmc_spawn cannot handle the requirement because only one parameter can be applied, which is occupied by the script name.
For instance, the following works.
lmc_spawn(python_path, program_path .. "ButtonEnd.py")
However,
lmc_spawn(python_path, program_path .. "ButtonEnd.py abc cde")
does not.
Therefore, I write a function something like this:
function run_execute(program, command, arg)
text = ""
full_command = "Start \"\" /B " .. program .. " \"".. command .. "\"" .. " " .. arg
print(full_command)
f = assert(io.popen(full_command, "r"))
for line in f:lines() do
text = text .. line .. " || " -- Cannot use "\n"
--print(line)
end -- for loop
f:close()
return text
end
Along with the undocumented function of "io.popen()", the command can be executed.

Also, the related implementation also enables the possibility of returning parameters.

For instance, you may write the python code to gain the value from "ClipBoard.py", etc. so as to return the value for your defined.
function getClipboard()
program = pythonw_path
command = program_path .. "GetClipboard.py"
text = ""
full_command = "Start /B " .. program .. " \"".. command .. "\""
--print(full_command)
f = assert(io.popen(full_command, "r"))
for line in f:lines() do
text = text .. line .. " \n " -- Cannot use "\n"
--print(line)
end -- for loop
f:close()
return text
end
Indeed, I have used the function to drive the Arduino board to send the IR command to my TV.

lmc_send_keys('^c')
res = getClipboard()
res = trim(res)
lmc_send_to_com('C3', res .. "\n")
================================================================
As my Windows and Office are Chinese versions, the title comparison provided by LuaMacros does not work on them.
Hence, I write the following code to deal with it.
function show_byte(tt)
text = ""
for i = 1,string.len(tt),1 do
text = text .. ", " .. string.byte(string.sub(tt,i,i))
end
print(string.sub(text,3)) -- cut the first two char "," " "
end
function chinese_compare(tt, carray)
if #carray == string.len(tt) then
print(string.len(tt))
print("Match in Size")
for i = 1,string.len(tt),1 do
if string.byte(string.sub(tt,i,i)) ~= carray then
return false
end
return true
end
else
return false
end
end
For each Chinese title, I use "show_byte(tt)" to obtain the byte values of them
tt = lmc_get_window_title()
print(tt)
show_byte(tt)
, while the following macro can be applied to do the comparison.
carray = {165, 92, 175, 224, 197, 220, 188, 198}
if (chinese_compare(tt, carray)) then
--Perform the task
end

I hope the sharing can help some of the users of LuaMacros.