Line by line debugging works but built execution (EXE) does not

Hello,
I have a Visual Basic code running in company with Catia V5 R14 SP4. My development kit is MS Visual Studio 6.0 installed on Windows XP SP2.

It reads model file names in iteration from an Excel worksheet and then opens the model in Catia V5. Next, it changes some properties of the model and then closes it after saving. This iteration goes on until all Excel lines are processed.

When I run the code line by line in debugging mode, it works fine and does the job. No errors.

However, when I compiled this code into an EXE, it does not work properly. After a few iterations, an empty Catia V5 window appears with name "CATFrmWindow". In the meantime, the EXE continues but at a point Catia V5 gives "Command Interrupted" error and crashes.

Any ideas why the EXE would behave differently than the line-by-line execution?
TAI-Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
DhaestConnect With a Mentor Commented:
Perhaps the exe is going to fast for your catia...
0
 
TAI-Author Commented:
Thank you Dhaest,

Although I was expecting a more complex solution, it seems that the correct answer is this one. Indeed, that was also our comment on the problem because the only difference is "time".

To be more precise in my expectation:
What I have found is that Catia V5 cannot complete some jobs before saving. However, I don't want to put a trivial period of pause in front of the save (e.g. 2 minutes). It's because there are around 2500 files of different sizes and it is essential that execution is fast.

I want to be able to check whether Catia V5 completed its job before any save operation.
Any methods to check it?

(I will keep it open for a more complex solution.)
0
 
DhaestCommented:
I don't know Catia V5, so I don't know if there is a possibilty to check if it's completed his jobs...
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
3_SCommented:
do you use shell to start catia?
You could also make a control program which launches 2500 the program
if the executable can run next to each other that is.
then your iteration is in the control program and the program you now have only processes one excel file
0
 
Jim HornConnect With a Mentor Microsoft SQL Server Developer, Architect, and AuthorCommented:
Shy of actually installing VB Enterprise on that pc, the manual way of pulling this off would be to insert various msgbox's in code where you believe it to be failing, compile, deploy, run, and see which msgbox's display and which do not.   Either that, or writing comments to a text file.

Sorry, but not a world of options here.
0
 
TAI-Author Commented:
Thank you Jimhorn,

As I wrote in my reply to Dhaest's comment; I was aware that the problem is the most probably "time". Therefore, I had some "pauses" in between the lines of code. And eventually, as I wrote above, I found the problem "Catia V5 cannot complete the jobs before VB saves the model file." (Yesterday I was not so sure but today no doubt.)

So I need a function that recognizes Catia is done or that checks if the previous line of code was "thoroughly" completed both on VB and on Catia.

If there is no such function (at least I don't know) it's OK and I will need to choose "pauses" giving up the performance.

All the best,
0
 
DhaestCommented:
I don't know the program, so I'm not sure that it is possible. Isn't there any programming reference deliverd with the program (or perhaps on the net).
You can perhaps also ask them if there is a programming reference. If not, then you 'll have to work with pauses...
0
 
dentabCommented:
Hi Tai...

If I get this right... just to simplify your program is talking to another but when compiled is running too fast going from one instruction to the next, which causes an error?  If the error is trappable I would try this

Dim waitDate as Date, success As Boolean

'Do Job 1... what ever that is here

DoEvents

success=False
waitDate = DateAdd("S",15,now)

On Err Resume Next
While now<waitDate And success=False
  DoEvents
  'Call Job2 here

  If Err = 0 Then
    success=True
  Else
    Err.Clear
  End If
 
Wend
On Err Goto 0

Is that any good?
0
 
TAI-Author Commented:
Hello Dhaest,

Unfortunately, the references do not provide such a method and I had to utilize a "pause" routine.
Thank you for your idea on "speed", which leads to "time"  ;)

Hello Dentab,

It seems that your code does the opposite of what I wanted; but the general idea is the same. Parallel to this, I had used a selt-written "pause" sub.

As far as I understand your code:
- Since Catia V5 does not give an explicit error in this case, "Err" does not work as you expected.
- For me Job2 is "to save", therefore itmust be after the "While" loop. I mean,

###
   While now < waitDate
       DoEvents
   Wend
   Catia.Save  'Job2
###

Thank you all for giving ideas,

0
 
dentabCommented:
It does the opposite?

It should br trying untill its ok.  If I knew thet Err didn't work I would have looked for the general error trapping alternative.  There are other answers too but a short delay seems like a reasonable solution.  At least I have this months points quota so no real loss, as long as your problem is solved.
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Thanks for the split, good luck with your project.  -Jim

btw "lose" all the "double" "quotes" in your "comments".  TIA.
0
 
TAI-Author Commented:
Hello Jimhorn,

I usually use double quotes to distinguish system/software messages and to emphasize important words.

Although I think that I used them properly in my way, it seems that you found them too many.
I am open to your critics and will be glad to hear your further comments. Especially if you think that they make reading & understanding my messages more difficult.

Regards,
0
 
dentabCommented:
Hi Tai,

I think its a useful notation, prehaps if you used asterisks instead?

0
All Courses

From novice to tech pro — start learning today.