It is currently Mon Mar 01, 2021 2:53 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 338 posts ]  Go to page Previous  1 ... 19, 20, 21, 22, 23
Author Message
 Post subject: Re: COMatePLUS version 1.2
PostPosted: Wed May 20, 2020 1:50 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 02, 2004 1:20 pm
Posts: 1173
Location: Amphibios 9
Derren wrote:
just looking for an easy way to replace my "write VB code to a *.vbs file and run in" code-parts.

worth a look: Module ActiveScript for VB-Script with PB-Runtime Variables from mk-soft

Greetings ... Peter

_________________
Hygge


Top
 Profile  
Reply with quote  
 Post subject: Re: COMatePLUS version 1.2
PostPosted: Wed May 20, 2020 1:56 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jul 23, 2011 1:13 am
Posts: 305
Location: Germany
Kiffi wrote:
Derren wrote:
just looking for an easy way to replace my "write VB code to a *.vbs file and run in" code-parts.

worth a look: Module ActiveScript for VB-Script with PB-Runtime Variables from mk-soft

Greetings ... Peter


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".

But actually, I loathe VBS. Using VBS parts in my code just adds another dimension for errors and debugging is twice the pain.


Top
 Profile  
Reply with quote  
 Post subject: Re: COMatePLUS version 1.2
PostPosted: Wed May 20, 2020 2:51 pm 
Offline
Addict
Addict
User avatar

Joined: Mon Jul 25, 2005 3:51 pm
Posts: 3777
Location: Utah, USA
Derren wrote:
Thanks, but I'm missing something.

I'm trying this code snippet here and get this error.

Quote:
---------------------------
PureBasic
---------------------------
The procedure 'COMate_CreateObject()' has been declared but not defined.
---------------------------
OK
---------------------------


You need to include the COMatePlus.pbi

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject: Re: COMatePLUS version 1.2
PostPosted: Wed May 20, 2020 3:07 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jul 23, 2011 1:13 am
Posts: 305
Location: Germany
:shock: I missed the link in leonhardt's post...
thought the posted code was all that's necessary. :oops:


Top
 Profile  
Reply with quote  
 Post subject: Re: COMatePLUS version 1.2
PostPosted: Wed May 20, 2020 3:45 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2881
Location: Germany
Using VB scripts with ActiveScript in PB is sometimes easier than using COMatePlus.

But here is the link to backups from RS-Basic

Link: https://www.rsbasic.de/backups/

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: COMatePLUS version 1.2
PostPosted: Wed May 20, 2020 3:51 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2881
Location: Germany
Derren wrote:
Kiffi wrote:
Derren wrote:
just looking for an easy way to replace my "write VB code to a *.vbs file and run in" code-parts.

worth a look: Module ActiveScript for VB-Script with PB-Runtime Variables from mk-soft

Greetings ... Peter


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".

But actually, I loathe VBS. Using VBS parts in my code just adds another dimension for errors and debugging is twice the pain.

With ActiveScript you already get the script errors displayed.
And with "On Error Resume Next" you can also catch the script errors yourself.

P.S.
There are also a lot of VB-Script examples for all kinds of things, which can be used directly from PB

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: COMatePLUS version 1.2
PostPosted: Fri Nov 27, 2020 10:12 am 
Offline
User
User

Joined: Wed Nov 06, 2019 10:28 am
Posts: 86
Hi everybody

Maybe I should have posted my problem here instead of creating my own Topic : viewtopic.php?f=13&t=76324&p=562341#p562341
I've got some problem to request on remote host with WMI object.
Could someone takes a look ? Thank you.


Top
 Profile  
Reply with quote  
 Post subject: Re: COMatePLUS version 1.2
PostPosted: Tue Dec 08, 2020 1:00 pm 
Offline
User
User

Joined: Wed Nov 06, 2019 10:28 am
Posts: 86
Ok, let's try something else.
Here is an AutoIt code that works like a charm :

Code:
$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


Can I do the same with COMatePlus ? It seems I have to use Invoke method to call ConnectServer but it is not returning an object so I can't ExecQuery this object...


EDIT :

Second problem : I can't read a value in the registry (Purebasic 5.72 64 bits). It's working in 32 bits.
Code:
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


EDIT2 : thanks to Justin, everything works fine now (viewtopic.php?f=13&t=76324&p=563085#p563085)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 338 posts ]  Go to page Previous  1 ... 19, 20, 21, 22, 23

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye