Autocad Extract Text Lisp Routine

CAD AddOn Package for Piping Isometric Drawings. AutoLisp Free Programs, Tutorials, Examples, Excel to AutoCAD, You name itScripting Objects Part 1by Stig Madsen. Windows provides several script engines, most of which are primarily. Among the engines are JScript, VBScript and. PERL. When a script is run by Windows, it is handled by Windows Script Host. WSH, which invokes the appropriate script engine. WSH itself provides access to a range of administrative objects and services. Well only. look at one particular object in WSH and only to retrieve some limited. Feel free to learn more about WSH and what it can do. Shell object can be useful. Another part of scripting is the Script Runtime Library which provides. Windows. It. contains 3 main objects and we will use one of them to retrieve information. Visual Lisp. The object is called the File. System. Object. It provides access to the file system in a way that not only gives. The hardest thing about accessing objects outside Auto. CAD with Visual. Lisp is not using the VLAX or VLA functions. Its knowing where to get the. Die PCFAQ enthlt Antworten zu vielen Fragen rund um den PC, sowie Erklrungen der hufigsten Computerbegriffe und ein Wrterbuch. Autocad Extract Text Lisp Routine' title='Autocad Extract Text Lisp Routine' />If you never read anything about how to access Excel from. Visual Lisp, would you know that the class name to use is Excel. Application Or that the type library to import would be Excel. Probably. not. Its a lot easier to open VBAIDE, find the reference in Tools References. VBA, but dont tell that to anyone. For accessing simple things like WSH or the Script Runtime Library, we. Well just create the. VLAX INVOKE METHOD and VLAX GET PROPERTY. To create the objects in the first place, well. VLAX CREATE OBJECT. Autocad Extract Text Lisp Routine' title='Autocad Extract Text Lisp Routine' />Lets start it by accessing the Windows Script Host. This only runs on. Windows 9. 8 or higher, but of course you are running at least Windows NT or. The class name for the WSH object we are interested in is WScript. Network. So lets assign that object to a variable setq wscript vlax create object WScript. Network. lt VLA OBJECT IWsh. Network. 2 0. 01. Now, I havent figured this out yet, but trying to dump the object on. Command vlax dump object wscript T. It says that the object has no properties and that is not correct. In. fact, here are the properties of a Wsh. Network object again, using the. VBAIDE can reveal these things much better than Visual. Lisp can Computer. Name User. Domain User. Name. The methods are primarily used for mapping network drives and connecting. Feel free to look them up just search for Wsh. Network. on the internet. Here we will simply grab the three properties for. WScript. Network. Computer. Name. User. Domain. pcuser vlax get property wscript User. Name. So far, so good. Lets try to access the File. System. Object and see what we. The class name to access is Scripting. File. System. Object. Scripting. Filesystem. Object. lt VLA OBJECT IFile. System. 3 0cf. 17. Whereas Visual Lisp has some obscure reason not to dump the entire. Wsh. Network object, there is no problem getting the. File. System. Object Command vlax dump object fso T. TThat the object only contains a single property is not a mistake. The. Drives property is a collection object that in turn holds information of. The vast amount of methods indicate that here we have a rather clever tool. Some of the methods could even. VL engine uses a File. System. Object for many of. Create. Folder C newdir. C newdir. vlax invoke method fso Get. Base. Name C autoexec. C autoexec. bat. Copy. Real Racing Game here. File C somefile. C somecopy. C somefile. txt C somecopy. And so on. Of course, some of the methods in the File. System. Object arent. Visual Lisp and many of the methods return more useful values. VL equivalents. For our purpose, we wont use any of the methods. We will be humble and only. PC. For that we need the Drives collection setq drives vlax get property fso Drives. VLA OBJECT IDrive. Collection 0. 95. T. Being a collection object, one would expect at least an Item method. But. the dump says there are no methods. Instead we can use the Item property to. Item C. lt VLA OBJECT IDrive 0. Whats that, you ask. An argument to a property Yes, is the short answer. Visual Basic. The argument is the. C. But what if we dont know all the drive letters of the. Well, being a collection, we can use VLAX FOR vlax for n drives. Letter. A C D E F G H I O P Q R. Wowsers Cool stuff. Now we know at least one property of the Drive. Drives collection. Lets look at. all properties and methods of a Drive object. Drive vlax get property drives Item C. VLA OBJECT IDrive 0. Drive T. Ok, there are no methods the methods of File. System. Object are actually. There is only one property that is read write its the label. Windows Explorer all the others are. There is one property, though, that can be used to walk through. Its the Root. Folder which gives access to. We wont dwelve at how to. But there are plenty of hurdles to. As you may be much too familiar with, the data types used by Active. X are. not so attractive to work with in Visual Lisp. Properties for a disk drive. They are variants, Boolean and. The latter are really no trouble by themselves they are simply returned as. Active. X constants unless we. The File. System. Object is explained on many. You could also enter VBA, connect to Microsoft Scripting. Runtime and check the enums in the object browser. They are 0 Unknown. Type. In order to convert the integer returned by the Drive. Type property, we. Unknown Removable Fixed Network drive CD Rom RAM diskAnother, more problematic type, is the variant returned by Available. Space. Free. Space and Total. Size. Try retrieve one of the properties and see what it. Drive Free. Space. Ok, so its not that problematic. The type 3 indicates that its a Long. We simply use VLAX VARIANT VALUE to extract the value vlax variant value free. Of course, its probably not a good idea to show it in raw bytes, but. Bytes, or divide it by 1. Giga. Bytes. The Boolean value of Is. Ready is in Visual Lisp returned as. We could use VL PRINC TO STRING to print the. Instead we could. Boolean cond n vlax true Yes. No. Strings are, luckily enough, returned as strings, so we wont bother. To present the i. Folder object, do whatever you. The code that follows simply accesses the path and presents it to the. The code that followsSee Part 2, dude.