Euler Posted July 14 Share Posted July 14 Hi All, Wondering if anyone can help with this question. If I make a linear plugin object then the script runs twice, and if I make a rectangular plugin object then the script runs 3 times. This is regardless of whether I have "developer mode" turned on or off. The script is simply: import vs vs.AlrtDialog('test') Does anyone know the solution? Thanks. Quote Link to comment
Pat Stanford Posted July 14 Share Posted July 14 This is normal behavior for PIOs. I don't remember all the details, but we have discussed this before. Basically, the script runs when the object is placed and then again when the object is reset. I am not certain what the third run for a rectangular PIO is. I THINK that if you make an event enabled PIO (much, much more complicated) then you can catch the different events sent for the different runs and only run the parts of the script (including parts that have zero code) that need to be run at that time. Sorry. HTH. Quote Link to comment
Euler Posted July 16 Author Share Posted July 16 Thanks Pat. I am currently writing a plugin where the user will draw a line or rectangle then, based on the dimensions of the line or rectangle, a dialogue box will appear with various checkbox options that the user can select. There will then be information placed on the drawing depending on what the user selects. I have achieved all of this, except that the dialogue box appears twice when the line is initially drawn. Do you know if there's a workaround for this? Thanks. Quote Link to comment
Pat Stanford Posted July 16 Share Posted July 16 @michaelk has a script where he checks the time and if the script runs again within a certain number of seconds does something different (or doesn't do something, I can't remember). You could do something like that. Or maybe play with VSTGetEventResult and see if that gives different values on each run. GetEvent might be what you want. Take a look at this thread where michaelk asked almost the same questions a few years ago and @MullinRJ provided a good answer. 1 Quote Link to comment
MullinRJ Posted July 16 Share Posted July 16 (edited) Hi @PatStanford, I checked the events the other day for all three types of plug-in objects, and you get event 3 each time. Pity. Raymond Edited July 16 by MullinRJ Quote Link to comment
Pat Stanford Posted July 16 Share Posted July 16 So if the event is the same, then something like Michaels time check might be the only solution. Or modify the PIO so that it does not automatically open the dialog box and have the user make those settings in the OIP or via a dialog box opened by a button in the OIP. You could even add a "new" flag field so that the dialog box opens when the object is placed but then check and if it has already opened once then does not open again. Quote Link to comment
Euler Posted July 17 Author Share Posted July 17 Thanks Pat, I think I'll do your suggestion and have a button that the user need to click once the plugin object has already been placed. 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.