Page 1 of 1

lmc_spawn cant run Nircmd with parameter

Posted: 22 Dec 2015, 19:56
by Buzzin
for exmpaple
lmc_spawn("nircmd","mutesystemsound 2")
i only got a nircmd default window(the window you click the nircmd.exe without any parameter)
,it won't run the parameter(mtuesystemsound 2)
i tired different parameter,won't work.
but everything else works fun(notepad ,cmd and so on)

the only solution is lmc_spawn("cmd","/c nircmd mutesystemsound 2")
but will create a flash cmd window,that's annoyed


win7 x64

Re: lmc_spawn cant run Nircmd with parameter

Posted: 27 Dec 2015, 22:21
by admin
Seeing relevant part of source code maybe number 2 makes the trouble as lua identifies the type as number, not string.
I should extend this condition to fix it.
Maybe (to speed thing up) you can do some additional testing with number arguments and different programs. If this is really root cause then any numeric argument should fail (be filtered out) for any program.

Re: lmc_spawn cant run Nircmd with parameter

Posted: 15 Dec 2017, 10:42
by quirinux
Try to pass multiple parameters like that:

function nircmd(cmd, param1, param2, param3, param4)
lmc_spawn("nircmd", cmd, param1, param2, param3, param4)
end


follow a example of how to call it:
function tooltip(msg)
nircmd("trayballoon", "LuaMacros", msg, "imageres.dll,76", 1)
end

Did you get it? lmc_spawn accepts as much parameters as is needed to run the program

Re: lmc_spawn cant run Nircmd with parameter

Posted: 15 Dec 2017, 10:56
by quirinux
btw, it works well if you pass nothing or less parameters as well, like follow:

function desktop_left()
nircmd("sendkeypress", "ctrl+lwin+left")
end

looks like nil parameters are ignored by lua and by the luamacros interpreter