Jump to content
Developer Wiki and Function Reference Links ×

Trying simple task to learn


Recommended Posts

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);

 

Link to comment

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 by Beat Per Light
Link to comment

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...

Link to comment

@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 by Jesse Cogswell
  • Like 2
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...