rayg11757 Posted January 1, 2011 Posted January 1, 2011 I suspect what I am looking to do cannot be done, but I thought I'd ask anyway. I would like to write a routine that just loads a third-party program's ".INI" file directly, without having to go through the DCL's. I have a licensed software package that uses DCL's to load a user-defined configuration file. The configuration file has many settings that I toggle for "new, existing, demolition, future" work, etc. I am using this DCL very often. In my haste, I have selected SAVEAS instead of GET CONFIG and overwritten my settings. I would like to write a toolbar lisp routine or macro that runs the configuration command and makes the appropriate selection with one pick. The best analogy of what I am trying to do is similar to using the "layer" command and AutoCAD opens a DCL; however, when "-layer" is typed, the layer options can be typed at the command line. For lisp programming the "-" allows the command options to be embedded in the routine while avoiding the DCL box completely. In this case, the "command" I am using is called "MQCFG" as part of a Mech-q piping program. The command opens a "Configuration" DCL, which requires several mouse picks and list-box scrolling to complete the command. I then select a "Get Config" button. The "Get Config" button opens another DCL with a window to the directory containing”Mech-q-XXX.INI” files. The DCL does not contain any shortcut keys for the options, and the "-" in front causes the command to bomb. I am running AutoCAD 2006. Any suggestions would be greatly appreciated. Thank you in advance. Ray Quote
Lee Mac Posted January 2, 2011 Posted January 2, 2011 If this custom program is a LISP with a DCL file (along with other .ini files etc), then the LISP will be geared to find and load the Dialog Definition from the DCL file, and will attempt to retrieve values entered into the dialog. The only hope is that there is a subfunction within the LISP taking all the necessary arguments to complete the program, that is being called using the values entered in the Dialog. Should such a function exist, you could call it directly from another LISP with the necessary values and bypass the dialog completely. Lee Quote
lfe011969 Posted January 2, 2011 Posted January 2, 2011 Ray, If the options for your program are stored inside the .ini file you mention, then it should be possible to write your own code to change the relevant options. Open up the .ini file with Notepad and study the code to see which lines store the information for the various options. You could use the (open FILENAME "W") to rewrite the lines of code to incorporate the changes to .ini file. Of course I would definitely make a backup of your .ini file before you attempt anything just in case. Quote
rayg11757 Posted January 2, 2011 Author Posted January 2, 2011 Lee/Lonnie, Thanks for your help. I opened the ini file. It is strictly line-delimited data, such as layer names, settings, and possibly switches. There are no apparent commands that indicate how to the routine is called and executed, and I cannot determine what the program does with the data. Lee, I think you're right. I think I need the name of the subfunction running within the routine. I will try to contact the company who wrote the software and see if they can provide the function name to me. I am hoping the developer can provide a shortcut. It seems that the dialog boxes stop the execution of the routine and there is no way to make the program continue until mouse inputs are made. It's such a burden to toggle the settings the way the program now operates. Thanks again for your help. Ray Quote
lfe011969 Posted January 2, 2011 Posted January 2, 2011 Ray, You could take a snapshot of the .ini file like it is now for you then go into the program and change only one value. Then you could compare the code to see what actually changed in the .ini file which might help you figure out if it is possible to change the settings in the ini file like you want. I looked up Mech-Q and I'm not sure how much support you're going to get on their forums as it seems the posts there are made up of 75% spam, lol (http://www.asvic.com.au/). 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.