Select light ? by name ? with python

EDIT: Silly me figured out light’s names are regular object names so I used “_-Selname Spot1” which seens to work well enough for this use. :wink:

Hello,

I want to iterate over views and take pictures with this script (if it looks messy it´s because I butchered something I found here some time ago):

import rhinoscriptsyntax as rs
import os
import Rhino as rh

all_views = rs.NamedViews() # a list of names (strings)
selected_views = rs.MultiListBox(all_views, message = "select views to save", defaults = all_views)
if selected_views == None:
    exit()

folder = rs.BrowseForFolder(rs.DocumentPath(), "destination directory")
if folder == None:
    exit()

hd = rs.MessageBox('Render views in HD?', 4, 'HD renders')
res = 8 - hd

for view_name in selected_views:
    rs.RestoreNamedView(view_name)
    rs.Command('-_ViewCaptureToFile _Width 1200 _Height 1600 _scale '+str(res)+chr(32)+chr(34)+folder+'\\'+view_name+'.png'+chr(34)+' _EnterEnd', False)

But for better looks I want to use a spotlight coming from the camera. I’ve made a spotlight which I named “Spot1” in the Lights Panel. Very conveniently there is a comand _SetSpotlightToView and so far I should be OK. But how do I reference “Spot1” spotlight to the script? Clicking on it anytime during the time the script runs is unfortunatley not an option.

Thank you for any kind of help. :slight_smile: