Project

General

Profile

process_launch_helper.p

Roger Borrello, 01/24/2023 06:51 PM

Download (1.28 KB)

 
1
def var cmdline     as char    label "Command Line" format "x(65)".
2
def var interactive as logical label "Launch Type"  format "Interactive/Non-Interactive".
3
def var asynch      as logical label "No Wait".
4

    
5
main:
6
repeat:
7
   update cmdline
8
          interactive
9
          asynch
10
          with 1 down side-labels 1 column title "Command to Execute".
11

    
12
   if interactive then
13
      do:
14
         if asynch then
15
            do:
16
               message "Launching interactive programs with no-wait is NOT recommended!".
17
               message "Continue?" set continue as logical.
18
               if not continue then
19
                  next main.
20
            end.
21
            
22
         run interactive (input cmdline, input asynch).
23
      end.
24
   else
25
      run non-interactive (input cmdline, input asynch).
26
   
27
end.
28
   
29
procedure interactive:
30

    
31
   define input parameter cmdline as char.
32
   define input parameter asynch as logical.
33
   
34
   hide all no-pause.
35
   pause 0 before-hide.
36
   run non-interactive (input cmdline, input asynch).
37
   hide all no-pause.
38
   pause before-hide.
39

    
40
   
41
end.
42

    
43
procedure non-interactive:
44

    
45
   define input parameter cmdline as char.
46
   define input parameter asynch as logical.
47
   
48
   if asynch then
49
      os-command no-wait value(cmdline).
50
   else
51
      os-command value(cmdline).
52
   
53
end.