Jump to content
Server Maintenance This Week. ×

My VBScript won't work in FM8A


DG

This topic is 6672 days old. Please don't post here. Open a new topic instead.

Recommended Posts

The following lines run fine...

[color:blue]Dim fmApp

Set fmApp = CreateObject( "FMPRO.Application" )

fmApp.Visible = True

...and I get a new instance of FM in the foreground.

However, when I try and get the Documents object like this...

[color:blue]Dim fmDocs

fmDocs = fmApp.Documents

...I get a COM exception error.

I have also tried it in VB and it fails at the same point.

Any ideas?

Link to comment
Share on other sites

fmDocs = fmApp.Documents

...I get a COM exception error.

you need the "set" keyword: "set fmdocs = fmApp.Documents"

But I'm assuming this is just a typo because not having the "set" would not generate a COM error.

If you reboot the machine does it then work for a while but fails after a couple of runs?

I've been seeing similar behaviour in VB.NET and C# lately and haven't been able to find out what could cause this.

What's the full text of the error? When you get the error, close FM. Then go to the task manager and look in the list of running processes (second tab, not the running apps):) is there still an instance of FM?

Link to comment
Share on other sites

Yes, a typo indeed.

Today I have restarted both XP machines that this was happening on and tried to get an error message for you.

Of course, both now work perfectly every time (about 50 times each so far) from VB, VBScript and REALBasic.

I have literally just rebooted and tried again - no changes to the code at all.

I will keep playing and see if I can get an error. As far as I remember, it was as if it was saying that the Application object didn't have a property called "Documents". Yet, it would return other properties such as "FullName" just fine.

Thanks for your assistance and I'll keep you informed.

Link to comment
Share on other sites

Still no luck with getting it to crash out (if that makes sense!). Working every time. Will keep watching closely.

Incidentally, what method (if any) do you use to get round the fact that you can't send a parameter with the DoFMScript method?

Link to comment
Share on other sites

This topic is 6672 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.