04.11.2020, 20:19
(This post was last modified: 04.11.2020, 20:22 by manos@dynamitec.)
(04.11.2020, 15:16)YOUSSEF Wrote: Hello admin
am trying an event based script to change input based on
11: RGB 1
31: HDMI 1
32: HDMI 2
nothing is working :/ any help on this
tks
Hello Youssef, please see below my code that worked without problems. The trigger value was always set to ON (1) for me. Make sure that the password for the user account is empty and that the webcontrol and PJLINK is active on the projector settings.
You have to change the '12' (input source) to your values every time and also change the IP address/Port to match your installation.
Code:
--Projector Input RGB1 triggered by event script
--Sends the command via the PJLINK Protocol to the Projector
value = event.getvalue() and 1 or 0
sock = require('socket').tcp()
cmd = '%1INPT ' .. 11 .. '\r'
sock:settimeout(1)
res, err = sock:connect('192.168.1.98', 4352)
if res then
res, err = sock:receive(9)
if res and res == 'PJLINK 0\r' then
sock:send(cmd)
res, err = sock:receive(10)
log('receive reply', res, err)
else
--log('receive init failed', res, err)
end
else
--log('connect failed', err)
end
sock:close()