Result and any errors will be visible in Logs tab. You can remove log() calls if everything is working correctly.
Thank you Admin. I will try tomorrow.
If I need to send the command ON only when the object has a value 1 (True) then OFF using an other object with value 1 (TRUE) then the code will be like?:
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:
123456789101112131415161718192021
--Projector Input RGB1 triggered by event script--Sends the command via the PJLINK Protocol to the Projectorvalue = event.getvalue() and1or0sock = require('socket').tcp()
cmd = '%1INPT ' .. 11 .. '\r'sock:settimeout(1)
res, err = sock:connect('192.168.1.98', 4352)
ifresthenres, err = sock:receive(9)
ifresandres == 'PJLINK 0\r'thensock:send(cmd)
res, err = sock:receive(10)
log('receive reply', res, err)
else--log('receive init failed', res, err)endelse--log('connect failed', err)endsock:close()
You either need a resident or a scheduled script depending on how often you want to read the status.
Try this example, you might need to install 2021 firmware as *r pattern is not supported in older firmwares. Change IP/port as needed. If the status read works then the script can be modified to write info into objects.