How to avoid all user prompts when running API in silent mode

How to avoid all user prompts when running API in silent mode

MikeGillam5072
Enthusiast Enthusiast
1,633 Views
2 Replies
Message 1 of 3

How to avoid all user prompts when running API in silent mode

MikeGillam5072
Enthusiast
Enthusiast

We have an Inventor API application that runs in a headless/server mode where there is no user to respond any error situations that occur.  I specify "silent mode" when I instantiate the Inventor application object.

 

ThisApplication = CreateObject(

ThisApplication.SilentOperation = True

"Inventor.Application")

 

However, occasionally we get errors that will display a message box requiring user interaction, and of course this hangs our server process until someone responds.

 

For example, if we attempt to overwrite a file with SaveAsCopy() and another process has a lock on the file, it will hang. I'd prefer it to just throw an exception that my application can handle accordingly.

 

Any help will be appreciated.

 

Thanks

Mike

0 Likes
Accepted solutions (1)
1,634 Views
2 Replies
Replies (2)
Message 2 of 3

YuhanZhang
Autodesk
Autodesk

A workaround is to add a check in your code before calling SaveAsCopy. The check can be:

 

1. Detect if a file with the same name you want to use already exists in the folder.

2. If it exists, try to delete the file.

3. If fail to delete the file, you can handle this exception and need not to call the SaveAsCopy.

 

Hope this helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 3

MikeGillam5072
Enthusiast
Enthusiast
Accepted solution

Thank you.

 

I should have thought of that myself!

0 Likes