app.app.pid_for_bid
Declaration
lua
app.pid_for_bid(bid)
Description
Get PID of running app by bundle ID. Reads
CFBundleExecutable from Info.plist, searches process list via sysctl. Handles p_comm 16-char truncation.Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
bid | string | Required | — | Bundle identifier |
Return Values
| Type | Description |
|---|---|
| integer | PID (or 0 if not running/not found) |
Example
lua
local pid = app.pid_for_bid("com.apple.mobilesafari")