lmc_spawn cant run Nircmd with parameter

Report any bugs or suspicious behaviour here
Post Reply
Buzzin
Posts: 8
Joined: 22 Dec 2015, 12:20

lmc_spawn cant run Nircmd with parameter

Post by Buzzin » 22 Dec 2015, 19:56

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

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: lmc_spawn cant run Nircmd with parameter

Post by admin » 27 Dec 2015, 22:21

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.
Petr Medek
LUAmacros author

quirinux
Posts: 3
Joined: 15 Dec 2017, 10:36

Re: lmc_spawn cant run Nircmd with parameter

Post by quirinux » 15 Dec 2017, 10:42

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

quirinux
Posts: 3
Joined: 15 Dec 2017, 10:36

Re: lmc_spawn cant run Nircmd with parameter

Post by quirinux » 15 Dec 2017, 10:56

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

Post Reply