Beat Per Light Posted September 6, 2023 Share Posted September 6, 2023 Hi, I am trying to learn VectorScript to accomplish some basic tasks for now. For example, in Spotlight, I want to select all plugin-style objects for a type of cable (dmx5) and change the class of all of them. Here's my code. It doesn't throw any errors, but it selects all the cables and doesn't change the class. Does anyone have an idea of what I might be missing here? Thanks. PROCEDURE SetDMXClass; VAR Class: STRING; h:handle; BEGIN SelectObj(INSYMBOL & INVIEWPORT & (PST='Data XLR5-XLR5')); h:= GetParent(FObject); Class := '003.Lightning-005.Cables-004 DMX'; SetClass(h, Class); END; RUN(setDMXClass); Quote Link to comment
Beat Per Light Posted September 6, 2023 Author Share Posted September 6, 2023 I think I've got it... PROCEDURE SetDMXClass; VAR h:handle; BEGIN SelectObj(INSYMBOL & INVIEWPORT & (PST='Data XLR5-XLR5')); h:= FSActLayer; SetClass(h, '003.Lightning-005.Cables-004 DMX'); END; RUN(setDMXClass); If you have any advices... I'm listening.. Quote Link to comment
Beat Per Light Posted September 6, 2023 Author Share Posted September 6, 2023 (edited) No... don't get it.... Just the first object is changing class.. I ma trying this... but... PROCEDURE SetDMXClass; VAR h:handle; BEGIN SelectObj(INSYMBOL & INVIEWPORT & (PST='Data XLR5-XLR5')); h:= FSActLayer; BEGIN while h <> nil do SetClass(h, '003.Lightning-005.Cables-004 DMX'); h:= NextObj; END; END; RUN(setDMXClass); Edited September 6, 2023 by Beat Per Light Quote Link to comment
Beat Per Light Posted September 6, 2023 Author Share Posted September 6, 2023 Now OK.. Searching a lot and finally... PROCEDURE SetDMXClass; VAR hlayer, h:handle; BEGIN SelectObj(INSYMBOL & INVIEWPORT & (PST='Data XLR5-XLR5')); hlayer := GetParent(FObject); while (hlayer <> nil) do BEGIN h := FInLayer(hlayer); WHILE (h <> NIL) DO BEGIN SetClass(h, '003.Lightning-005.Cables-004 DMX'); h := NextObj(h); END; hlayer:= NextLayer(hlayer); END; END; RUN(setDMXClass); Still open to some feedback... Quote Link to comment
Jesse Cogswell Posted September 6, 2023 Share Posted September 6, 2023 (edited) @Beat Per Light You should really look into the ForEachObject procedure. The script you are trying to write is VERY simple, with just two lines of "real" code (not BEGIN/END statements or procedure contructors). PROCEDURE SetDMXClass; PROCEDURE Execute(h:HANDLE); BEGIN SetClass(h,'003.Lightning-005.Cables-004 DMX'); END; BEGIN ForEachObject(Execute,(INSYMBOL & INVIEWPORT & (PST = 'Data XLR5-XLR5'))); END; Run(SetDMXClass); Edited September 6, 2023 by Jesse Cogswell 2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.