hunszab Posted July 16, 2010 Posted July 16, 2010 Hi everyone! I need help. Here is my problem: I want to write a lisp program that loads automatically a menu file (mns) and runs 2 macros. And I want to modify also the Support File Search Path. Could anyone help my out, please! Thanks for any answers! Best regards Quote
Tharwat Posted July 16, 2010 Posted July 16, 2010 Hi What are the actions of macros you want to implement ? If you want to change the Support file you can do that from Autocad Options in the first tab.. Regards Tharwat Quote
hunszab Posted July 16, 2010 Author Posted July 16, 2010 Hi! Here is my problem: The users will use my program (my functions and menu) so I have to do everything automatically, because most users dont know how to modify the support file search path. So That's why I need to know how can I modify the support file path programmatically and how can I run macros. Because if the user options is that: macros disabled, the macros wont run automatically Regards Quote
Tharwat Posted July 16, 2010 Posted July 16, 2010 Hi!Here is my problem: The users will use my program (my functions and menu) so I have to do everything automatically, because most users dont know how to modify the support file search path. So That's why I need to know how can I modify the support file path programmatically and how can I run macros. Because if the user options is that: macros disabled, the macros wont run automatically Regards For Macros, open CUI then make a new command and post your codes in the macro tag and don't forget to add this new command to your menu . What you want to change in Support file ???? Regards Tharwat Quote
hunszab Posted July 16, 2010 Author Posted July 16, 2010 Hi Thanks, but I dont know how to write a macro that runs another macro... For example: I made the menu, just need the command to run "mymacro". What will be the command? ^C^C( run "mymacro") or what ? Where can I find some information about writing macros? Thanks Regards For Macros, open CUI then make a new command and post your codes in the macro tag and don't forget to add this new command to your menu . What you want to change in Support file ???? Regards Tharwat Quote
The Buzzard Posted July 16, 2010 Posted July 16, 2010 Hi!Here is my problem: The users will use my program (my functions and menu) so I have to do everything automatically, because most users dont know how to modify the support file search path. So That's why I need to know how can I modify the support file path programmatically and how can I run macros. Because if the user options is that: macros disabled, the macros wont run automatically Regards See this link on Afralisp, It will show you how:http://www.afralisp.net/archive/lisp/install1.htm Quote
Tharwat Posted July 16, 2010 Posted July 16, 2010 HiThanks, but I dont know how to write a macro that runs another macro... For example: I made the menu, just need the command to run "mymacro". What will be the command? ^C^C( run "mymacro") or what ? Where can I find some information about writing macros? Thanks Regards I have asked before what kind of action do you want to perform? And according to what you have mentioned, it shows that you are well known with programing which would make something to beginners to follow !!!!! Write what you want clearly and directly, and that's would be good for all and for your gain aims of them . Regards Tharwat Quote
hunszab Posted July 16, 2010 Author Posted July 16, 2010 Ok, I try to write my problem down clearly: That's a program what is completely working, but the user must do many things to work. (ok, most things just once as an option, first time) 1) He/She has to modify the Support File Path (if is possible I want to do it programatticaly, I have found a command: addsupportfilepath but doesnt work) 2) In the AutoCad file (.dwg) there are 2 macro. It has to be runned. Normally when somebody opens a dwg file that contains macros the system ask the user if he wants to run it. My problem is, maybe the user clicks NO, or the system doesnt ask he, and he forgets to run the macros... So I have to run the 2 macros. I ve allready solved this. I wrote a function: (command "-vbarun" "mymacro.whatever") I ask: when I run my function -so in the function -, can I determ if the macro was found and successfully runned? (of course in the command line I see, if something happend: BUT user is stupid and he/she doesnt) I want to make a menu, where the user just has to click and the program makes these things (support file, run macros). The menu is done. I think that's all. I hope now the problem is clear. I wait the responds! regards I have asked before what kind of action do you want to perform?And according to what you have mentioned, it shows that you are well known with programing which would make something to beginners to follow !!!!! Write what you want clearly and directly, and that's would be good for all and for your gain aims of them . Regards Tharwat Quote
hunszab Posted July 16, 2010 Author Posted July 16, 2010 I forget to say: I want to determine if the user disabled the macros, and if did, I want to enable it. IS it possible from a lisp function? Quote
Lee Mac Posted July 16, 2010 Posted July 16, 2010 (defun LM:AddSupportPaths ( lst / PreferenceFiles SupportPaths ) ;; © Lee Mac ~ 14.06.10 ;; (AddSupportPaths '("C:\\Folder" "C:\\Folder\\Subfolder" ... ) (vl-load-com) (setq SupportPaths (vla-get-SupportPath (setq PreferenceFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object) ) ) ) ) ) (vla-put-SupportPath PreferenceFiles (LM:lst->str (cons SupportPaths (vl-remove-if (function (lambda ( s ) (vl-string-search s SupportPaths) ) ) lst ) ) ";" ) ) lst ) (defun LM:RemoveSupportPaths ( lst / PreferenceFiles SupportPaths ) ;; © Lee Mac ~ 14.06.10 ;; (RemoveSupportPaths '("C:\\Folder" "C:\\Folder\\Subfolder" ... ) (vl-load-com) (setq SupportPaths (vla-get-SupportPath (setq PreferenceFiles (vla-get-files (vla-get-preferences (vlax-get-acad-object) ) ) ) ) ) (vla-put-SupportPath PreferenceFiles (LM:lst->str (vl-remove-if (function (lambda ( s ) (vl-position s lst) ) ) (LM:StringParser SupportPaths ";") ) ";" ) ) lst ) (defun LM:lst->str ( lst del ) ;; © Lee Mac ~ 14.06.10 (if (cdr lst) (strcat (car lst) del (LM:lst->str (cdr lst) del)) (car lst) ) ) (defun LM:StringParser ( str del ) ;; © Lee Mac ~ 14.06.10 (if (setq pos (vl-string-search del str)) (cons (substr str 1 pos) (LM:StringParser (substr str (+ pos 1 (strlen del))) del)) (list str) ) ) Quote
hunszab Posted July 16, 2010 Author Posted July 16, 2010 Thanks a lot. My last question is: Can I determine if the macros are enable or not? ANd if not can I enable it? Thanks Quote
Lee Mac Posted July 16, 2010 Posted July 16, 2010 Are you referring to toolbar macros or LISP files? Quote
hunszab Posted July 16, 2010 Author Posted July 16, 2010 to macros! Because if the user disabled the macros I need to enable it and run them. So I have to determine if the macros are disabled or not. Are you referring to toolbar macros or LISP files? Quote
hunszab Posted July 28, 2010 Author Posted July 28, 2010 Hi everyone! I have the following problem: I have a menu (DCL) with a popup_list. I want to do: when the menu starts i.e. the 3rd item must be selected, and not the default 1st. Thanks any help! Quote
The Buzzard Posted July 28, 2010 Posted July 28, 2010 You could do this in the dcl. : popup_list { key = "key"; value = "3"; } Quote
dbroada Posted July 28, 2010 Posted July 28, 2010 to macros! Because if the user disabled the macros I need to enable it and run them. So I have to determine if the macros are disabled or not. just thinking out loud here - once I have disabled macros I want them disabled, I don't want something to come along and change that for me. Am I being unreasonable? Quote
hunszab Posted July 28, 2010 Author Posted July 28, 2010 Normally you are right! BUT: the AUTOCAD drawing is connected with MYSQL database, so macros must be enabled, otherwise the whole story wont work, and the user just blink...."why these stupid program doesn't work" @The Buzzard: thanks a lot, and can I do it dinamically for example with a variable? Quote
The Buzzard Posted July 28, 2010 Posted July 28, 2010 Normally you are right!BUT: the AUTOCAD drawing is connected with MYSQL database, so macros must be enabled, otherwise the whole story wont work, and the user just blink...."why these stupid program doesn't work" @The Buzzard: thanks a lot, and can I do it dinamically for example with a variable? Using a variable is not a problem, But I did not show an example for this because I do not know how you wrote your action_tiles in your code. If you can post it, I can recomend something. Quote
hunszab Posted July 28, 2010 Author Posted July 28, 2010 Thanks a lot! I've already solved the problem. Quote
hunszab Posted July 30, 2010 Author Posted July 30, 2010 (edited) Hi all! How can I select every object that is in a specific point? To be more specific... I have blocks, so they have just one point. And I want to select a block that point is i.e. (0,0) or (x,y). So how can I do that? Thanks any help Edited July 30, 2010 by hunszab Quote
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.