KozMos VLDOS

  OS level operations for Visual LISP via WSH

กก

VLDOS: Introduction
        Visual LISP is more powerful to process AutoCAD relative functions, but it is not powerful enough on operating system (OS) level operations on system Drives, Folders and files. There are really so less functions defined in Visual LISP to perform OS level operation and the functions are not powerful enough. Thus the programmers always found aids from third party software such as DOSLIB to enhance the OS level operation abilities. (Of cause, DOSLIB can provide more functions than the simple OS level).
        Without using DOSLIB or other third party products, we can only do some OS level operations in pure Visual LISP codes via the Window Script Host (WSH). And this is the aim of VLDOS. 
        VLDOS is an independent Visual LISP ActiveX programming API using Windows Script Host (WSH) to enable Visual LISP codes perform OS level operations to Drives, Folders and Files.
        KozMos provides VLDOS as a freebie product, and the VLDOS.FAS can be packaged as one source file of users' own Visual LISP project, then the new compiled application can run all functions pre-defined in VLDOS.

        If you want to get more information and help on using or programming VLDOS, please mail us with kozmosovia@hotmail.com.

VLDOS: Public Functions

vldos-abspath
(vldos-abspath PathSpecString)
Get real absolute path of certain specified folder.
(vldos-abspath "")
"C:\\DOCUMENTS AND SETTINGS\\YOTA\\MY DOCUMENTS"
Argument 1 STRING The specified path string.
Return SUCCESS Absolute path string.
FAILURE NIL
vldos-alldrive
(vldos-alldrive)
Get all local logical drive list of current PC.
(vldos-alldrive)
("A" "C" "D" "E" "F" "G")
Return SUCCESS A list contain all local drive letter.
FAILURE NIL
vldos-alldriveinfo
(vldos-alldriveinfo DriveLetterString)
Get all information of certain drive.
(vldos-alldriveinfo "C")
(5.23744e+009 2.23648e+009 2 "FAT32" 954533639 "" "")
Argument 1 STRING The drive letter string.
Return SUCCESS A list contain drive's information, sorted by
("TotalSize" "FreeSpace" "DriveType" "FileSystem"
"SerialNumber" "ShareName" "VolumeName")
FAILURE NIL
vldos-allfileinfo
(vldos-allfileinfo FilenameString)
Get all information of certain file.
(vldos-allfileinfo "c:\\windows\\system32\\winlogon.exe")
(29221.0 37184.5 38026.0 "Application" 416768 32)
Argument 1 STRING The file name string.
Return SUCCESS A list contain file's information, sorted by
("DateCreated" "DateLastModified" "DateLastAccessed"
"Type" "Size" "Attributes")
FAILURE NIL
vldos-browsedir
(vldos-browsedir PromptMessageString DefaultStartFolderNameString)
Run standard windows "Browse folder".
(vldos-browsedir "Select a location folder" "g:/abcd/)
"G:\\KOZMO55 SYSTEM"
"MY COMPUTER"
"\\\\KOZ\\SHAREV\\ABC"
Argument 1 STRING The prompt message.
Argument 2 STRING The default start path string.
Return SUCCESS The folder path that user select.
FAILURE NIL
vldos-copy
(vldos-copy SourceString TargetString)
Copy a file or a folder.
(vldos-copy "c:/windows/system32" "d:/copy/")
"D:\\COPY\\SYSTEM32\\"
Argument 1 STRING The source file or directory to be copied.
Argument 2 STRING The destination location. If contain "*\\" or "*/", this function will create a same nest-folder name under this path while performing copy folder operation.
Return SUCCESS New created file or folder name string.
FAILURE NIL
vldos-deltree
(vldos-deltree DirectoryNameString)
Run DOS DELTREE/Y command. No confirm, no backup.
(vldos-deltree "c:/windows/desktop/new folder")
T
Argument 1 STRING The directory name that to be deleted. This function will not perform an confirm interface and will delete the folder and all the sub-folders quietly. If the root folder is indicated, this function will automatically deltree all sub-folders in root.
Return SUCCESS T
FAILURE NIL
vldos-doc2txt
(vldos-doc2txt WordBasedDocumentFileNameString)
Convert content of a word based document (DOC/RTF/HTM/HTML) into normal ASCII text file.
(vldos-doc2txt "c:/My DOC files/folder.htm")
"C:/MY DOC FILES/FOLDER.HTM.TXT"
Argument 1 STRING The source word based document file name.
Return SUCCESS An ASCII text file name.
FAILURE NIL
vldos-driveinfo
(vldos-driveinfo DriveLetterString InfoTagString)
Get certain information of a certain drive.
(vldos-driveinfo "C" "FreeSpace")
2.19352e+009
Argument 1 STRING The drive letter string.
Argument 2 STRING One string from the list ("TotalSize" "FreeSpace" "DriveType" "FileSystem" "SerialNumber" "ShareName" "VolumeName" "*")
Return SUCCESS Certain one or all information of drive.
FAILURE NIL
vldos-drivetype
(vldos-drivetype DriveLetterString)
Get the drive type of certain drive, same as running (vldos-driveinfo DriveLetterString "DriveType")
(vldos-drivetype "C")
"FIXED"
Argument 1 STRING The drive letter string.
Return SUCCESS The drive type string, will be one of the following: "UNKNOWN" "REMOVABLE" "FIXED" "REMOTE" "CDROM" "RAMDISK"
FAILURE NIL
vldos-exewait
(vldos-exewait FullPathEXEFileNameString)
Executes an external program, then waits for termination before returning control to the calling application.
(vldos-exewait "c:\\windows\\notepad.exe")
"c:\\windows\\notepad.exe"
Argument 1 STRING The command to run, including full path and arguments.
Return SUCCESS Imported string argument.
FAILURE NIL
vldos-fileinfo
(vldos-fileinfo FileNameString KeyPropertyString)
Get certain property of a file.
(vldos-fileinfo "c:\\windows\\system32\\winlogon.exe" "Size")
416768
Argument 1 STRING The file name.
Argument 2 STRING One string from the list ("DateCreated" "DateLastModified" "DateLastAccessed" "Type" "Size" "Attributes" "*")
"*" for all information.
Return SUCCESS Certain one or all information of file.
FAILURE NIL
vldos-findfile
(vldos-findfile FileMatchstring)
Search files according with the FileMatchString, support wild characters used in DOS.
(vldos-findfile "c:\\*.rsc")
("C:\\ABC.RSC" "C:\\MY APPLICATION\\ARCHITECTURE.RSC")
Argument 1 STRING The file name string, can contain wild characters.
Return SUCCESS A list contain all files matched and found.
FAILURE NIL
vldos-formatpath
(vldos-formatpath PathString)
Convert all "/" in path or file string into "\\".
(vldos-formatpath "c:/windows/system32/mydata.rsc")
"C:\\WINDOWS\\SYSTEM32\\MYDATA.RSC"
Argument 1 STRING The path or file string to be formated.
Return SUCCESS The new path or file name string.
FAILURE NIL
vldos-ipaddress
(vldos-ipaddress)
Get the IP address for current local machine. This is got from OS command "IPConfig".
(vldos-ipaddress)
("192.168.1.223" "255.255.255.0" "192.168.1.11")
Return SUCCESS A list contain the IP address, subnet mask and default gateway.
Both elements are string.
FAILURE NIL
vldos-label
(vldos-label DriveNameString NewLabelString)
Label the drive with new string.
(vldos-label "d" "NewLabel")
"NEWLABEL"
Argument 1 STRING The drive name string.
Argument 2 STRING The new label of the drive.
Return SUCCESS The new label of the drive. All upper letter.
FAILURE NIL
vldos-macaddress
(vldos-macaddress)
Get the MAC address. This is got from OS command "IPConfig".
(vldos-macaddress)
"00-00-21-E3-AD-37"
Return SUCCESS The MAC address string.
FAILURE NIL
vldos-merge
(vldos-merge BaseFileName MergeFileName EraseMergefileFlag)
Merge two TEXT files into one file.
(vldos-merge "c:\\11.txt" "c:\\22.txt" T)
"C:\\11.TXT"
Argument 1 STRING The base file name string.
Argument 2 STRING The file that will be merged.
Argument 3 BOOLEAN The flag if erase the merged file or not.
Return SUCCESS The base file name string.
FAILURE NIL
vldos-mkdir
(vldos-mkdir FolderNameString)
Create folder and all sub-folders.
(vldos-mkdir "c:\\abc\\defg\\kk")
"C:\\ABC\\DEFG\\KK"
Argument 1 STRING The full path name of directory to be created. This function will automatically create all non-existing directories in this argument.
Return SUCCESS Full path name string of folder created.
FAILURE NIL
vldos-move
(vldos-move SourceString TargetString)
Move a file or a folder.
(vldos-move "c:/windows/system32" "d:/copy/")
"D:\\COPY\\SYSTEM32\\"
Argument 1 STRING The source file or directory to be moved.
Argument 2 STRING The destination location. If contain "*\\" or "*/", this function will create a same nest-folder name under this path while performing move folder operation.
Return SUCCESS New created file or folder name string.
FAILURE NIL
vldos-msgbox
(vldos-msgbox TitleString IconType Message ButtonType)
Display windows type message box contain icon and multiple buttons.
(vldos-msgbox NIL "x" "Stop! error found" 1)
1
Argument 1 STRING The title string, if it is nil, use default string of "Message".
Argument 2 STRING
INT
The Icon type string or integer, if it is string, only 1st string will be checked.
  • 16: "x"
  • 32: "?"
  • 48: "!"
  • 64: "i"
Argument 3 STRING The message string, if it is nil, use default string of "Message HERE".
Argument 4 INT Displayed button type integer.
  • 0: OK
  • 1: OK and Cancel
  • 2: Abort, Retry, and Ignore
  • 3: Yes, No, Cancel
  • 4: Yes and No
  • 5: Retry and Cancel
Return SUCCESS The button flag integer that user picked.
  1. OK button
  2. Cancel button
  3. Abort button
  4. Retry button
  5. Ignore button
  6. Yes button
  7. No button
FAILURE NIL
vldos-readfile
(vldos-readfile FilenameToRead)
Read all content of a text file into a list (more fast than AutoLISP read-line).
(vldos-readfile "c:\\11.txt")
("line1" "line2" "line3"..."line-x")
Argument 1 STRING The ASCII file name to read.
Return SUCCESS List contain text contents line by line.
FAILURE NIL
vldos-rename
(vldos-rename FilenameToRead)
Rename a file.
(vldos-rename "c:\\11.txt" "c:\\11-new.txt")
"C:\\11-NEW.TXT"
Argument 1 STRING The source file or directory to be renamed.
Argument 2 STRING The new name for the directory or file.
Return SUCCESS New renamed file or folder name path string.
FAILURE NIL
vldos-temp
(vldos-temp)
Get OS Temporary path.
(vldos-temp)
"C:\\DOCUME~1\\KOZ\\LOCALS~1\\TEMP"
Return SUCCESS Temporary path string.
FAILURE NIL
vldos-text->ie
(vldos-text->ie MessageString)
Display a HTML file (source codes) or some string in a MS IE window, calling from Visual LISP.
(vldos-text->ie "c:\\11.txt")
"C:\\11-NEW.TXT"
Argument 1 STRING The string or string list to be displayed in IE Window.
Return SUCCESS The MS IE window with string(s).
FAILURE NIL
vldos-writefile
(vldos-writefile FileNameString ContentStringList ModeFlag)
Write a string list into a text file (more fast than AutoLISP write-line).
If the file is not exist, create it automatically.
(vldos-writefile "c:/abc.txt" "My string write to file" nil)
"C:\\ABC.TXT"
Argument 1 STRING The source file name.
Argument 2 STRING / LIST The string or string list to write
Argument 3 BOOLEAN The append or overwrite mode flag. nil for append, T for overwrite
Return SUCCESS New created file name string.
FAILURE NIL
กก

//Koz Jono Yeoh//

Copyright(C) 1994-2009 KozMos Inc
All rights reserved.