worth a look: Module ActiveScript for VB-Script with PB-Runtime Variables from mk-softDerren wrote:just looking for an easy way to replace my "write VB code to a *.vbs file and run in" code-parts.
Greetings ... Peter
worth a look: Module ActiveScript for VB-Script with PB-Runtime Variables from mk-softDerren wrote:just looking for an easy way to replace my "write VB code to a *.vbs file and run in" code-parts.
Definitely, but I ran into some issue (which is why I resorted to writing VBS files). Hadn't had the time to dive into the problems here, yet. But it's on my "watchlist".Kiffi wrote:worth a look: Module ActiveScript for VB-Script with PB-Runtime Variables from mk-softDerren wrote:just looking for an easy way to replace my "write VB code to a *.vbs file and run in" code-parts.
Greetings ... Peter
You need to include the COMatePlus.pbiDerren wrote:Thanks, but I'm missing something.
I'm trying this code snippet here and get this error.
---------------------------
PureBasic
---------------------------
The procedure 'COMate_CreateObject()' has been declared but not defined.
---------------------------
OK
---------------------------
With ActiveScript you already get the script errors displayed.Derren wrote:Definitely, but I ran into some issue (which is why I resorted to writing VBS files). Hadn't had the time to dive into the problems here, yet. But it's on my "watchlist".Kiffi wrote:worth a look: Module ActiveScript for VB-Script with PB-Runtime Variables from mk-softDerren wrote:just looking for an easy way to replace my "write VB code to a *.vbs file and run in" code-parts.
Greetings ... Peter
But actually, I loathe VBS. Using VBS parts in my code just adds another dimension for errors and debugging is twice the pain.
Code: Select all
$strComputer = "RemoteHostName"
$user = "administrator"
$pass = "password"
$objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator")
$objWMIService = $objSWbemLocator.ConnectServer($strComputer, "root\cimv2", $user, $pass)
$colItems = $objWMIService.ExecQuery("Select * From Win32_LocalTime")
For $objItem in $colItems
$strTime = $objItem.Hour & ":" & $objItem.Minute & ":" & $objItem.Second
MsgBox(0,"date",$strTime)
Next
Code: Select all
XIncludeFile "COMatePLUS.pbi"
Define.COMateObject oReg
strKeyPath.s = "SYSTEM\CurrentControlSet\services\NetBT\Parameters"
strValueName.s = "NbProvider"
oReg = COMate_GetObject("winmgmts:\\.\root\default:StdRegProv", "")
If oReg
If oReg\Invoke("GetStringValue(" + Str(hkey) + ", '" + strKeyPath + "', '" + strValueName + "', " + Str(@dwValue) + " BYREF)") = #S_OK
sValue$ = PeekS(dwValue, -1, #PB_Unicode)
SysFreeString_(dwValue)
; If oReg\Invoke("GetDWORDValue(" + Str(#HKEY_LOCAL_MACHINE) + ",'" + strKeyPath + "','" + strValueName + "'," + Str(@dwValue) + " BYREF)") = #S_OK
; sValue$ = Str(dwValue)
Debug "registry value = " + sValue$
Else
Debug "GetStringValue error : " + COMate_GetLastErrorDescription()
EndIf
oReg\Release()
Else
Debug "objet error"
EndIf