Our Products
Classes
BMP
Crypto
CSVStrings
DataLogger
Dates
DebugRecorder
FileNameSet
FileSender
RDOConnectMaster
ReportAids
Sheller
StringSet
WEBUtilities
Modules
DAOLib
Globals
Registry
Programs
Batcher
HTMLGen
KillTime
TimedMessage
|
|
Sheller: This class builds and executes a set of DOS commands via the Shell procedure. So, in effect, it's a dynamic batch file builder and executor. Its unique quality is that each step of the batch executes in sequence just like they used to do back in the DOS days. Init starts off the process, AddCmd adds a command to the batch in process, and Run executes it. The class supports a debug mode that holds the executing window open so you can monitor progress. Requires Microsoft Scripting Runtime (SCRRUN.dll). Since Sheller has only three methods, all of which get used whenever you use it, below is just one example of how you might use Sheller in one of your programs. |
 |
|
This snippet of code deletes a list of files from a Banyan server. It uses a Sheller object, Shell, to build and execute a batch file to perform the task. Shell is first initialized to setup a file whose window will automatically close when execution is completed and then commands are added to the batch file to map the Banyan server so that it is available to the PC. Then a list of files to delete is obtained via GetList and Sheller's AddCmd is used to add a delete command for each file into the developing batch file. Finally, Sheller's Run method is used to execute the batch file. |
Dim Shell as Sheller 'declare object
Set Shell as New Sheller 'create object
Call Shell.Init(AutoClose) 'initialize to autoclose window after execution
Call Shell.AddCmd("Z:") 'set logged drive to z:
If SrvrNme <> "" Then 'map foreign server to a drive letter
Call Shell.AddCmd(SetDrive + " p /x")
'unassign drive so file doesnt end up in wrong place by accident
Call Shell.AddCmd(SetDrive + " p " + SrvrNme)
'SETDRIVE to proper PCDirectory
FileList = GetList("*.frm") 'get CSV list of file names
End
While FileList <> "" 'loop through CSV list of file names
T = CSV.StringFrom(FileList) 'pick off file name
Call Shell.AddCmd("Del " + T) 'build delete command
Wend
resultcode = Shell.Run 'execute the accumulated commands
|
|