wfullname = wscript.fullname
exe = lcase(mid(wfullname, instrrev(wfullname, "\")+1))
if not exe = "cscript.exe" then
	set wshell = createobject("wscript.shell")
	wshell.run "cscript.exe """ & wscript.scriptfullname & """"
	wscript.quit
end if

set input = wscript.stdin
set output = wscript.stdout

vbprompt = "$ "
output.write vbprompt
do until input.atendofstream
	user_ip = input.readline
	if lcase(user_ip) = "exit" then
		exit do
	else
		run_vbscript user_ip
		output.write vbprompt
	end if
loop

sub run_vbscript (vbcommand)
	on error resume next
	vbcommand = replace (vbcommand, "write", "output.writeline")
	executeglobal vbcommand

	If Err.Number <> 0 Then
		output.writeline "Error #" & Err.number & " :" & Err.description
	End If
	On Error Goto 0

end sub

function to_str( var )
	to_str = ""

	Dim ttype : ttype = TypeName(var)
	Dim str_items
	
	
	If IsArray(var) Then 
		Set str_items = CreateObject("Scripting.Dictionary")
		
		Dim item 
		For Each item in var
			str_items(to_str( item )) = 1
		Next
		to_str = to_str & "[" & Join(str_items.Keys, ", ")  & "]"
		Set str_items = Nothing
	ElseIf IsObject(var) Then 
		
		If ttype = "Dictionary" Then
			Dim key

			Set str_items = CreateObject("Scripting.Dictionary")
			For Each key In var.Keys
				pair = to_str(key) & ": " & to_str(var(key))
				str_items(pair) = 1
			Next 
	
			to_str = to_str & "{" & Join(str_items.Keys, ", ")  & "}"
			Set str_items = Nothing

		Else
			to_str = to_str  & "<" & ttype & ">"
		End If
	ElseIf IsEmpty(var) Then 
		to_str = to_str  & "<empty>"
	ElseIf IsNull(var) Then
		to_str = to_str  & "<null>"
	ElseIf ttype = "String" Then
		'Replace quotes with doble quotes, and put in quotes
		to_str = to_str  & "<""" &  Replace(var, """", """" & """" )  &  """>"
	Else
		to_str = to_str & var 
	End If


end function 

sub pp(var)
	output.writeline( to_str(var) )
end sub