[VBA] Running microstation+script from .bat fails when autorun on server? Any help appreciated.

Hi all,

I have a microstation vba that scans files and reads/outputs to Excel. It works wonders around here, but only when run directly by a user, either on a desktop or on the server.

The code does not work if it is set to run at certain times by the server it self. But it does fire..

We do noticed that when the macro is "autorun" using Task Scheduler on .. some Windows server.. (using the setup below), no graphical interface is showing. And that this might be the issue? I have no clue, I just code the VBA..

Q: Is it possible to have this up and running, on it's own, on the server, with no user logged in?

Either as it is, or with modifications to the code. I just have no idea what to modify. The code mainly loads DGNs, and scans the content.. aand outputs to Excel.

Q: Is it possible (sorry for this being a server question!!) to have Windows run a program "on its own", but just like when a user is logged in? Like, logging in.. ish..

I don't know what I am saying..

 

The setup:

1. autorun.bat, Executes microstation with a dummy dgn, and fires a script.

"C:\Program Files (x86)\Bentley\MicroStation V8i (SELECTseries)\MicroStation\ustation.exe" "D:\WORKFOLDER\MVBA\pw\dummy.dgn" -sD:\WORKFOLDER\MVBA\pw\script.txt

2. script.txt, loads the vba, that autoexecutes.

VBA LOAD D:\WORKFOLDER\MVBA\pw\Cheetah.mvba

3. The VBA.. is too much to list, but it basically scans folders for changes in DGNs, matches that with data stored in excel and updates if need be.

About The server:

The server runs our projectwise setup, it has microstation installed, it has excel installed.
It is hands-off for normal people, so no one gets to log in behind projectwise..

About The VBA:

It runs nicely IF run directly by a user, logged in on the server, but not when run automatically. It also works on local machines, just like that.
It does not interact with the projectwise meta-data handler software thingamagicky at all, it simple scans the folders.

It does fire up microstation (as my program writes to a logfile) but it does not seem to be able to bind to excel?

Snippets from my logfile:

It seems our server guy left the auto-run active, as the latest logfile is from this night.

Here are most of the lines in the log, perhaps something is hidden in it?

First some application info:

"03:00:20|MicroStation info:"
"03:00:20|version:Version 08.11.09.459 Windows x86"
"03:00:20|Fullname:c:\Program Files (x86)\Bentley\MicroStation V8i (SELECTseries)\MicroStation\ustation.exe"
"03:00:20|ProcessID:3080"
"03:00:20|IsRegistered:True"
"03:00:20|IsSerialized:True"
"03:00:20|IsInitialized:True"
"03:00:20|IsProcessLocked:False"
"03:00:20|Visible:True"

.. and the references I need, checked to be in order:


"03:00:20|1. VBA, Visual Basic For Applications (4.0) at C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL"
"03:00:20|2. MicroStationDGN, Bentley MicroStation DGN 8.9 Object Library (8.0) at C:\Program Files (x86)\Bentley\MicroStation V8i (SELECTseries)\MicroStation\ustation.exe"
"03:00:20|3. stdole, OLE Automation (2.0) at C:\Windows\SysWOW64\stdole2.tlb"
"03:00:20|4. Excel, Microsoft Excel 12.0 Object Library (1.6) at C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE"

...

"03:00:20|Failed to initialize Excel.."
"03:00:20|Cheetah decided to terminate early and did not finish!"

On a side note, our server-setup guy took two months to decide he has no clue. So I, the humble coder, turn to you for any help (I can pass on to him).
I cannot access the server unless he, our server-go-to-guy is physically here due to IT-security, so I cannot really fill you in on details on the server setup.

Also, I choose to insist on this approach - running it serverside, rather than checking files out through projectwise and send across the 'net - for multiple very good reasons, if you ask me. So I cannot simply move the script anywhere else. (Also, I'd like the code and various input files away from the users ;)

I apologize if you all think this question is too server-related to be here, and hope you'll forgive me, and help me anyways!

Regards,
/Torben

Parents
  • Unknown said:
    Is it possible (sorry for this being a server question!!) to have Windows run a program "on its own", but just like when a user is logged in?

    That is a Windows question, and you'll find plenty more like it on Windows' Forums.  The short answer is that you can tell Windows to run an executable using a specified process (i.e. user account).

    However, you really, really should check your end user license agreement for MicroStation. 

     
    Regards, Jon Summers
    LA Solutions

  • Thank you Jon.

    Your input is very much appreciated. I'll pass it on to whom it may concern and report back!
    There couldn't possibly be anything in the EULA preventing automation using uStation? I don't follow? Still, I'll pass it on.

    System: Win7 64bit 16GB Ram - microStation V8i SS3 08.11.09.578. + PoinTools CONNECT. - Intel i7-4800MQ CPU@2.70GHz, 4 core / 8 Logic proc.

  • Unknown said:
    There couldn't possibly be anything in the EULA preventing automation using uStation? I don't follow?

    Well, I can't be certain, because licensing varies from country to country to accommodate local laws.  However, in most cases I believe that your EULA entitles you to use MicroStation interactively but not as an automated process.

    What is meant by 'automated process'?  Does invoking a MicroStation batch file create an automated process?  Does firing up visualisation on a render farm constitute an automated process?   See how your corporate lawyer interprets the EULA.

     
    Regards, Jon Summers
    LA Solutions

  • Thanks Jon.

    As always your knowledge of microStation is amazing, and your input is very much appreciated!
    I will back out of the discussion of the legality, and focus on my job - if I have one...

    System: Win7 64bit 16GB Ram - microStation V8i SS3 08.11.09.578. + PoinTools CONNECT. - Intel i7-4800MQ CPU@2.70GHz, 4 core / 8 Logic proc.

Reply Children
No Data