Answered Run non-existant program without error

patelspam

New Member
Hello guys!
I wanted to ask if there's a way to run a program and that program ends up not existing and the program shows a message saying that BUT it doesn't break like the following code does:
Code:
DEFINE VAR temp-hand AS WIDGET-HANDLE.
DEFINE BUTTON make-btn LABEL "Make new button".
DEFINE FRAME btn-frame WITH SIZE 44 BY  10.

ENABLE make-btn WITH FRAME make-frame.

ON CHOOSE OF make-btn DO:
  RUN make-proc.
END.

VIEW FRAME btn-frame.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.

PROCEDURE make-proc.
  CREATE BUTTON temp-hand
    ASSIGN
      FRAME = FRAME btn-frame:HANDLE
      ROW = 5
      COLUMN = 10
      LABEL = "New Button"
      SENSITIVE = TRUE
      VISIBLE = TRUE
    TRIGGERS:
      ON CHOOSE PERSISTENT RUN btn-mess IN THIS-PROCEDURE.
    END TRIGGERS.
END PROCEDURE.

PROCEDURE btn-mess.
    RUN VALUE("sadsad").
  /*MESSAGE "Hello" SKIP "You have selected the new button"
      VIEW-AS ALERT-BOX INFO BUTTONS OK.     */
END PROCEDURE.

I don't want to search the program before running it since some of my company's client have slow computers and that takes a lot of time.


JP
 

Osborne

Active Member
To a degree yes, but you cannot trap the error cleanly:


Code:
DO ON STOP UNDO, LEAVE:
   RUN invalidprogram.p.
END.

MESSAGE "Program is still running." SKIP(1) "Was there an error?" ERROR-STATUS:ERROR VIEW-AS ALERT-BOX INFORMATION.
 

TomBascom

Curmudgeon
The idea that it is too expensive to use SEARCH is curious. RUN is going to fully exhaust the PROPATH before failing so it will have the same impact as SEARCH.

If you are finding SEARCH to be expensive then you might want to review your PROPATH and trim the garbage out of it.
 

patelspam

New Member
3 guys i talked with found the following solution. Thank you for the help anyway!
@TomBascom unfortunately that would not be an option since there are a lot of clients andsome of them have really big propaths. Even trimming the garbage out would take a lot of time and it wouldn't be effective enough.

PROCEDURE btn-mess:
RUN VALUE("gone.p").

CATCH e AS Progress.Lang.StopError:
MESSAGE
e skip
e:GetMessage(1)
VIEW-AS ALERT-BOX.
END CATCH.
END PROCEDURE.
 
Top