RZajcew
Intermediate
Intermediate
Posts: 387
Joined: Mon Jul 21, 2008 7:31 pm
Contact: Send private message

Calling a routine in another script

Sat Jan 03, 2009 6:09 pm

I am trying to invoke a subroutine that exists in another MLScript. I gather this is possible from the "Sample3" file that is part of the MLScript plugin (I think it came with the plugin). In any case, the Sample3 file (in its entirety) is simply:

Option Explicit
Call MySample

When I invoke this using "MLScript|Sample3", the result in the MLScript event log is:

CMD: Sample3 FROM:
DoCmd Error #500 - Variable is undefined: 'MySample'

User avatar
AllonisDave
Founder
Founder
Posts: 11604
Joined: Fri Feb 07, 2003 8:56 am
Location: Newport Beach, CA
Contact: Send private message

Sat Jan 03, 2009 9:46 pm

You cannot directly call a function from another script. Each script is self contained and does not know about other scripts in the database. You would have to issue a MLServer.cmdReceive "MLScript|TheOtherScript~SomeFunction" in the first script in order to run the other script. This is probably not what you want to do.

RZajcew
Intermediate
Intermediate
Posts: 387
Joined: Mon Jul 21, 2008 7:31 pm
Contact: Send private message

Sun Jan 04, 2009 1:14 pm

For the sake of completeness only... I had tried cmdReceive earlier and ended up with:

DoCmd Error #-2147467259 - Cannot set this property while the script is running.

Using cmdReceivePush might work, it seems. However, as you aver, kicking off another script merely to do an external call isn't a great concept. Sacrificing some modularity in my scripts is the order of the day.

Thanks for the quick reply.
- Roman

Return to “MLScript”

Who is online

Users browsing this forum: No registered users and 1 guest