Self Start

This is a good way to open a new process from a menu rather than using the Start in New Process checkbox, which doesn't allow you to name the process, set the stack, etc. The other way is to call a method which calls New Process to open the method you really want to run. Those poor menu method. They get used and thrown away in a single line. So, so sad.

So, in the method you want to run in its own process, all you have to do is put:
` BackgroundThingyMethod

If (SelfStart (Current method name))
  Repeat
    DancingSugarPlumFaries
  Until(Awake)
End if
All you have to add is the If and End if statements, and poof! eet ees don.
  ` SelfStart
  ` Used to cause the calling method to re-run in a new Process
  ` $1 - Process name
  ` $2 - Method name (If not passed, the same as the process name)
  ` $3 - Delay in tics. In case you want to delay the new process a bit before 
  `         running.

  ` Example:
  ` If (SelfStart (Current method name;Current method name))
  `     Do some stuff
  ` End if  ` SelfStart

C_TEXT($1;$2;$NewProcessName;$ProcessName)
C_LONGINT($3;$Delay;$ProcessState;$ProcessTime;$Loop)
C_BOOLEAN($0;$Go;$Done)

$NewProcessName:=$1
If ($NewProcessName>"!")
  If (Count parameters>=2)
    $MethodName:=$2
  Else 
    $Loop:=0
    $Done:=False
    $MethodName:=$NewProcessName
    Repeat   ` Find out if the Process name starts with a non-letter designation
      If (Position($MethodName[[1]];"abcdefghijklmnopqrstuvwxyz")>0)
        $Done:=True
      Else 
        $MethodName:=Substring($MethodName;2)
      End if 
      $Loop:=$Loop+1
    Until (($Loop>=3) | ($Done))
    
  End if 
  
  If (Count parameters>=3)
    $Delay:=$3
  Else 
    $Delay:=0
  End if 
  
  PROCESS PROPERTIES(Current process;$ProcessName;$ProcessState;$ProcessTime)
  
  If ($NewProcessName#$ProcessName)  ` This is not in its own Process
    $ProcessID:=FND_DoProcess ($MethodName;$NewProcessName)
    If (Application type#4D Server )  ` Don't use CALL PROCESS on the server
      CALL PROCESS($ProcessID)
    End if 
    $Go:=False
  Else 
    $Go:=True
    DELAY PROCESS(Current process;$Delay)
  End if 
Else 
  $Go:=False
End if 

$0:=$Go