mIRC Home    About    Download    Register    News    Help

Print Thread
#91288 21/07/04 05:06 AM
Joined: Jul 2004
Posts: 4
R
Self-satisified door
OP Offline
Self-satisified door
R
Joined: Jul 2004
Posts: 4
Hi everyone.

Im trying to make a mirc administration module to the new G6FTPServer with the use of it's COM object.
I have been able to open the object from mirc.

But requesting and setting properties is not going so well.

Now in VB-Script you would do it like this:

Set Manager = CreateObject("G6FTPServer.Manager")
UsersOnline = Manager.Status.Users
BytesUploaded = Manager.Domains.Item("Localhost").Properties.Values("StatsUploaded")

How is this achived in MIRC:

The sctipt is below is what I have been trying... can some one help a bit?
-----------------

alias G6COpen {
/comopen G6 G6FTPServer.Manager
if ($comerr) {
echo -a 4COM Open Failed
halt
}
}

alias G6CClose {
/comclose G6
}

alias G6Test {
if ($com(G6,Status.Users,2) == 1) {
echo -a 12 Connected Users: $com(G6).result
}
else {
echo -a 4Fail
}
}

#91289 21/07/04 11:21 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
The . delimiter is a part of VB syntax. Some languages use -> instead, but mIRC has neither of them. In COM scripting you walk through every object and use a $com call to either return a value or invoke a new object.

In sense of mIRC scripting, your VBScript code would look something like this:
  • Set oManager = CreateObject("G6FTPServer.Manager")

    Set oStatus = oManager.Status
    strUsers = oStatus.Users
    Set Status = Nothing

    Set oDomains = oManager.Domains
    Set oLocalhost = oDomains.Item("Localhost")
    Set oDomains = Nothing
    Set oProperties = oLocalhost.Properties
    Set oLocalhost = Nothing
    strUpBytes = oProperties.Values("StatsUploaded")
    Set oProperties = Nothing

    Set oManager = Nothing
Before you start, you might want to read the Introduction to COM and check out this script (untested, but you get the idea)

#91290 22/07/04 02:29 PM
Joined: Jul 2004
Posts: 4
R
Self-satisified door
OP Offline
Self-satisified door
R
Joined: Jul 2004
Posts: 4
Been playing a bit with it... And some of it is giving me a hard time. This is what I made:

alias G6.Test {
;######G6 Inputs########
var %G6.ServerDomain = IceMan

;######Script Start########
G6.ComOpen

!.echo -q $com(G6, Status, 2, dispatch* oStatus)
!.echo -q $com(oStatus, Users, 2)
var %users = $com(oStatus).result
!.echo -q $com(oStatus, MemoryUsage, 2)
var %memory = $com(oStatus).result

!.echo -q $com(G6, Domains, 2, dispatch* oDomains)
!.echo -q $com(oDomains, Item, 3, bstr, %G6.ServerDomain, dispatch* oLocalhost)
!.echo -q $com(oLocalhost, Properties, 2, dispatch* oProperties)
!.echo -q $com(oProperties, Values, 3, bstr, StatsUploaded)
var %upbytes = $com(oProperties).result

:tongue:rint
echo -a Users Online: %users
echo -a Memory Usage: %memory
echo -a Bytes Uploaded: %upbytes

:error
echo -a 4 $error | /reseterror

G6.CloseAllCom
}

alias G6.ComOpen {
/comopen G6 G6FTPServer.Manager
if ($comerr) {
echo -a 4COM Open Failed
halt
}
}

alias G6.CloseAllCom {
//var %i = $com(0)
while ((%i != 0) && ($com(%i) != $null)) {
/comclose $v1
/dec %i
}
}
------------------

The error is in this line:
var %memory = $com(oStatus).result

the value is nothing... frown but requested in VB you get the current memory load.
If you look at the Property format, it is returned in "__int64" format (see link below). But mirc doesn't know that so nothing is in it. Is there a way to fix that?

Have a look on the object here:
http://www.g6ftpserver.com/manuals/devguide_en/tlb.html#IServerStatus*

#91291 09/12/04 09:21 AM
Joined: Dec 2004
Posts: 4
B
Self-satisified door
Offline
Self-satisified door
B
Joined: Dec 2004
Posts: 4
Any update on this ?

How to use int64 values in mIRC ?

#91292 09/12/04 08:12 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
This thread continues here (sorry, I don't have an answer).

New visitors should note that our forum software does not push active threads to the top of the index, so it is advisable that old discussions continue in new threads.


Link Copied to Clipboard