It might help others to use more descriptive subject lines in your posts such as
"GUI.widget() does not always work as expected".
Your post is not explicitly clear about which line(s) are not working.
However, I know SIDVD is a command sent to a Denon/Marantz unit to set the input to DVD so I can likely figure that piece out.
Activity script can run when a page is not yet visible.
GUI.widget() can return null when called from within the Activity script if a page script has not been executed. This frequently happens when entering an Activity for the first time. Only at the time a Page script executes are widgets available for you to tweak. See Sections 7.2 and 7.2.1 of the DEV Guide.
Your script is trying to set the 'visible' property of null will throw an error and all remaining lines will be skipped.
Section A.6.2.7 of the DEV Guide.
GUI.widget - Search for a widget
that is currently displayed on the screen. This also includes firm keys and hard keys.
Return
Widget
The class instance corresponding to the found widget,
or null if not found.
Either check for this condition and handle it or move the widget setup code into a Page script.
Last edited by Lyndel McGee on August 25, 2020 15:02.