Kernel Class, Member of ScriptUtils

Member of  ScriptUtils Use Kernel object | Changes | Purchase | Download

Description

COM API for calling some of Kernel32 functions.

Object model

Kernel - COM API for calling some of Kernel32 functions.
 
Process - Process object. Timing informations, priority settings and Ids. (CurrentProcess property, Current process.)
 
 
Thread - Thread object. Timing informations, priority settings and Ids. (PrimaryThread property, Primary thread of the process.)
 
Thread - Thread object. Timing informations, priority settings and Ids. (CurrentThread property, Current thread)
   
Process - Process object. Timing informations, priority settings and Ids. (Process property, The process of the thread.)

Methods

CloseHandle Closes an open object handle.
CopyFile The CopyFile method copies an existing file to a new file.
CreateProcess Creates a new process and its primary thread. The new process executes the specified executable file.
DeleteFile The DeleteFile method deletes an existing file.
GetFileSize The GetFileSize function retrieves the size, in bytes, of the specified file.
MoveFile The MoveFile method renames/moves an existing file or a directory (including all its children).
Sleep Suspends the execution of the current thread for a specified interval.
SwitchToThread Causes the calling thread to yield execution to another thread that is ready to run on the current processor. The operating system selects the thread to yield to.
WaitForSingleObject returns when one of the following occurs:
The specified object is in the signaled state
. The time-out interval elapses.

Properties

CurrentDirectoryRetrieves or sets the current directory for the current process.
String, RW
CommandLineThe command-line string for the current process.
String, RO
ComputerNameRetrieves the computer name of the current systιm.
String, RO
CurrentProcessCurrent process.
Process, RO
CurrentThreadCurrent thread
Thread, RO
EnvironmentStringsThe environment block for the current process.
String, RO
EnvironmentVariablesRetrieves the value of the specified variable from the environment block of the calling process.
String, RO
hrCounterRetrieves the current value of the high-resolution performance counter, if one exists.
double, RO
hrFrequencyRetrieves the frequency of the high-resolution performance counter, if one exists.
double, RO
hrTimeCounterRetrieves the current value of the high-resolution performance counter, if one exists. The value of counter is converted to time (divided by hrFrequency).
double, RO
TempPathRetrieves the path of the directory designated for temporary files.
String, RO
TickCountThe number of milliseconds that have elapsed since Windows was started.
Long, RO

Examples

ASP timing

<Script RunAt=Server Language=VBScript>
  Set Kernel = CreateObject("ScriptUtils.Kernel")'Creates the Kernel object
  'Get start times
  TickCount = Kernel.TickCount
  KernelTime = Kernel.CurrentThread.KernelTime
  UserTime = Kernel.CurrentThread.UserTime

  '…………………..
  'Some script commands
  '…………………………..
  For i=1 To 100000
    j = i
  Next

  'Write times
  Response.Write "<br>Script time : " & (Kernel.TickCount - TickCount) & " ms"
  Response.Write "<br>Kernel time : " & CLng((Kernel.CurrentThread.KernelTime - KernelTime)*86400000) & " ms"
  Response.Write "<br>UserTime time : " & CLng((Kernel.CurrentThread.UserTime - UserTime)*86400000) & " ms"
  Kernel = Empty
</Script>

Write system variables.

<%
  Set Kernel = CreateObject("ScriptUtils.Kernel")'Creates the Kernel object
  Response.Write "<PRE>"
  Response.Write "<br>ComputerName       :" & Kernel.ComputerName
  Response.Write "<br>CommandLine        :" & Kernel.CommandLine
  Response.Write "<br>CurrentDirectory   :" & Kernel.CurrentDirectory
  Response.Write "<br>TempPath           :" & Kernel.TempPath 
  Response.Write "<br>EnvironmentStrings :" & Kernel.EnvironmentStrings 
  Response.Write "<br>Process.KernelTime :" & Kernel.CurrentProcess.KernelTime
  Response.Write "<br>Process.UserTime   :" & Kernel.CurrentProcess.UserTime
  Response.Write "<br>Thread.KernelTime  :" & Kernel.CurrentThread.KernelTime
  Response.Write "<br>Thread.UserTime    :" & Kernel.CurrentThread.UserTime
  Dim I
  For I=1 To 10
    Response.Write "<br>TickCount          :" & Kernel.TickCount
    Kernel.Sleep 500
  Next
  Response.Write "</PRE>"
%>

Timing informations.

<Script RunAt=Server Language=VBScript>
  Set Kernel = CreateObject("ScriptUtils.Kernel")'Creates the Kernel object
  'Get start times
  TickCount = Kernel.TickCount
  KernelTime = Kernel.CurrentThread.KernelTime
  UserTime = Kernel.CurrentThread.UserTime

  '…………………..
  'Some script commands
  '…………………………..
  For i=1 To 100000
    j = i
  Next

  'Write times
  Response.Write "<br>Script time : " & (Kernel.TickCount - TickCount) & " ms"
  Response.Write "<br>Kernel time : " & CLng((Kernel.CurrentThread.KernelTime - KernelTime)*86400000) & " ms"
  Response.Write "<br>UserTime time : " & CLng((Kernel.CurrentThread.UserTime - UserTime)*86400000) & " ms"
  Kernel = Empty
</Script>

Other links for Kernel class

ASP file upload and ScriptUtilities classes

Kernel, ByteArray, Process, Thread, Advapi, INIFile, ZLib, LogFile, ASPForm, FormFields, FormField, FormParser, ProgressInfo

ASP file upload and ScriptUtilities enums

ProcessCreationFlags, ThreadPriorities, PriorityClasses, LogonTypes, ConvertCodePages, OutputTypes, ZLibCompressLevels, ConvertTypes, LogLineEncodes, LogLineBeginTypes, FormStates, eFormType

ScriptUtils

Huge ASP upload is easy to use, hi-performance ASP file upload component with progress bar indicator. This component lets you upload multiple files with size up to 4GB to a disk or a database along with another form fields. Huge ASP file upload is a most featured upload component on a market with competitive price and a great performance . The software has also a free version of asp upload with progress, called Pure asp upload , written in plain VBS, without components (so you do not need to install anything on server). This installation package contains also ScriptUtilities library. Script Utilities lets you create hi-performance log files , works with binary data , you can download multiple files with zip/arj compression, work with INI files and much more with the ASP utility.

© 1996 - 2011 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz


Other Motobit links:   IISTracer, real-time IIS monitor   ASP file upload - upload files to ASP. 
ActiveX/VBSScript registry editor  ActiveX NT User account manager  Export MDB/DBF from ASP Active LogFile  Email export  ActiveX/ASP Scripting Dictionary object