[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Jscript
. . -> [Subject]  COM objects

COM objects

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1  2 

Posted by Anaristos   USA  (24 posts)  [Biography] bio
Date Reply #15 on Sat 05 Feb 2011 09:10 PM (UTC)

Amended on Sat 05 Feb 2011 09:14 PM (UTC) by Anaristos

Message
No, I am not saying that. After I made the post above I finally figured out that all scripts were supposed to go into a single file, though that's not really apparent right away. So I did move all the scripts into a single file. However, that doesn't change what is happening.
When I execute the first alias, it invokes the cominit function which establishes the COM connection and places the reference in the variable COMObject, which is declared as global. However when I then execute the second alias, dbopen, which invokes the comopen function the following error appears:

COMObject is null or not an object

which means to me that the function sees the variable, but its value has been reset, and therefore the value does not persist after the first alias exits.

Sic itur ad astra
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #16 on Sat 05 Feb 2011 11:45 PM (UTC)
Message
Template:bug

Please provide a summary of your world configuration:

  • Either use the scripting Immediate window (Ctrl+I) to execute: Debug ("summary")

    or

  • Install the Summary plugin (see "Summary" feature) and type "summary"

Then copy the resulting information from the output window, and paste into a Forum message.

You need version 4.55 onwards of MUSHclient to do this.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Anaristos   USA  (24 posts)  [Biography] bio
Date Reply #17 on Sun 06 Feb 2011 03:34 AM (UTC)

Amended on Sun 06 Feb 2011 03:50 AM (UTC) by Anaristos

Message

-------------- MUSHclient summary --------------

MUSHclient version: 4.72
Compiled: Feb  5 2011.
Time now: Saturday, February 05, 2011, 7:29 PM
Operating system: Windows 7
Libraries: Lua 5.1.4, PCRE 8.10, PNG 1.4.3, SQLite3 3.7.3, Zlib 1.2.5
World name: 'AardolfTest', ID: a843716cc2d8b4e108d17a74
-- Scripting --
Script language: JScript, enabled: yes
Scripting active: yes
Script file: C:\...\MUSHClient\worlds\scripts.js
Lua sandbox is 127 characters, DLL loading allowed: NO
Scripting prefix: '!'. External editor in use: yes.
Editor path: C:\Program Files (x86)\Notepad++\notepad++.exe
Scripting for: 1.115930 seconds.
-- Triggers, aliases, timers, variables --
** Triggers: 0 in world file, triggers enabled: yes.
   0 enabled, 0 regexp, 0 attempts, 0 matched, 0.000000 seconds.
** Aliases: 3 in world file, aliases enabled: yes. [Aliases]
   3 enabled, 3 regexp, 20 attempts, 3 matched, 0.000129 seconds.
** Timers: 0 in world file, timers enabled: yes.
   0 enabled, 0 fired.
   Timers checked every 0.1 seconds.
** Variables: 1. [Variables]
-- MCCP --
MCCP active, took 0.000229 seconds to decompress
MCCP received 1367 compressed bytes, decompressed to 2814 bytes.
MCCP compression ratio was:   48.6% (lower is better)
-- Plugins (Processing order) --
ID: 71a90acddb14f784437b8b80, 'Summary', (Lua, 0.076 s) Enabled [Al]
** Plugins: 1 loaded, 1 enabled.
-- Comms --
Connect phase: 8 (Open). NAWS wanted: NO
Received: 4961 bytes (4 Kb)
Sent: 408 bytes (0 Kb)
Received 28 packets, sent 14 packets.
Total lines received: 240
This connection: Sent 4 lines, received 192 lines.
Telnet (IAC) received: DO: 6, DONT: 0, WILL: 11, WONT: 1, SB: 15 [Telnet]
-- MXP --
MXP active: yes, Pueblo mode: NO, Activated: Yes - always
MXP tags received: 0
MXP entities received: 0
MXP errors: 3
-- Commands --
Commands in command history: 6
Speed walking enabled: NO. Speed walking prefix: #
Command stacking enabled: yes. Command stack character: ';'
Accelerators defined: 0
-- Miniwindows --
** Miniwindows: 0 loaded, 0 shown.
-- Output window --
Output pixels: width 1659, height: 703, font width: 8, font height: 15
               can show 207 characters, wrapping at column 236, height 46 lines.
Output buffer: 258 of 5000 lines.
-- Miscellaneous --
Logging: NO, tracing: NO
** SQLite3 databases: 0
Sound buffers in use: 0

---------------------- End summary ----------------------

------ Variable List (alphabetic order) ------

username                       = Anaristos

Sic itur ad astra
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #18 on Sun 06 Feb 2011 04:36 AM (UTC)
Message
Anaristos said:

COMObject is null or not an object

which means to me that the function sees the variable, but its value has been reset, and therefore the value does not persist after the first alias exits.


Well maybe it never got created. Can you amend the function to confirm it worked?


var COMObject;

function cominit(label, line, wildcards)
{
    COMObject = new ActiveXObject("dmsManager.Agent");

    Note ("COMObject is type: " + typeof (COMObject) );
}


You should see:


COMObject is type: object


If you get that far (and it does indeed create the object) but still doesn't work, please post your whole scripts.js file. I would like to see what else you are getting up to.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Anaristos   USA  (24 posts)  [Biography] bio
Date Reply #19 on Sun 06 Feb 2011 05:00 AM (UTC)
Message
The output is:
Quote:

COMObject is type: object

So here is my scripts.js file:

var COMObject; // dmsManager COM reference.

var COMmds; // handler instance reference.


function cominit(name, line, wildcards)
{
	var dmsProgID = "dmsManager.Agent";
	
	COMObject = new ActiveXObject(dmsProgID);
	
	Note ("COMObject is type: " + typeof (COMObject) );
}

function dbopen(name, line, wildcards)
{
	var dbPath = VBArray(wildcards).toArray()[0];
	
	COMmds = COMObject.start(dbPath);
	
	if (COMmds.isOpen)
	{
	    COMmds.usemap     = true;
	    COMmds.jsonformat = true;
		
	    world.note("\nDatabase " + COMmds.path + " ready for operations\n");
	}
	
	else world.note("An error occured: " + COMmds.lasterror);
}

Sic itur ad astra
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #20 on Sun 06 Feb 2011 05:06 AM (UTC)
Message
Nitpicking a bit, but... You used 'dbopen' just now, but 'comopen' in a previous post. Did you rename it?

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Anaristos   USA  (24 posts)  [Biography] bio
Date Reply #21 on Sun 06 Feb 2011 06:03 AM (UTC)

Amended on Sun 06 Feb 2011 06:05 AM (UTC) by Anaristos

Message
Yes, when I moved the scripts to one file and had a chance to look at both functions at once, I decided to make the naming somewhat more consistent throughout functions that were related. I used comopen to be consistent with cominit, but dbopen is more consistent with what will follow once I get this thing going :)
I did update the aliases to reflect the change.

Sic itur ad astra
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


70,660 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]