Alessio Posted April 22, 2020 Share Posted April 22, 2020 Hi All, I created some tools to generate workseets with record information of some custom symbols. Now i want to create a tool were I can select the sheetname that I want to generate. I started a new tool and then at "Edit Definition" I created some booleans with the sheet names i want to generate. Can someone tell me how to start the script? I want it to be like: If One boolean is selected than it runs the tool that generates the worksheets and if more booleans are selected it runs all selected tools. Kind Regards, Alessio Quote Link to comment
Pat Stanford Posted April 22, 2020 Share Posted April 22, 2020 What do you mean by Tools? Are these actually Plug-in Tools that live in a tool palette? Or are these just scripts? If they are just scripts I don't think there is a way to call a different script from another script. If you don't mind them being Menu Commands, you might be able to make Plug-in Commands, add them to your workspace and run them using the Do Menu Text By Name. But I am not sure that Do Menu Text By Name will work with custom commands. Hopefully someone will point out how to run a script from within a script and we will both learn something ;-) Quote Link to comment
JBenghiat Posted April 22, 2020 Share Posted April 22, 2020 To add to what Pat said, the screen shot looks like you may be trying to use a custom object in order to perform a series of tasks. What you seem to want is a custom menu command that uses a custom dialog. Quote Link to comment
Alessio Posted April 22, 2020 Author Share Posted April 22, 2020 Hi Pat, Thank you for the quick reply, in the plug in manager i created a "tool" with just a script in it to generate a worksheet. In my tool set i made some buttons for it like in the video i attached. I want to make a tool that triggers these tools with the boolean selection. It would be great if that works. Kind Regards, Alessio ScreenRecorderProject2.mp4 Quote Link to comment
Alessio Posted April 22, 2020 Author Share Posted April 22, 2020 21 minutes ago, JBenghiat said: To add to what Pat said, the screen shot looks like you may be trying to use a custom object in order to perform a series of tasks. What you seem to want is a custom menu command that uses a custom dialog. I want it to be like: Select tool -> click drawing -> get dialoge screen with screen selection -> press oke -> generate all the selected Worksheets. Quote Link to comment
JBenghiat Posted April 22, 2020 Share Posted April 22, 2020 1 hour ago, Alessio Meerman said: I want it to be like: Select tool -> click drawing -> get dialoge screen with screen selection -> press oke -> generate all the selected Worksheets. Hm, that is a very off-label use of a tool. Why not use a menu command — that would save you several extra clicks? You would still need to create a custom dialog for what you describe. Quote Link to comment
Alessio Posted April 22, 2020 Author Share Posted April 22, 2020 56 minutes ago, JBenghiat said: Hm, that is a very off-label use of a tool. Why not use a menu command — that would save you several extra clicks? You would still need to create a custom dialog for what you describe. Oke i am completly new at this. Is there a manual somewhere how i can set it up? Quote Link to comment
Pat Stanford Posted April 22, 2020 Share Posted April 22, 2020 As Joshua was saying, normally a tool is used only if what you are doing requires a click in the drawing, for instance to select an object or to set an insertion point for an object. And normally tools do not open dialog boxes asking for more input after they are started. Menu Commands are normally used for activities that either don't care about what is in the drawing or that will operate on the current selection and run immediately without requiring a click in the drawing. Menu commands often do open dialog boxes for more information. See the Scale Objected Menu command versus the reshape tool (or selection tool). Both can be used to scale an object, but in very different ways. There is room for both ways of working it just depends on what works best for you. As far as I know, this information is not really written down anywhere other than a variety of posts to the forum. I thought there were a couple of pinned threads at the top of the Vectorscript Forum, but I don't see them. I will see if I can find the links. Quote Link to comment
Alessio Posted April 23, 2020 Author Share Posted April 23, 2020 12 hours ago, JBenghiat said: Hm, that is a very off-label use of a tool. Why not use a menu command — that would save you several extra clicks? You would still need to create a custom dialog for what you describe. Hi Josh, I changed the script from a tool to a menu command and tried triggering it with "Do Menu Text By Name" and that worked perfect. i also created a Custom dialog with checkboxes. How can i make a checkbox listen to a "DoMenuTextByNamen"if it is checked? Here is the script for the dialog: PROCEDURE CreateDialog; VAR id: LONGINT; result : LONGINT; BEGIN id := CreateLayout('Create Screen Report',TRUE,'Create', 'Cancel'); CreateStaticText(id,5,'Select Screens:',-1); CreateCheckBox(id,6,'All Screens'); CreateCheckBox(id,7,'Screen 1'); CreateCheckBox(id,8,'Screen 2'); CreateCheckBox(id,9,'Screen 3'); CreateCheckBox(id,10,'Screen 4'); CreateCheckBox(id,11,'Screen 5'); CreateCheckBox(id,12,'Screen 6'); CreateCheckBox(id,13,'Screen 7'); CreateCheckBox(id,14,'Screen 8'); CreateCheckBox(id,15,'Screen 9'); CreateCheckBox(id,16,'Screen 10'); SetFirstLayoutItem(id, 5); SetBelowItem (id,5,6,0,0); SetBelowItem (id,6,7,0,0); SetBelowItem (id,7,8,0,0); SetBelowItem (id,8,9,0,0); SetBelowItem (id,9,10,0,0); SetBelowItem (id,10,11,0,0); SetBelowItem (id,11,12,0,0); SetBelowItem (id,12,13,0,0); SetBelowItem (id,13,14,0,0); SetBelowItem (id,14,15,0,0); SetBelowItem (id,15,16,0,0); SetHelpText(id,6,'This will create all screens combined in one report.'); result := RunLayoutDialog(id,NIL); END; RUN(CreateDialog); Quote Link to comment
JBenghiat Posted April 23, 2020 Share Posted April 23, 2020 You next step is to create a dialog handler. The handler function runs when the dialog first opens and every time the user interacts with an element in the dialog. The handler has item as one of its arguments, which corresponds to the id of each dialog element. In your case, the handler will respond to the ok button (item 1), and get the value of each check box. You can either create your worksheets during the ok event, or use global variables to store the Boolean values and act accordingly after the dialog has exited. see examples here: https://developer.vectorworks.net/index.php/VS:Creating_a_Custom_Dialog_Box Quote Link to comment
Alessio Posted April 30, 2020 Author Share Posted April 30, 2020 Hi All, I got it working the way i want with the custom dialog. thank you! 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.