Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
greentea

Vectorscript - ask for variable

Recommended Posts

Hi all,

 

I am somewhat new to vectorscript, but am familiar with some web coding, so I thought I'd try this out.  What I want to do is to make a custom selection of id leaders.  For example, the script below selects only the id leaders with tag text variable='34'.  I'd like to reuse this script but for other tag text variables.  ie, select all id leaders with tag text variable='10' or '25' etc. Can someone tell me where in help I can find out how to edit this script so a dialog box pops up and asks me for tag text variable, and then upon clicking ok, it would go from there?

 

DSelectAll; SelectObj((INSYMBOL & INVIEWPORT & (PON='ID Leader') & ('ID Leader'.'TagText'='34')));

 

Thanks in advance!

Edited by greentea

Share this post


Link to post

T,

   Here's an example of a short script using a pre-defined String Dialog to get you started. Modify to your heart's content.

PROCEDURE abc;
VAR
	default, result :STRING;
BEGIN
	default := '';
	result := StrDialog('Enter Leader text...', default);
	if not DidCancel then begin
		DSelectAll; 
		SelectObj( INSYMBOL & INVIEWPORT & (PON='ID Leader') & ('ID Leader'.'TagText' = result) );
	end;		{ if }
 END;
Run(abc);

It should read fairly straightforward, except for "DidCancel". Consider "DidCancel" as a global variable that is set to TRUE when a user closes a standard dialog box by pressing the OK button, and is set to FALSE when a user presses the CANCEL button. Word of future caution, don't use the word "DidCancel" as one of your variable or procedure names.  ;-O

 

HTH,

Raymond

Share this post


Link to post

Wow Raymond, you just saved me days of pouring over the help file and experimenting and troubleshooting.  You are awesome!  Thanks so much, I know I will learn quite a bit by "reverse engineering" this to figure it out how vectorscript works.  Thanks again!

Share this post


Link to post

T, you are very welcome. One way to learn how the calls are organized is to view the DevWiki or the HTML (on your computer) references using the "View By Class" link (see pic). This will allow you to ignore the majority of calls that probably don't relate to the problem you are interested in solving. With more than 2600 VS calls, filters are highly recommended. Also, keep writing back. Someone is always awake and ready to answer questions.

 

5a1e191551179_ByClassHTML.thumb.png.f94d2e095d6c819f8deaa6f31ad0613a.png

 

All the best,

Raymond

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×