SamIWas Posted April 16, 2014 Share Posted April 16, 2014 Is there any way to write a Vectorscript which can run another Vectorscript? I've been looking but can't find the answer. Not looking for includes, but for one script which calls up and runs a completely separate script based on some sort of input. What I'm considering is a bay to work around Vectorworks limited keyboard shortcuts by creating a script which takes a single letter input and chooses what to run. This could open up a whole new level of shortcuts. When linked to an external command screen like Custom Keypad on the iPad, this could really change the way I do things. For instance, I could assign Command-Shift-Option-C to run the "Key Command" script. That script asks for a letter. I press "A", and it then runs "Assign Circuit" or something like that. When the main command and the letter are assigned to a button on the iPad, one press for me can run just about anything. Quote Link to comment
Miguel Barrera Posted April 17, 2014 Share Posted April 17, 2014 Yes, it can be done. 1. Add the script to a menu command with the workspace editor. 2. In your Key Command Script call another script with the name of the script. DoMenuTextByName('Script Name',0); Quote Link to comment
SamIWas Posted April 23, 2014 Author Share Posted April 23, 2014 Thanks. I thought I had tried that before and it didn't work. I'll give it a go again. Quote Link to comment
SamIWas Posted April 23, 2014 Author Share Posted April 23, 2014 Tried and tried again, using every variation of where things were placed and how they were called, and could not get it to work. Until I remembered that all of my custom scripts start with a space, which I wasn't putting in the script call. Then it worked. Sheesh! Thanks for the help! Quote Link to comment
Hein Posted April 30, 2014 Share Posted April 30, 2014 I am unable to make DoMenuTextByName work. I do not have the space issue like poster above. I recently upgraded to VW14 and my scripts that previously ran this command, are now just skipping over this line (in the debugger). I have moved the files to the main Plug-Ins folder. Added .vsm to the file name and also tried to use whole path and filename. all to no avail At this point I have stripped down my script to one message line with no variables. It is clear that the menu script does not run from the calling script. what am I doing wrong? Quote Link to comment
Hein Posted May 1, 2014 Share Posted May 1, 2014 So.. to answer my own question: DoMenuTextByName is no longer supported in VW14 for Linear objects. I assume this is also true for point objects,path objects etc. This command only works from another Menu command. Quote Link to comment
Miguel Barrera Posted May 1, 2014 Share Posted May 1, 2014 A menu can only be a command script and I did test and confirm that DoMenuTextByName was working in VW 2014 before replying. You should not run, if even possible, any other type such as a tool or object pio's. These types should be added to tool palettes only. It is hard to determine what is the problem without looking at the script. It might be something as simple as missing the Run('script name') at the end or something more complicated. Quote Link to comment
Hein Posted May 5, 2014 Share Posted May 5, 2014 To be clear, DoMenuTextByName can NOT be called from within a pio. even if the script it is calling is a command script. Quote Link to comment
Miguel Barrera Posted May 7, 2014 Share Posted May 7, 2014 I would agree with that because it happened to me also. I use the "TrueType To Polyline" menu in a street name sign pio and had to change the script to create the text outside of the reset event. So to be even more specific, it does not work in the reset (draw) event of a pio. In your case, I would look for equivalent functions in vectorscript and replace the DoMenuTextByName calls. The only reason I use the "TrueType To Polyline" menu is because there is no equivalent function in vs but I have managed to do almost all other drawing with vs functions. Is there any particular menu that you use often? Quote Link to comment
Hein Posted May 12, 2014 Share Posted May 12, 2014 The menus I used were all written by me. I worked around this by using {$INCLUDE} files. However, the include texts have problems of their own. Spacing and formatting is lost after exiting the editor. Individual lines all appear on the same line and often the script will not function after this. For example: Begin message('Hello'); End; becomes Beginmessage('Hello');End; this obviously generates an error message. Quote Link to comment
Hippocode Posted May 13, 2014 Share Posted May 13, 2014 To be clear, DoMenuTextByName can NOT be called from within a pio. even if the script it is calling is a command script. This can be done if its not in the recalc event. I have buttons on my pio that can load other menu commands. Quote Link to comment
Hein Posted May 14, 2014 Share Posted May 14, 2014 What does that mean? "not in the recalc event" Where can I get more info on this? Quote Link to comment
Hippocode Posted May 15, 2014 Share Posted May 15, 2014 (edited) What does that mean? "not in the recalc event" Where can I get more info on this? Just google for event based pio. This forum and vectorlab has some articles about it. Basicly you allow yourself to work with pio events such as a parameter change, layer change etc. You can let your pio respond to any of those. The standard recalculation event is what you have coded now, but if you add a custom button, pushing it will excecute another event that allows you to use other plugin commands. Edited May 15, 2014 by hippothamus Quote Link to comment
SamIWas Posted June 9, 2014 Author Share Posted June 9, 2014 At this point I have stripped down my script to one message line with no variables. It is clear that the menu script does not run from the calling script. what am I doing wrong? It's nearly a month and a half later, but I stumbled back across this thread. I have had several problems with some scripts not running. Even if I do the same, stripping them down to just a message line, and a run line, they don't work. Copy and paste the the script into a new file, and it runs just fine. There's something that gets mucked up in these things. Quote Link to comment
JBenghiat Posted June 11, 2014 Share Posted June 11, 2014 Sam, Can you clarify? Are these scripts in script palettes? What isn't working-- are you getting error messages? Going back to your original question, you are on a Mac, so you can use command-? to search for a menu item by name and execute with [return]. Between the workspace editor and calling commands with the help menu, you can access quite a lot with the keyboard. You could probably configure your iPad to send a series of keystrokes that access and choose menus via the help search box. For more scripted commands, you can bundle everything into a single dialog that you run via a menu command. If the menu has a series of buttons, include an ampersand (&) before the character of the button name you would like to use as a shortcut. Note, some shortcuts are reserved by the system. If you menu is a plug-in (type command), it will be available for every document as well as for keyboard access. HTH, Josh Quote Link to comment
SamIWas Posted June 20, 2014 Author Share Posted June 20, 2014 (edited) Sam, Can you clarify? Are these scripts in script palettes? What isn't working-- are you getting error messages? Hey Josh, My issues in your quoted post weren't related to the DoMenuTextByName command. It was when I was re-writing all my scripts as I did a complete redo for 2014. I'd create a new script, it would compile fine, and when I'd run it, nothing would happen. I'd get all the way until I deleted everything from the script except a message line saying "I ran", and it still wouldn't work. Then I'd start a new script, copy and paste the original script I had written, and it would run just fine. So somewhere in maybe the duplication and changing of script names, something gets mucked up here and there. I had huge problems in 2013 where I had to quit and restart Vectorworks for every script I wrote before it would run. 2014 has been much better about this, and I love the plug-in manager. Not really sure. Edited June 20, 2014 by SamIWas 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.