Page 1 of 1

WScript Object, please help

Posted: April 8th, 2007, 6:09 am
by kryologik
I'm trying to use WScript.ConnectObject (need to handle some events) and it's saying "Object required: 'WScript'.

I wrote all the code in a .vbs and now I'm trying to port it into my Paladin Bot. What do I need to do to be able to use wscript?

Events

Posted: April 8th, 2007, 6:34 pm
by kryologik
.. or is there some other way I can go about connecting the object to the program so that I can handle object events?

Posted: April 10th, 2007, 9:49 am
by xaraph
Maybe try using the COM.CreateCOMObject() as described in the Wiki documentation for exhume:

Register to unlock hidden link

I'm pretty sure that duplicates the wscript.ConnectObject functionality.

Wscript object / Events

Posted: April 10th, 2007, 10:16 am
by kryologik
Doesn't enable the handling of events though =( I'm in desperate need of getting this to work =( I have all the code from my remote webserver / remote control daemon written and working in regular vbs, just need it to work in exhume now =(.


When I wrote this tcp daemon in regular .vbs, I used:

Code: Register to unlock hidden link

Set myBot = CreateObject("<winsock>")
WScript.ConnectObject myBot, "myBot_" 


Which worked just fine.. Now in Exhume I'm trying:

Code: Register to unlock hidden link

Dim myBot
Set myBot = CreateObject("<winsock>", "myBot_")
And it's telling me "The remote server machine does not exist or is unavailable." When trying to use CreateObject with a prefix in regular .vbs, it produces the same results, which is why I was using ConnectObject. Please, someone help!

Posted: April 10th, 2007, 7:45 pm
by gheezer
Unfortunately, unless someone knows otherwise, I don't think VGE exposes the currently running WSH process(which is what WScript is) :(

Without that it's damn near impossible to implement COM events. I say 'damn near' cause someone smarter than me could prolly do it with clever API calls or subclassing.

I was able to use a custom COM .dll to get my remote working, but decided to wait on C# so I wouldn't have to distribute a custom .dll with the radar.

Posted: April 13th, 2007, 10:31 am
by wilburr
I'm by no means a VB expert, so take this for what it's worth...

The root wsh object is not available from within vb, only the wsh shell and the wsh network objects are.

I don't know what you are trying to do with wsh, but the MS Script Control has some limited script engine support (would require modifying the base vb code of vge though). I have used it before to add some jscript to a vb project, but I'm not sure what all of its capabilities\limitations are.

Posted: April 13th, 2007, 7:39 pm
by wyvernx
I think admin will have to add that ConnectObject to the COM command list api.

Register to unlock hidden link

Posted: April 14th, 2007, 5:02 am
by kryologik
I would be eternally greatful for that =)