Question Run non-existant program in a existing program without error

patelspam

New Member
Hey there!
I already posted a similar question a while back but I came back with a better one...
How could I catch an error on a program without editing that program?
I added 3 attachments (3 .p ). I want to be able to run the custom1.p and press the button that runs custom2.p that then runs custom3.p (where it tries to run a program that doesn't exist). I want to be able to do that over and over again (and catch the error in the first program (custom1.p) if possible), allowing me to proceed with my work without having to re-start everything.
Is there a way to do that?

Thank you!

JP
 

Attachments

  • custom3.p
    647 bytes · Views: 4
  • custom1.p
    1.2 KB · Views: 5
  • custom2.p
    793 bytes · Views: 4

spk

New Member
Can you just change program 2.p to say..

If SEARCH("custom3.p") <> ? THEN
RUN VALUE("custom3.p").
 

patelspam

New Member
Can you just change program 2.p to say..

If SEARCH("custom3.p") <> ? THEN
RUN VALUE("custom3.p").
I can but i would need to do that in more than 1000 programs in my company alone... I was trying to find a way to go around that...
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
Why does the code you want to run not exist when it should?

And if this question is about some existing application, what happen today when you try to run a missing program?
 

patelspam

New Member
Why does the code you want to run not exist when it should?

And if this question is about some existing application, what happen today when you try to run a missing program?
This usually happens in testing, and I wanted to prevent those errors before shuttding down my app.
Today the program would crash and it would close my application.
 

Stefan

Well-Known Member
This usually happens in testing, and I wanted to prevent those errors before shuttding down my app.
Today the program would crash and it would close my application.
Add a do on stop undo, retry block to your main .p.
 

Stefan

Well-Known Member
Did you add a retry block too? Otherwise the AVM will not retry and just leave the block.

Code:
_main:
do on stop undo, retry:

   if retry then do:
      message 'retry?' view-as alert-box buttons yes-no update lretry as logical.
      if not lretry then 
         leave _main.
   end.
      
      
   run oops.p.

end.

This will show an error that bye.p does not exist and it will then ask to retry.
 
Top