vernonlee Posted October 1, 2015 Share Posted October 1, 2015 Some of the work i do are quite repetitive so I usually do this:- 1) go to CUI 2) search through all the individual macro script commands I need & copy out the text & paste them in a notepad & arrange them in sequence 3) go back to CUI 4) create a macro script command button. Paste the combined script. 5) Paste the new button to one of the toolbar I was wondering if there is a quicker way to do this. Such routines is usually a adhoc thing. Thanks Quote Link to comment Share on other sites More sharing options...
YZ Posted October 8, 2015 Share Posted October 8, 2015 The quickest way to write macros on the fly and use them in a drawing is by putting them on the Tool Palette. Start with any existing tool, right-click copy, right-click paste. Then right-click on the new one, Properties. Change the name, and change the Üse Flyout option to "No". Then you can enter your macro into the "Command String" field. Thanks to steven-g for that tip. Now I use it ALL THE TIME. Great for one-off macros. And a faster way to build when you are testing new ones. I have a whole palette dedicated to testing, and just keep copying them and pasting them and making small iterations. Also good for testing each step of a larger macro so you can isolate problems easily, then stitch them all together when you are ready to put it into the CUI. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 8, 2015 Author Share Posted October 8, 2015 Hi YZ. I understand what you mean. Some of my eariler marco scripts was also using Tool Palette. But it took up to much space so I switch to using shortcut buttons on the Tool Bar instead as it occupy a smaller space. These commands are frequently used. In addition, wanted to know if there is a faster way to combine different macro scripts into just 1 button command, in a quick manner. As mention previously I need to openup all the individual scripts command 1 by 1 to copy them out & it is taking me too long. Quote Link to comment Share on other sites More sharing options...
rkent Posted October 8, 2015 Share Posted October 8, 2015 There is a drop down in the command list that will let you show only certain types of commands, etc. Use the drop down arrow and select Custom Commands, at least there will be fewer to sort through. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 9, 2015 Share Posted October 9, 2015 Have you thought about partial menus ? use menuload these can can have multi macros chained together can be toolbars, ribbon or pull downs. Thats teh way I created some of my menus copied and pasted to notepad, add an extra line to mnu then just unload and reload this can also be done as a macro. Quote Link to comment Share on other sites More sharing options...
YZ Posted October 12, 2015 Share Posted October 12, 2015 When creating macros and scripts I always keep them in a spreadsheet. It takes some extra leg work to keep it current, but it is MUCH easier for referring back to when I want to build a new custom command and use elements I have used before. I use Tool Palettes for testing new macros, but also for creating quick ones that are only likely to be used on that one project. For example I once had to grind through and join many lines as polylines, but could not do it automatically, so I quickly wrote something that would start thejoin command, let me pick the lines, and turn them a different colour at the end so I could see which lines had been done. Never used it again. That's what Tool Palettes are great at, and I gladly give it the screen space when I need it. If you want to quickly make keyboard shortcuts, there is no way except through the CUI. Unless you get a certain shortcut run a script file, and then you edit that script file to be whatever you need. But if you are combining scripts that you have already written, and digging them out of the CUI, I'd suggest taking the time once and dumping them all into a spreadsheet. Ironically the CUI has a clumsy UI! Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 13, 2015 Share Posted October 13, 2015 I missed this post the other day, can you post a couple of listings of the type of macro's and scripts you are talking about, showing how you combine them now, just so we are all on the same wavelength. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 13, 2015 Author Share Posted October 13, 2015 There is a drop down in the command list that will let you show only certain types of commands, etc. Use the drop down arrow and select Custom Commands, at least there will be fewer to sort through. Understand what you mean. I also do that. However I want to explore a faster way of combing the scripts without search 1 by 1 Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 13, 2015 Author Share Posted October 13, 2015 Have you thought about partial menus ? use menuload these can can have multi macros chained together can be toolbars, ribbon or pull downs. Thats teh way I created some of my menus copied and pasted to notepad, add an extra line to mnu then just unload and reload this can also be done as a macro. Not entirely sure what you mean however, currently I do create an adhoc toolbar & drag the shortcuts in a sequence thereby creating a chain. So I just press each shortcut in sequence from left to right. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 13, 2015 Author Share Posted October 13, 2015 When creating macros and scripts I always keep them in a spreadsheet. It takes some extra leg work to keep it current, but it is MUCH easier for referring back to when I want to build a new custom command and use elements I have used before. I use Tool Palettes for testing new macros, but also for creating quick ones that are only likely to be used on that one project. For example I once had to grind through and join many lines as polylines, but could not do it automatically, so I quickly wrote something that would start thejoin command, let me pick the lines, and turn them a different colour at the end so I could see which lines had been done. Never used it again. That's what Tool Palettes are great at, and I gladly give it the screen space when I need it. If you want to quickly make keyboard shortcuts, there is no way except through the CUI. Unless you get a certain shortcut run a script file, and then you edit that script file to be whatever you need. But if you are combining scripts that you have already written, and digging them out of the CUI, I'd suggest taking the time once and dumping them all into a spreadsheet. Ironically the CUI has a clumsy UI! Haha. I started out keeping the scripts in excel as well. But it became too much & messy. I then use a free keynote app to store them. Unfortunately I have yet to finish transferring my excel collection into that app not too mention what I have in autocad. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 13, 2015 Author Share Posted October 13, 2015 (edited) I missed this post the other day, can you post a couple of listings of the type of macro's and scripts you are talking about, showing how you combine them now, just so we are all on the same wavelength. GO MODEL SPACE ^C^Ctilemode;1; CHANGE TO WORLD VIEW ^C^C_ucs _w INSERT BLOCK ^C^C_insert;"template";^C-insert;"*REV CLOUD"; ZOOM TO VIEW ^C^CZ;C;30205843,28772432.6,0;20000; GO TO PAPER SPACE ^C^Ctilemode;0; PURGE,ZOOM EXTEND & CLOSE ^C^C-purge;r;*;n;purge;all;*;n;_zoom;e;qsave;close; So what i do is go through all the individual scripts, copied it out & create another macro script with the combine command into 2 routine:- ^C^Ctilemode;1;^C^C_ucs _w;^C^C_insert;"template";^C-insert;"*REV CLOUD"; ^C^CZ;C;30205843,28772432.6,0;20000;^C^Ctilemode;0;^C^C-purge;r;*;n;purge;all;*;n;_zoom;e;qsave;close; Edited October 14, 2015 by vernonlee Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 14, 2015 Share Posted October 14, 2015 (edited) If each of these was a little defun or lisp then you could type something like (joinall "ms wv ib ps pzec") which writes a script and runs all maybe with option to save for future use. Edited October 14, 2015 by BIGAL Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 14, 2015 Author Share Posted October 14, 2015 If each of these was a little defun or lisp then you could type something like (joinall ms wv ib ps pzec) which writes a script and runs all maybe with option to save for future use. All this are macro scripts though. Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 14, 2015 Share Posted October 14, 2015 I like BIGAL's idea. For us that use LT a similar method would be change those macro's to scripts, stored as individual files on the support path (ms.scr wv.scr ib.scr etc - plus one named blank.scr, which is just an empty file) then on your tool palette, or toolbar, or ribbon a link to a macro that contains ^C^C^Cscript;blank;script;blank;script;blank;script;blank;script;blank; All you need to do then is to edit that one macro in the CUI ^C^C^Cscript;ms;script;wv;script;whatever;script;blank;script;blank; And if you have a sequence that you want to keep, save it as a seperate macro. This way you can build up a library of scripts that is easy to maintain. A variation could be just a master script file with all the snippets as commented lines, and uncomment and arrange as needed for using the script. PS Thank you for posting this question, as I am now busy organising my own library of codes. Quote Link to comment Share on other sites More sharing options...
YZ Posted October 14, 2015 Share Posted October 14, 2015 steven-g, wow that is a useful idea. Nice. Quote Link to comment Share on other sites More sharing options...
vernonlee Posted October 15, 2015 Author Share Posted October 15, 2015 I like BIGAL's idea.For us that use LT a similar method would be change those macro's to scripts, stored as individual files on the support path (ms.scr wv.scr ib.scr etc - plus one named blank.scr, which is just an empty file) then on your tool palette, or toolbar, or ribbon a link to a macro that contains ^C^C^Cscript;blank;script;blank;script;blank;script;blank;script;blank; All you need to do then is to edit that one macro in the CUI ^C^C^Cscript;ms;script;wv;script;whatever;script;blank;script;blank; And if you have a sequence that you want to keep, save it as a seperate macro. This way you can build up a library of scripts that is easy to maintain. A variation could be just a master script file with all the snippets as commented lines, and uncomment and arrange as needed for using the script. PS Thank you for posting this question, as I am now busy organising my own library of codes. Thanks for the suggestion steven-g. Still trying to digest & understand how that works. Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 15, 2015 Share Posted October 15, 2015 A macro can call multiple scripts, so if you have a library of small scripts stored in a file on the filepath, you can just call up the scripts in the order you need (the blank script is empty and therefore ignored), the only reason to string all those together in the macro is just to save a few seconds by not having to type the word script each time you adjust the macro (OCD). I was copying all my macros out into a master txt file yesterday to convert them to scripts and had my CUI and a text document each set to half screen width, it was really quick just going between the two and using Ctrl+c and Ctrl+v. Quote Link to comment Share on other sites More sharing options...
tombu Posted October 15, 2015 Share Posted October 15, 2015 Late, but for any macro used to modify selected objects I prefer (right-click) Shortcut Menus. They take no screen space, you never have to look for them, and when you select an object or a group of like objects only macros for that object type are shown. Contextual Tabs are designed for this purpose as well. I keep most everything else on the Ribbon and Quick Access Toolbars controlled by Workspaces. I quit using the old drop-down Menus and Toolbars 3 years ago in favor of the Ribbon. Quote Link to comment Share on other sites More sharing options...
steven-g Posted October 15, 2015 Share Posted October 15, 2015 +10 Brilliant You have just given me a 100% drawing area, well it will be soon anyway; Thank you Quote Link to comment Share on other sites More sharing options...
tombu Posted October 15, 2015 Share Posted October 15, 2015 +10 BrilliantYou have just given me a 100% drawing area, well it will be soon anyway; Thank you It took me a while to build them. LWPline Object Menu for a single LWPline & LWPline Objects Menu for multiple LWPlines as an example. There are special names for Block and Xref Shortcut menus you can find in help → About Creating Shortcut Menus. Quote Link to comment Share on other sites More sharing options...
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.