Script writer command input
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Been using Lee Mac's Script Writer few times every year. It troubles my mind that I don't totally (or very much at all) understand how to create scripts with working command queue's.
Example of very simple script which I've used to clean drawings: _.open *file* _.purge _all * _no _.qsave _.close
In above script, some kind of selection is made with *. Parameter/input * for this selection I found from somewhere, but have no idea who came up with the solution and where the information was found. Back then didn't even know what it selected.
Set the autocad logging function on and by reading the log it became clear what function * had in here. For some reason autocad commandline did not anymore print information when running scripts. Remember it before did 🤔 Therefore the logging.
Enter type of unused objects to purge [Blocks/DEtailviewstyles/Dimstyles/Groups/LAyers/LTypes/MAterials/MUltileaderstyles/Plotstyles/SHapes/textSTyles/Mlinestyles/SEctionviewstyles/Tablestyles/Visualstyles/Regapps/Zero-length geometry/Empty text objects/Orphaned data/All]: _all Enter name(s) to purge <*>: * Verify each name to be purged? [Yes/No] <Y>: _no Deleting block "xxx1".
Repeating the same process with autocad GUI: purge -> purge all, the following prompt appears. In no way does this correspond to what autocad wants from the script after "_.purge _all". GUI wants me to answer a question purge this/all/skip, while the script asks filenames.
In Lee Mac's guide following is written: . (period) - Non-redefined command prefix: this prefix is used to account for commands that have been redefined, ensuring that the original standard command is used and not a redefined version.
My current theory is that when period is used before commands, these commands are then run in simplistic way where no prompts appear, like one seen in image above. Correct?
If, then all commands which include prompts must have unique (not the same as when run through GUI) promptless outputs when ran in this simplistic way. Correct?
If, then to create these scripts, user has to know how the application replies for used command and what selections it offers. Otherwise there's no way to know how to write these. Can somebody guide me to place where this kind of information is available? Other guides are also welcome!
Did not yet test, but one possible way to test autocad outputs for different commands could be to run incomplete script with logging on (LOGFILEON) and then try somehow solve the mystery from printed log. Not sure if there would be enough information though. This sounds quite painful, there must be easier way 🤔
Message became quite long, but hopefully people reading this will find it and the replies helpful 🙂