xcall MIAMEX, MX_GETPID, pid
MX_GETPID (MIAMEX 104) retrieves your current process ID number. A process ID (aka PID) is a positive integer which uniquely identifies a process. They are assigned by the operating system when the process is created, and recovered (for subsequent reuse) when the process terminates. PIDs are most useful in UNIX, where they are the most common way to identify or communicate with another process. They are less useful but still valid in the Windows environment.
pid (Num) will return your process ID. Note that these numbers can get quite large on large systems, so you should specify at least a B,3 (or a floating point).