<?php
// find_xcode_executable.php
// RJM Programming
// November, 2026
// Use with macOS and Xcode
// Helped out by https://www.google.com/search?q=can+a+command+line+xcode+command+determine+the+executable+path+for+an+xcode+project+name%3F&rlz=1C5OZZY_en&oq=can+a+command+line+xcode+command+determine+the+executable+path+for+an+xcode+project+name%3F&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIHCAEQIRiPAjIHCAIQIRiPAtIBCTM2NTUyajBqN6gCALACAA&sourceid=chrome&source=chrome.ob&ie=UTF-8
// cd "/Applications/MAMP/htdocs/DccumentProject/My Next File C Program/" ; xcodebuild -project "My Next File C Program.xcodeproj" -scheme "My Next File C Program" -showBuildSettings | grep -E "^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) ="
//2026-11-22 17:57:15.240 xcodebuild[30786:4838683] [MT] IDERunDestination: Supported platforms for the buildables in the current scheme is empty.
//--- xcodebuild: WARNING: Using the first of multiple matching destinations:
//{ platform:macOS, arch:arm64, id:00008103-000328410EA2001E, name:My Mac }
//{ platform:macOS, arch:x86_64, id:00008103-000328410EA2001E, name:My Mac }
//{ platform:macOS, name:Any Mac }
//    EXECUTABLE_PATH = My Next File C Program
//    TARGET_BUILD_DIR = /Users/user/Library/Developer/Xcode/DerivedData/My_Next_File_C_Program-blfjoaxttlpyniaghlsxiantcafy/Build/Products/Debug
// find . -name '*.xcodeproj' 2> /dev/null
//Applications/MAMP/htdocs/Swift Document App/Swift Document App.xcodeproj
//Applications/MAMP/htdocs/Playground/.build/checkouts/Files/Files.xcodeproj
//Applications/MAMP/htdocs/DccumentProject/My File C Program/My File C Program.xcodeproj
//Applications/MAMP/htdocs/DccumentProject/Sample Document Project/Sample Document Project.xcodeproj
//Applications/MAMP/htdocs/DccumentProject/TestiOSApp/TestiOSApp.xcodeproj
//Applications/MAMP/htdocs/DccumentProject/My Screen Saver/My Screen Saver.xcodeproj
//Applications/MAMP/htdocs/DccumentProject/My Next File C Program/My Next File C Program.xcodeproj
//Applications/MAMP/htdocs/DccumentProject/My C Command Line Project/My C Command Line Project.xcodeproj
//Applications/MAMP/htdocs/Swift Command Line/Swift Command Line.xcodeproj
//Applications/MAMP/htdocs/Fibonacci/Fibonacci.xcodeproj
//Applications/MAMP/htdocs/AudioUnit/Sample Audio Unit/Sample Audio Unit.xcodeproj
set_time_limit(0); //ini_set('max_execution_time', 60000); 
ignore_user_abort(true);

if (!isset($argc)) {
if (strpos($_SERVER['SERVER_NAME'], 'localhost') !== false) {
if (isset($_GET['execfour']) || isset($_GET['execthree']) || isset($_GET['exectwo']) || isset($_GET['execone'])) {
   $execone="";
   $exectwo="";
   $execthree="";
   $execfour="";
   
   if (isset($_GET['execone'])) {
     $execone=str_replace('+',' ',urldecode($_GET['execone']));
   }
   if (isset($_GET['exectwo'])) {
     $exectwo=str_replace('+',' ',urldecode($_GET['exectwo']));
   }
   if (isset($_GET['execthree'])) {
     $execthree=str_replace('+',' ',urldecode($_GET['execthree']));
   }
   if (isset($_GET['execfour'])) {
     $execfour=str_replace('+',' ',urldecode($_GET['execfour']));
   }
   
   if ($execone != "") {
     exec($execone);
   }
   if ($exectwo != "") {
     exec($exectwo);
   }
   if ($execthree != "") {
     exec($execthree);
   }
   if ($execfour != "") {
     exec($execfour);
   }
   exit;
}
}
}

$dactor="Terminal";
$dverb="do script";
$undis="";
$sleepabys=0; // between components in seconds
$seqdelay=0;  // between sequence sets in seconds
$maxwithin=0;
if (!isset($argc)) {
 $delstuff='';
 if (isset($_GET['idelay'])) {
   $delstuff=str_replace('+',' ',urldecode($_GET['idelay']));
 } else if (isset($_POST['idelay'])) {
   $delstuff=str_replace('+',' ',urldecode($_POST['idelay']));
 }
 if (strpos($delstuff,'.') !== false) {
   $deltwo=explode('.', $delstuff)[1];
   if (trim($deltwo) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($deltwo))))))))))) == '') {
     $sleepabys=intval(trim($deltwo));
   }
 }
 $delone=explode('.', $delstuff)[0];
 if (trim($delone) != '' && str_replace('0','',str_replace('1','',str_replace('2','',str_replace('3','',str_replace('4','',str_replace('5','',str_replace('6','',str_replace('7','',str_replace('8','',str_replace('9','',trim($delone))))))))))) == '') {
     $seqdelay=intval(trim($delone));
 }
}
if (strtoupper(PHP_OS) == 'DARWIN') {
  $undis="\n  document.getElementById('ilog').style.visibility='visible';   \n";
} else {
  $undis="\n  if (('' + navigator.platform).toLowerCase().indexOf('mac') == 0) { window.open('http://localhost:8888/find_xcode_executable.php' + (locpath == '' ? '?locpath=' : '?locpath=' + encodeURIComponent(locpath)) + (locargs == '' ? '' : locargs), '_blank','top=50,left=50,width=' + eval(-100 + eval('' + screen.width)) + ',height=' + eval(-100 + eval('' + screen.height)) + '');  } else {  window.open('http://localhost/find_xcode_executable.php' + (locpath == '' ? '?locpath=' : '?locpath=' + encodeURIComponent(locpath)) + (locargs == '' ? '' : locargs), '_blank','top=50,left=50,width=' + eval(-100 + eval('' + screen.width)) + ',height=' + eval(-100 + eval('' + screen.height)) + '');     }   \n";
}
$startin=".";
if (isset($_GET['isurl']) || isset($_POST['isurl'])) {
 $dactor="Safari";
 $dverb="open location";
}
if (isset($_GET['startin'])) {
 if ($_GET['startin'] != '') {
  $startin=str_replace('+',' ',urldecode($_GET['startin']));
 }
}
$starterforone="";
$two=2;
$hbo="";
$hboi=0;
$cbo="";
$cboi=0;
$ebo="";
$eboi=0;
$dothisecho="";
$ehbo="";
$ehboi=0;

function ourpassthru($passwhat) {
  global $hbo, $hboi, $sleepabys, $cbo, $cboi, $ebo, $eboi, $dothisecho, $seqdelay, $maxwithin, $ehbo, $ehboi;
  //sleep($sleepabys);
  if (strpos($passwhat, "\\\"http") !== false || strpos($passwhat, "\\\"//") !== false) {
    if (strtoupper(PHP_OS) == 'DARWIN') {
     $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
     $dothisecho="tab 1 of window ";
     $upref="";
     if (strpos($passwhat, "\\\"//") !== false) {
       $upref="https:";
     }
     if ($ebo == "") {
     $ebo='open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
     $ehbo="<html><body onload=\"setTimeout(function(){ document.getElementById('mya').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a>&nbsp;&nbsp;<button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>&nbsp;&nbsp;</body></html>";
     if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; $maxwithin+=$sleepabys;  }
     $eboi++;
     $ehboi++;
     } else {
     $ebo.=' ; open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"';
     $ehbo=str_replace('</body>', "&nbsp;<a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya" . "$ehboi" . " style=text-decoration:none;>&nbsp;</body>", $ehbo);
     $ehbo=str_replace("\"><a ", " setTimeout(function(){ document.getElementById('mya" . "$ehboi" . "').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a ", $ehbo);
     if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' '; $maxwithin+=$sleepabys;  }
     $eboi++;
     $ehboi++;
     }
     //if (strpos($rest, '&') !== false) {
     //return exec('open "' . $upref . explode("\\\"", $passwhat)[1] . trim($rest) . '"');
     //} else {
     //return exec('open ' . $upref . explode("\\\"", $passwhat)[1] . trim($rest));
     //}
     return '';
    } else {
     $rest=explode('"',explode("\\\"", $passwhat)[2])[0];
     if ($hbo == "") {
     if ($sleepabys > 0) { 
     $maxwithin+=$sleepabys;
     $hbo="<html><body onload=\"setTimeout(function(){ document.getElementById('mya').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000 * 0) . ");\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a>&nbsp;&nbsp;<button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>&nbsp;&nbsp;</body></html>";
     } else {
     $hbo="<html><body onload=\"document.getElementById('mya').click();\"><a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya style=text-decoration:none;>tab 1 of window</a>&nbsp;&nbsp;<button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>&nbsp;&nbsp;</body></html>";
     }
     $hboi++;
     } else {
     $hbo=str_replace('</body>', "&nbsp;<a target=_blank href=\"" . explode("\\\"", $passwhat)[1] . trim($rest) . "\" id=mya" . "$hboi" . " style=text-decoration:none;>&nbsp;</body>", $hbo);
     if ($sleepabys > 0) { 
     $maxwithin+=$sleepabys;
     $hbo=str_replace("\"><a ", " setTimeout(function(){ document.getElementById('mya" . "$hboi" . "').click(); }," . ((($cboi + $hboi + $eboi) * $sleepabys) * 1000) . ");\"><a ", $hbo);
     } else {
     $hbo=str_replace("\"><a ", " document.getElementById('mya" . "$hboi" . "').click();\"><a ", $hbo);
     }
     $hboi++;
     }
     return "";
     //exit;
    }
  }
  if (!isset($argc)) {
    if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {
  if ($ebo == "") {
    $dothisecho="tab 1 of window ";
    $ebo=$passwhat;
    if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' ';     $maxwithin+=$sleepabys;  }
    $eboi++;
    return "";
  } else {
    $ebo.=" ; " . $passwhat;
    if ($sleepabys > 0) { $ebo.=' ; sleep ' . "$sleepabys" . ' ';    $maxwithin+=$sleepabys;  }
    $eboi++;
    return "";
  }
       return exec($passwhat);
    }
  }
  if ($cbo == "") {
    $cbo=$passwhat;
    if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' ';    $maxwithin+=$sleepabys;  }
    $cboi++;
    return "";
  } else {
    $cbo.=" ; " . $passwhat;
    if ($sleepabys > 0) { $cbo.=' ; sleep ' . "$sleepabys" . ' ';     $maxwithin+=$sleepabys;  }
    $cboi++;
    return "";
  }
  return passthru($passwhat);
}

if (isset($argc)) {  // osascript -e 'do shell script "/path/to/executable --flag \"argument with spaces\""'
   //$command="osascript -e 'tell application \"" . $argv[1] . "\"";   //"  to activate';
   $pex=$argv[1];
   if ($pex == "script") {
     $starterforone=$pex . ' ' . $argv[2] . ' ';
     $pex=$argv[3];
   }
   $command="osascript -e 'tell application \"" . $dactor . "\" to " . $dverb . " \"" . $starterforone . "\\" . "\"" . str_replace('"','',$pex) . "\\\"";   //"  to activate';
   for ($ii=$two; $ii<$argc; $ii++) {
    //$command.=' ' . "\\\"" . $argv[$ii] . "\\\"";
    $command.=' ' . "" . $argv[$ii] . "";
   }

$descriptors = [
    0 => STDIN,  // Inherit standard input (keyboard)
    1 => STDOUT, // Inherit standard output (terminal screen)
    2 => STDERR, // Inherit standard error
];

   $process=proc_open($command . $dae . "\"'", $descriptors, $pipes);

   if (is_resource($process)) {
    $exitCode = proc_close($process);
   }
   exit;
}

$psuff="";  
$pisuff=1;   

while (isset($_POST['execexec' . $psuff])) {
  $pex=str_replace('+',' ',urldecode($_POST['execexec' . $psuff]));
  if (strpos(('~' . $pex), '~http') !== false) {
   $dactor="Safari";
   $dverb="open location";
  } else if (strpos(('~' . $pex), '~//') !== false) {
   $dactor="Safari";
   $dverb="open location";
  } else {
   $dactor="Terminal";
   $dverb="do script";
  }
  if (isset($_POST['argsare' . $psuff])) {
   $pex=str_replace('+',' ',urldecode($_POST['execexec' . $psuff]));
   if (strpos('~' . $pex, '~script ') !== false) {
     $starterforone='script ' . explode(' ',explode('script ', $pex)[1])[0] . ' ';
     $pex=str_replace($starterforone,"",$pex);
   }
   $command="osascript -e 'tell application \"" . $dactor . "\" to " . $dverb . " \"" . $starterforone . "\\" . "\"" . str_replace('"','',$pex) . "\\\"";   //"  to activate';
   if ($_POST['argsare' . $psuff] != '') {
   //$command.=' ' . "\\\"" . str_replace('"','',str_replace('+',' ',urldecode($_POST['argsare']))) . "\\\"";
   $command.=' ' . "" . str_replace('"','',str_replace('+',' ',urldecode($_POST['argsare' . $psuff]))) . "";
   }
   ourpassthru($command . "\"'");
   //passthru("php " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "find_xcode_executable.php " . str_replace('+',' ',urldecode($_POST['execexec'])) . ' ' . str_replace('+',' ',urldecode($_POST['argsare'])) . "");
   //exit;
  } else {
   $command="osascript -e 'tell application \"" . $dactor . "\" to " . $dverb . " \"\\" . "\"" . str_replace('"','',str_replace('+',' ',urldecode($_POST['execexec' . $psuff]))) . "\\\"";   //"  to activate';
   ourpassthru($command . "\"'");
   //passthru("php " . $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "find_xcode_executable.php " . str_replace('+',' ',urldecode($_POST['execexec'])) . "");
   //exit;
  }
  $pisuff++;
  $psuff="$pisuff";
}

$oktoexit=false;
$x='x';
$onl="";
$ifexecsrc="./find_xcode_executable.php";

if (isset($_POST['execexec'])) {
  if ($maxwithin > 0 && $sleepabys > 0 && $seqdelay > 0) {
    $maxwithin=((($cboi + $hboi + $eboi) * $sleepabys) * 1);
    //$maxwithin+=$sleepabys;
  }
  if ($seqdelay > 0) {
  
  if ($ebo != "" && $hbo == "") { // && $cbo == "") { 
    $hbo=$ehbo;
    $ebo='';
    $oktoexit=true;
    $dothisecho="";
  }
  if ($hbo != "" && $ebo == "") { //  && $cbo == "") {
    $onlbit=explode('"',explode(' onload="', $hbo)[1])[0];
    if ($cbo != "") {
    $hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);

    if (strpos($ifexecsrc,'?') === false) {
    $ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
    $cbo="";
    if ($dothisecho == '') {
      $dothisecho.=' ';
    }
    } else if (strpos($ifexecsrc,'?') !== false) {
    $ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
    $cbo="";
    if ($dothisecho == '') {
      $dothisecho.=' ';
    }
    } 

    if (strpos($ifexecsrc,'?') !== false) {
      $onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . ");  ";
    }
    
    if (strpos($onl, " onload=\"") !== false && strpos($hbo, " onload=\"") !== false) {
      $hbo=str_replace(" onload=\"", $onl, $hbo);
    }

    $hbo=str_replace("</body>", "&nbsp;&nbsp;<iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body>", $hbo);
    
    $cbo="";
    } else {
    $hbo=str_replace($onlbit,' ' . $onlbit . ' setInterval(function(){ ' . $onlbit . ' }, ' . (($maxwithin + $seqdelay) * 1000) . '); ',$hbo);
    }
    $dothisecho="";
    $x='';
  }
  //file_put_contents('x.x','');
  if ($hbo != "") {
    //file_put_contents('x.x',file_get_contents('x.x') . "\nhbo=" . $hbo);
    echo $hbo;
  }
  if ($ebo != "") {
    //file_put_contents('x.x',file_get_contents('x.x') . "\nebo=" . $ebo);
    if (strpos($ifexecsrc,'?') === false) {
    $ifexecsrc.='?execone=' . str_replace('+','%20',urlencode($ebo));
    $ebo="";
    if ($dothisecho == '') {
      $dothisecho.=' ';
    }
    } else if (strpos($ifexecsrc,'?') !== false) {
    $ifexecsrc.='&exectwo=' . str_replace('+','%20',urlencode($ebo));
    $ebo="";
    if ($dothisecho == '') {
      $dothisecho.=' ';
    }
    } else {
    exec($ebo);
    }
  }
  if ($cbo != "") {
    //file_put_contents('x.x',file_get_contents('x.x') . "\ncbo=" . $cbo);
    //passthru($cbo);
    if (strpos($ifexecsrc,'?') === false) {
    $ifexecsrc.='?execthree=' . str_replace('+','%20',urlencode($cbo));
    $cbo="";
    if ($dothisecho == '') {
      $dothisecho.=' ';
    }
    } else if (strpos($ifexecsrc,'?') !== false) {
    $ifexecsrc.='&execfour=' . str_replace('+','%20',urlencode($cbo));
    $cbo="";
    if ($dothisecho == '') {
      $dothisecho.=' ';
    }
    } else {
    exec($cbo);
    }
  }
  if ($dothisecho != '') {
    //file_put_contents('x.x',file_get_contents('x.x') . "\ndothisecho=" . $dothisecho);
    //echo $dothisecho;
    if (strpos($ifexecsrc,'?') !== false) {
      $onl=" onload=\"setInterval(function(){ document.getElementById('ifexec').src=document.getElementById('ifexec').src.split('&rand=')[0] + '&rand=' + Math.floor(Math.random() * 19897674); }, " . (($maxwithin + $seqdelay) * 1000) . ");  \"";
    }
    //file_put_contents('x.x', file_get_contents('x.x') . "\n<html><body" . $onl . "><span>tab 1 of window</span>&nbsp;&nbsp;<button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>&nbsp;&nbsp;<iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>");
    echo "<html><body" . $onl . "><span>tab 1 of window</span>&nbsp;&nbsp;<button onclick=\"location.href='./find_xcode_executable.php';\" style=background-color:yellow;color:blue;display:inline-block;>Stop</button>&nbsp;&nbsp;<iframe style=display:none; id=ifexec src=\"" . $ifexecsrc . '&rand=' . rand(167,78654) . "\"></iframe></body></html>";
    $dothisecho="";
    $x='';
    $oktoexit=true;
  }
  
       //exit;
  
 
  while ($seqdelay > 0 && ($ebo . $cbo . $dothisecho . $x) != "") {
    if (connection_aborted()) {
    $seqdelay=0;
    $x='';
    sleep(($maxwithin + $seqdelay));
    } else {
    sleep(($maxwithin + $seqdelay));
    if ($ebo != "") {
      exec($ebo);
    }
    if ($cbo != "") {
      //passthru($cbo);
      exec($cbo);
    }
    if ($dothisecho != '') {
      echo $dothisecho;
      $dothisecho="";
    }
    }
  }
  
  
  } else {
  if ($ebo != "") {
    exec($ebo);
  }
  if ($cbo != "") {
    passthru($cbo);
  }
  if ($dothisecho != '') {
    echo $dothisecho;
  }
  if ($hbo != "") {
    echo $hbo;
  }
  }
  if ($seqdelay <= 0 || $oktoexit) {
    exit;
  }
}

if ($seqdelay <= 0) {
$sofarcnt=1;
//echo "find " . $startin . " -name '*.xcodeproj' 2> /dev/null";
//exit;
$list="";
if (strtoupper(PHP_OS) == 'DARWIN') {
  $list=str_replace("." . DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR, shell_exec("cd " . $_SERVER['DOCUMENT_ROOT'] . " ; " . "find " . $startin . " -name '*.xcodeproj' -maxdepth 7 2> /dev/null"));
}
$recs=explode("\n", $list);
$selis="<select size=1 style=width:600px; id=mysel onchange='displayexec(this);'><option value=''>Please select an Xcode project to find executable path for</option></select>";

if ($list != '') {
for ($i=0; $i<sizeof($recs); $i++) {
  $execexec="";
  $projname="";
  $execprj=explode(DIRECTORY_SEPARATOR, $recs[$i])[-1 + sizeof(explode(DIRECTORY_SEPARATOR, $recs[$i]))];
  $pathis=explode($execprj, $recs[$i])[0];
  //echo 'cd "' . $pathis . '" ; xcodebuild -project "' . $execprj . '" -scheme "' . str_replace('.xcodeproj','',$execprj) . '"  -showBuildSettings | grep -E "^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) ="';
  //exit;
  $findings=shell_exec('cd "' . $pathis . '" ; xcodebuild -project "' . $execprj . '" -scheme "' . str_replace('.xcodeproj','',$execprj) . '"  -showBuildSettings | grep -E "^\s*(TARGET_BUILD_DIR|EXECUTABLE_PATH) ="');
  $frecs=explode("\n", $findings);
  for ($j=0; $j<sizeof($frecs); $j++) {
     if (strpos($frecs[$j], "EXECUTABLE_PATH") !== false) {
       $projname=explode("EXECUTABLE_PATH=", str_replace(' = ','=',$frecs[$j]))[1];
     }
     if (strpos($frecs[$j], "TARGET_BUILD_DIR") !== false) {
       $execexec='"' . explode("TARGET_BUILD_DIR=", str_replace(' = ','=',$frecs[$j]))[1] . DIRECTORY_SEPARATOR . $projname . '"';
     }
  }
  if ($execexec != "") {
     $sofarcnt++;
     $selis=str_replace("</select>", "<option value='" . $execexec . "'>" . $projname . "</option></select>", str_replace('' . (-1 + $sofarcnt),'' . (0 +  $sofarcnt),$selis));
  }
}
}


echo "<html>
<head>
<title>Xcode project to find executable path - RJM Programming - November, 2026</title>
<style>
  select { background-color: #f0f0f0;  }
  input[id^=\"execexec\"] { background-color: #fadadd;  }
  input[id^=\"argsare\"] { background-color: #d6fffe;  }
</style>
<scr" . "ipt>
  var locpath=location.search.split('locpath=')[1] ? decodeURIComponent(location.search.split('locpath=')[1].split('&')[0]) : '';
  var locargs=location.search.split('locargs=')[1] ? decodeURIComponent(location.search.split('locargs=')[1].split('&')[0]) : '';
  var currow=1;
  var argid='argsare';
  var execid='execexec';

  function displayexec(osel) {
   var wasrowoh='', valsarr=[], tbid='execexec', wastbod='', inpsare=[], inpare=[], inpidare=[];
   if (osel.value.trim() != '') {
    if (document.getElementById('execexec').value == '') {
        document.getElementById('ssdp').style.display='inline-block';
        document.getElementById('ssou').style.display='inline-block';
    }
    if (document.getElementById('execexec').value != '') {
       wasrowoh=document.getElementById('tr' + currow).outerHTML;
       if (currow > 1) {
         tbid='execexec' + currow;
         execid=tbid;
         argid='argsare' + currow;
       }
       currow++;
       inpsare=document.getElementsByTagName('input');
       for (var ii=0; ii<inpsare.length; ii++) {
        if (inpsare[ii].outerHTML.indexOf(' type=\"text\"') != -1) {
         if (inpsare[ii].outerHTML.split('>')[0].indexOf('delay') == -1) {
          inpare.push(inpsare[ii].value);
          inpidare.push(inpsare[ii].id);
         }
        }
       }
       valsarr=wasrowoh.split(' value=\"');
       wastbod=document.getElementById('mytbody').innerHTML;
       //alert(wasrowoh.replace('tr' + eval(-1 + currow), 'tr' + currow).replace('tr' + eval(-1 + currow), 'tr' + currow).replace('tr' + eval(-1 + currow), 'tr' + currow).replace('execexec\"', 'execexec' + currow + '\"').replace('execexec\"', 'execexec' + currow + '\"').replace('execexec' + eval(-1 + currow) + '\"', 'execexec' + currow + '\"').replace('execexec' + eval(-1 + currow) + '\"', 'execexec' + currow + '\"').replace('argsare\"', 'argsare' + currow + '\"').replace('argsare\"', 'argsare' + currow + '\"').replace('argsare' + eval(-1 + currow) + '\"', 'argsare' + currow + '\"').replace('argsare' + eval(-1 + currow) + '\"', 'argsare' + currow + '\"').replace(' value=\"' + valsarr[2].split('\"')[0], ' value=\"').replace(' value=\"' + valsarr[1].split('\"')[0], ' value=\"'));
       document.getElementById('mytbody').innerHTML=wastbod + wasrowoh.replace('tr' + eval(-1 + currow), 'tr' + currow).replace('tr' + eval(-1 + currow), 'tr' + currow).replace('tr' + eval(-1 + currow), 'tr' + currow).replace('execexec\"', 'execexec' + currow + '\"').replace('execexec\"', 'execexec' + currow + '\"').replace('execexec' + eval(-1 + currow) + '\"', 'execexec' + currow + '\"').replace('execexec' + eval(-1 + currow) + '\"', 'execexec' + currow + '\"').replace('argsare\"', 'argsare' + currow + '\"').replace('argsare\"', 'argsare' + currow + '\"').replace('argsare' + eval(-1 + currow) + '\"', 'argsare' + currow + '\"').replace('argsare' + eval(-1 + currow) + '\"', 'argsare' + currow + '\"').replace(' value=\"' + valsarr[2].split('\"')[0], ' value=\"').replace(' value=\"' + valsarr[1].split('\"')[0], ' value=\"');
       for (var iii=0; iii<inpidare.length; iii++) {
         document.getElementById(inpidare[iii]).value=inpare[iii];
       }
       execid='execexec' + currow;
       argid='argsare' + currow;
       document.getElementById(execid).value=osel.value;
       maybeurl(document.getElementById(tbid));
    } else {
       document.getElementById(execid).value=osel.value;
       maybeurl(document.getElementById(execid));
    }
   }
   if (currow == 2) {
     document.getElementById('sdelay').style.visibility='visible';
     document.getElementById('idelay').setAttribute('data-title', document.getElementById('idelay').title);
     document.getElementById('idelay').setAttribute('data-placeholder', document.getElementById('idelay').placeholder);
     setInterval(function(){  if (document.getElementById('idelay').placeholder == document.getElementById('idelay').getAttribute('data-placeholder')) { document.getElementById('idelay').placeholder=document.getElementById('idelay').getAttribute('data-title');  } else {  document.getElementById('idelay').placeholder=document.getElementById('idelay').getAttribute('data-placeholder');   }  }, 10000);
   }
  }
  
  function chkchk(ochk) {
    var wasv=document.getElementById(execid).value;
    var wasav=document.getElementById(argid).value;
    if (ochk.checked) {
       document.getElementById(execid).value='script log.log ' + wasv;
       document.getElementById(argid).value=wasav + ' --flags';
    } else {
       document.getElementById(execid).value=document.getElementById(execid).value.replace(/^script\ log\.log /g,'');
       document.getElementById(argid).value=document.getElementById(argid).value.replace(/\ \-\-flags$/g,'');
    }
  }
  
  function assess(oinp) {
    var wasrowoh='', valsarr=[], tbid='execexec', wastbod='', inpsare=[], inpare=[], inpidare=[];
    if (oinp.value.replace(/^http/g,'').replace(/^\/\//g,'') != oinp.value) {
      if (document.getElementById('execexec').value == '') {
        document.getElementById('ssdp').style.display='inline-block';
        document.getElementById('ssou').style.display='inline-block';
      }
      if (document.getElementById('execexec').value != '') {
       wasrowoh=document.getElementById('tr' + currow).outerHTML;
       if (currow > 1) {
         tbid='execexec' + currow;
         execid=tbid;
         argid='argsare' + currow;
       }
       currow++;
       inpsare=document.getElementsByTagName('input');
       for (var ii=0; ii<inpsare.length; ii++) {
        if (inpsare[ii].outerHTML.indexOf(' type=\"text\"') != -1) {
         inpare.push(inpsare[ii].value);
         inpidare.push(inpsare[ii].id);
        }
       }
       valsarr=wasrowoh.split(' value=\"');
       wastbod=document.getElementById('mytbody').innerHTML;
       //alert(wasrowoh.replace('tr' + eval(-1 + currow), 'tr' + currow).replace('tr' + eval(-1 + currow), 'tr' + currow).replace('tr' + eval(-1 + currow), 'tr' + currow).replace('execexec\"', 'execexec' + currow + '\"').replace('execexec\"', 'execexec' + currow + '\"').replace('execexec' + eval(-1 + currow) + '\"', 'execexec' + currow + '\"').replace('execexec' + eval(-1 + currow) + '\"', 'execexec' + currow + '\"').replace('argsare\"', 'argsare' + currow + '\"').replace('argsare\"', 'argsare' + currow + '\"').replace('argsare' + eval(-1 + currow) + '\"', 'argsare' + currow + '\"').replace('argsare' + eval(-1 + currow) + '\"', 'argsare' + currow + '\"').replace(' value=\"' + valsarr[2].split('\"')[0], ' value=\"').replace(' value=\"' + valsarr[1].split('\"')[0], ' value=\"'));
       document.getElementById('mytbody').innerHTML=wastbod + wasrowoh.replace('tr' + eval(-1 + currow), 'tr' + currow).replace('tr' + eval(-1 + currow), 'tr' + currow).replace('tr' + eval(-1 + currow), 'tr' + currow).replace('execexec\"', 'execexec' + currow + '\"').replace('execexec\"', 'execexec' + currow + '\"').replace('execexec' + eval(-1 + currow) + '\"', 'execexec' + currow + '\"').replace('execexec' + eval(-1 + currow) + '\"', 'execexec' + currow + '\"').replace('argsare\"', 'argsare' + currow + '\"').replace('argsare\"', 'argsare' + currow + '\"').replace('argsare' + eval(-1 + currow) + '\"', 'argsare' + currow + '\"').replace('argsare' + eval(-1 + currow) + '\"', 'argsare' + currow + '\"').replace(' value=\"' + valsarr[2].split('\"')[0], ' value=\"').replace(' value=\"' + valsarr[1].split('\"')[0], ' value=\"');
       for (var iii=0; iii<inpidare.length; iii++) {
         document.getElementById(inpidare[iii]).value=inpare[iii];
       }
       execid='execexec' + currow;
       argid='argsare' + currow;
      }
      if (oinp.value.indexOf('?') != -1) {
      document.getElementById(argid).value='?' + oinp.value.split('?')[1];
      document.getElementById(execid).value=oinp.value.split('?')[0];
      } else if (oinp.value.indexOf('#') != -1) {
      document.getElementById(argid).value='#' + oinp.value.replace(oinp.value.split('#')[0] + '#','');
      document.getElementById(execid).value=oinp.value.split('#')[0];
      } else {
      document.getElementById(execid).value=oinp.value;
      }
      oinp.value='';
      maybeurl(document.getElementById(execid));
    } else {
      oinp.value='';
    }
    if (currow == 2) {
     document.getElementById('sdelay').style.visibility='visible';
     document.getElementById('idelay').setAttribute('data-title', document.getElementById('idelay').title);
     document.getElementById('idelay').setAttribute('data-placeholder', document.getElementById('idelay').placeholder);
     setInterval(function(){  if (document.getElementById('idelay').placeholder == document.getElementById('idelay').getAttribute('data-placeholder')) { document.getElementById('idelay').placeholder=document.getElementById('idelay').getAttribute('data-title');  } else {  document.getElementById('idelay').placeholder=document.getElementById('idelay').getAttribute('data-placeholder');   }  }, 10000);
    }
  }
  
  function maybeurl(oinp) {
    locargs='';
    locpath='';
    if (oinp.value.replace(/^http/g,'').replace(/^\/\//g,'') != oinp.value) {
      document.getElementById('dmurl').innerHTML='<input type=hidden name=isurl id=isurl value=y></input>';
      document.getElementById('ssdp').style.display='inline-block';
      document.getElementById('ssou').style.display='inline-block';
    } else if (oinp.value.trim() != '') {
      document.getElementById('ssdp').style.display='inline-block';
      document.getElementById('ssou').style.display='inline-block';
      locargs=document.getElementById(argid).value;
      locpath=document.getElementById(execid).value;
      document.getElementById('dmurl').innerHTML='';
      " . $undis . "
    }
  }
  
  function maybein() {
    if (locargs != '') {
      document.getElementById('locargs').value=locargs;
    }
    if (locpath != '') {
      document.getElementById(execid).value=locpath;
      maybeurl(document.getElementById(execid));
    }
    locargs='';
    locpath='';
  }
  
  function nameit(oinp) {
    if (oinp.value.trim().replace(/\./g,'').replace(/0/g,'') != '') {
      if (oinp.outerHTML.indexOf(' name=') == -1) {
        oinp.name='' + oinp.id;
      }
    }
  }

</scr" . "ipt>
</head>
<body onload=maybein(); title='URL suffix such as ?startin=/ will scour whole disk rather than just off MAMP Document Root for *.xcodeproj Xcode project files.'>
<h1>Xcode project to find executable path</h1>
<h3>RJM Programming - November, 2026</h3><br><br><table style=width:100%;><tr><th style=width:70%;>Desktop program<span id=ssdp style=display:none;>(s)</span> ... and/or ...</th><th style=width:30%;>Online URL<span id=ssou style=display:none;>(s)</span> ...</th></tr><td style=vertical-align:top;>" . $selis . "</td><td style=vertical-align:top;><input type=url value='' style=width:100%; placeholder='URL ...' value='' onblur=assess(this);></input></td></tr></table><br><br>
<form action=./find_xcode_executable.php method=POST>
<table style=width:100%; border=5><tbody id=mytbody>
<tr><th style=width:80%;>Executable path ... <span id=sdelay style=visibility:hidden;>Delay(s):&nbsp;<input type=text style=width:380px; onblur=nameit(this); id=idelay placeholder='0.0' value='' title='[Between sets delay in seconds].[Between component delay]'></input></span></th><th style=width:20%;>Arguments and/or pipes and/or redirects and/or switches and/or <input onchange=chkchk(this); id=ilog type=checkbox style=visibility:hidden;>Logging</input> ...</th></th></tr>
<tr id=tr1><td id=tr1td1><input style=width:100%; onblur=maybeurl(this); type=text value='' id=execexec name=execexec placeholder='Executable path'></input></td><td id=tr1td2><input style=width:100%; type=text value='' id=argsare name=argsare placeholder='Argument(s)'></input></td></tr>
</tbody></table>
<br><br><div id=dmurl></div><input type=submit style=background-color:yellow;color:blue; value='Execute ...'></input>
</form>
</body>
</html>";
}
?>
