Hi Allen,

Well it's just BoForce. Nothing special.

How to explain Try-EndTry Catch-EndCatch. I'm just starting to understand what this does. I could Try, but for you to Catch it ;\) you could read this http://msdn.microsoft.com/en-us/library/system.exception(VS.80).aspx

The info helped me to get started.

Please note that although this may look like @SERROR in Kix it isn't.
In the example below I will use the function DelKey with a none existing key as the Exception is easy to trigger.

Kix >
 Code:
DelKey('HKEY_CURRENT_USER\Test\New\some\Folder\Task')
?@SERROR


Result:
 Code:
The system cannot find the file specified.



SteelKix:
 Code:
? DelKey('HKEY_CURRENT_USER\Test\New\some\Folder\Task')


Result:
 Code:
Cannot delete a subkey tree because the subkey does not exist.


SteelKix DelKey Function:
 Code:
;SteelKix Function: DelKey()
;
;Author:		Boforce
;
;Contributors:	None
;
;Action:		Deletes the specified subkey from the registry
;
;Syntax:		DelKey("key")
;
;Version:		1.0
;
;Date:		2009-09-25
;
;Date Revised:	2009-09-25
;
;Parameters	Key
;		Required.	A string that specifies the name of the subkey you want to delete
;
;Remarks:		None
;
;Returns:		Returns nothing if the key is deleted else an error message
;
;Dependencies:
; SteelKix version: 0.2
; Tested with Dot Net 3.5.30729.01
;
;Example(s):	Delete some key:
;		$DeleteKey = DelKey('HKEY_CURRENT_USER\Test\Some\New\Key')
;		? 'Deleted key : ' + $DeleteKey
;
;Comments : This has been successfully tested on Windows XP SP3 with DOT NET 3.5.30729.01.
;
;Source:
Function DelKey($Key)
Dim $Win32,$Hive,$Action

Imports $Win32 = Microsoft.Win32

$Hive = $Key.ToString.Split("\".ToCharArray())[0]
$Key = $Key.Remove($Hive+'\',$Hive.Length+1)

Select
   Case $Hive = 'HKEY_CLASSES_ROOT' Or $Hive = 'HKCR'
	$Hive = $Win32.Registry.ClassesRoot
   Case $Hive = 'HKEY_CURRENT_USER' Or $Hive = 'HKCU'
	$Hive = $Win32.Registry.CurrentUser
   Case $Hive = 'HKEY_LOCAL_MACHINE' Or $Hive = 'HKLM'
	$Hive = $Win32.Registry.LocalMachine
   Case $Hive = 'HKEY_USERS' Or $Hive = 'HKU'
	$Hive = $Win32.Registry.Users
   Case 1
	$atHive = 'Error'
EndSelect

If $atHive = 'Error'
   $AddKey = 'Unknown hive'
Else
   Try
	 $Action = $Hive.DeleteSubKey($Key,1)
   EndTry
   Catch
	 $e
   EndCatch

   If $e
	 $DelKey = $e.Message
   Else
	 $DelKey = $Action
   EndIf
EndIf
EndFunction


Note that in this case I use $e.Message because the $e.ToString() would result in:
 Code:
System.ArgumentException: Cannot delete a subkey tree because the subkey does not exist.
   at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)