<?php
  // open_extravaganza.php
  // RJM Programming
  // November, 2025
  
  $afteropen='';
  $preret='';
  $ret='';
  $selstuff='';
  $afteropens=[];
  $delim='';
  $thisone=1;
  $wds="\\";
  
  if (PHP_OS == 'Darwin') {
    $selstuff="<br><br><form onsubmit=\"formclickmode=0; document.body.style.cursor='pointer'; if (lastselo) { lastselo.style.cursor='pointer'; lastselo=null; } if (document.getElementById('opsel')) { if (document.getElementById('opsel').value.length > 0) { this.action=document.getElementById('opsel').value;  }   } return true;\" id=myform method=GET action='./open_extravaganza.php'><select title='Right click can modify dropdown choices' style=background-color:yellow; size=15 id=mysel multiple name=afteropen onchange=\"if (this.value.length != 0) { if (1 == 1) { formclickmode=prg(1,event.target); } else { document.getElementById('sbutmac').click(); } } \"><option oncontextmenu=ocmopt(this); value=''>Select macOS open command type(s) below ...</option><option oncontextmenu=ocmopt(this); value=' -a Finder'>Finder</option><option oncontextmenu=ocmopt(this); value=' -a Preview'>Preview</option><option oncontextmenu=ocmopt(this); value=' -a TextEdit'>TextEdit</option><option oncontextmenu=ocmopt(this); value=' -b com.apple.VoiceMemos'>Voice Memo</option><option oncontextmenu=ocmopt(this); value=' -b com.apple.QuickTimePlayerX https://www.rjmprogramming.com.au/Windows/windows_step_recorder.mov'>QuickTime Player</option><option oncontextmenu=ocmopt(this); value=' ~/Desktop/Screen\\ Shot\\ *.png'>Preview all screenshot files</option><option oncontextmenu=ocmopt(this); value=' -a Firefox https://www.rjmprogramming.com.au'>Firefox</option><option oncontextmenu=ocmopt(this); value=' -a Safari http://localhost:8888/macos_say_record.php'>Safari interface attempt to say</option><option oncontextmenu=ocmopt(this); value=' ~/Documents ~/Desktop ~/Downloads'>Open the D folders</option><option oncontextmenu=ocmopt(this); value=' https://google.com'>Google</option><option oncontextmenu=ocmopt(this); value=' https://wikipedia.org'>Wikipedia</option><option oncontextmenu=ocmopt(this); value=' https://www.rjmprogramming.com.au'>RJM Programming</option><option oncontextmenu=ocmopt(this); value='ls -l . | open -f'>Pipe folder listing into TextEdit</option><option oncontextmenu=ocmopt(this); value='x-man-page://open'>Show man page in Terminal</option></select><br><br><input id=sbutmac type=submit value='Execute'></input></form>";
  } else if (substr(strtolower('' . PHP_OS),0,3) == 'win') {
    $selstuff="<br><br><form onsubmit=\"formclickmode=0; document.body.style.cursor='pointer'; if (lastselo) { lastselo.style.cursor='pointer'; lastselo=null; } if (document.getElementById('opsel')) {  if (document.getElementById('opsel').value.length > 0) {  this.action=document.getElementById('opsel').value;   }  } return true;\" id=myform method=GET action='./open_extravaganza.php'><select title='Right click can modify dropdown choices' style=background-color:yellow; size=8 id=mysel multiple name=afteropen onchange=\"if (this.value.length != 0) { if (1 == 1) { formclickmode=prg(-1,event.target); } else { document.getElementById('sbutwin').click(); } } \"><option oncontextmenu=ocmopt(this); value=''>Select Windows explorer.exe command type(s) below ...</option><option oncontextmenu=ocmopt(this); value=' '>File Explorer</option><option oncontextmenu=ocmopt(this); value=' ,'>Explore My Computer</option><option value=' ::{21ec2020-3aea-1069-a2dd-08002b30309d}\::{2227a280-3aea-1069-a2de-08002b30309d}'>Printers folder in Control Panel</option><option value=' /EXPAND,%windir%'>Windows folder</option><option oncontextmenu=ocmopt(this); value=' https://google.com'>Google</option><option oncontextmenu=ocmopt(this); value=' https://wikipedia.org'>Wikipedia</option><option oncontextmenu=ocmopt(this); value=' https://www.rjmprogramming.com.au'>RJM Programming</option></select><br><br><input id=sbutwin type=submit value='Execute'></input></form>";
  } else {
    $selstuff="<br><br><form target=_blank onsubmit=\"formclickmode=0; document.body.style.cursor='pointer'; if (lastselo) { lastselo.style.cursor='pointer'; lastselo=null; } if (document.getElementById('opsel')) { if (document.getElementById('opsel').value.length > 0) { this.action=document.getElementById('opsel').value;  }   } return true;\" id=myformmac method=GET style=display:none; action='http://localhost:8888/open_extravaganza.php'><select title='Right click can modify dropdown choices' multiple style=background-color:yellow; size=15 id=myselmac name=afteropen onchange=\"if (this.value.length != 0) { if (1 == 1) { formclickmode=prg(1,event.target); } else { document.getElementById('sbutmac').click(); }  } \"><option oncontextmenu=ocmopt(this); value=''>Select macOS open command type(s) below ...</option><option oncontextmenu=ocmopt(this); value=' -a Finder'>Finder</option><option oncontextmenu=ocmopt(this); value=' -a Preview'>Preview</option><option oncontextmenu=ocmopt(this); value=' -a TextEdit'>TextEdit</option><option oncontextmenu=ocmopt(this); value=' -b com.apple.VoiceMemos'>Voice Memo</option><option oncontextmenu=ocmopt(this); value=' -b com.apple.QuickTimePlayerX https://www.rjmprogramming.com.au/Windows/windows_step_recorder.mov'>QuickTime Player</option><option oncontextmenu=ocmopt(this); value=' ~/Desktop/Screen\\ Shot\\ *.png'>Preview all screenshot files</option><option oncontextmenu=ocmopt(this); value=' -a Firefox https://www.rjmprogramming.com.au'>Firefox</option><option oncontextmenu=ocmopt(this); value=' -a Safari http://localhost:8888/macos_say_record.php'>Safari interface attempt to say</option><option oncontextmenu=ocmopt(this); value=' ~/Documents ~/Desktop ~/Downloads'>Open the D folders</option><option oncontextmenu=ocmopt(this); value=' https://google.com'>Google</option><option oncontextmenu=ocmopt(this); value=' https://wikipedia.org'>Wikipedia</option><option oncontextmenu=ocmopt(this); value=' https://www.rjmprogramming.com.au'>RJM Programming</option><option oncontextmenu=ocmopt(this); value='ls -l . | open -f'>Pipe folder listing into TextEdit</option><option oncontextmenu=ocmopt(this); value='x-man-page://open'>Show man page in Terminal</option></select><br><br><input id=sbutmac type=submit value='Execute'></input></form>";
    $selstuff.="<br><br><form target=_blank onsubmit=\"formclickmode=0; document.body.style.cursor='pointer'; if (lastselo) { lastselo.style.cursor='pointer'; lastselo=null; } if (document.getElementById('opsel')) {  if (document.getElementById('opsel').value.length > 0) {  this.action=document.getElementById('opsel').value;   }  } return true;\" id=myformwin method=GET style=display:none; action='http://localhost/open_extravaganza.php'><select title='Right click can modify dropdown choices' multiple style=background-color:yellow; size=4 id=myselwin name=afteropen onchange=\"if (this.value.length != 0) { if (1 == 1) { formclickmode=prg(-1,event.target); } else { document.getElementById('sbutwin').click(); }  } \"><option oncontextmenu=ocmopt(this); value=''>Select Windows explorer.exe command type(s) below ...</option><option oncontextmenu=ocmopt(this); value=' '>File Explorer</option><option oncontextmenu=ocmopt(this); value=' https://google.com'>Google</option><option oncontextmenu=ocmopt(this); value=' https://wikipedia.org'>Wikipedia</option><option oncontextmenu=ocmopt(this); value=' https://www.rjmprogramming.com.au'>RJM Programming</option></select><br><br><input id=sbutwin type=submit value='Execute'></input></form>";
  }
  
  if (isset($_GET['afteropen'])) {
    if (sizeof(explode('afteropen=', '?' . $_SERVER['QUERY_STRING'])) > 2) {
    for ($thisone=1; $thisone<sizeof(explode('afteropen=', '?' . $_SERVER['QUERY_STRING'])); $thisone++) {
    array_push($afteropens, str_replace('+',' ',urldecode(explode('#',explode('&',explode('afteropen=', $_SERVER['QUERY_STRING'])[$thisone])[0])[0])));
    }
    } else {
    $afteropen=(trim(str_replace('+',' ',urldecode($_GET['afteropen']))) == '' ? '' : ' ' . trim(str_replace('+',' ',urldecode($_GET['afteropen']))));
    $afteropens=[$afteropen];
    }
  } else if (isset($_POST['afteropen'])) {
    if (sizeof(explode('afteropen=', '?' . $_SERVER['QUERY_STRING'])) > 2) {
    for ($thisone=1; $thisone<sizeof(explode('afteropen=', '?' . $_SERVER['QUERY_STRING'])); $thisone++) {
    array_push($afteropens, str_replace('+',' ',urldecode(explode('#',explode('&',explode('afteropen=', $_SERVER['QUERY_STRING'])[$thisone])[0])[0])));
    }
    } else {
    $afteropen=(trim(str_replace('+',' ',urldecode($_POST['afteropen']))) == '' ? '' : ' ' . trim(str_replace('+',' ',urldecode($_POST['afteropen']))));
    $afteropens=[$afteropen];
    }
  } 
  
  for ($i=0; $i<sizeof($afteropens); $i++) {
  $afteropen=$afteropens[$i];
  if ($afteropen != '' || isset($_GET['afteropen']) || isset($_POST['afteropen'])) {
   if (PHP_OS == 'Darwin') {
    if (strpos($afteropen, ' open ') === false) {
    $preret.=$delim . 'open' . $afteropen;
    } else {
    $preret.=$delim . '' . $afteropen;
    }
    if (($i + 1) == sizeof($afteropens)) {
    $ret=shell_exec($preret);
    $preret.="\n";
    }
   } else if (substr(strtolower('' . PHP_OS),0,3) == 'win') {
    if (strpos($afteropen, ' explorer. ') === false) {
    $preret.=$delim . 'explorer.exe' . $afteropen . '';
    } else {
    $preret.=$delim . '' . $afteropen;
    }
    if (($i + 1) == sizeof($afteropens)) {
    if (1 == 1) {
    $fp = fopen(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bxt', 'x');
    fwrite($fp, str_replace(" ; ", "\n", $preret) . "\nerase " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat');
    fclose($fp);
    } else if (4 == 7) {
    $fp = fopen(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat', 'x');
    fwrite($fp, str_replace(" ; ", "\n", $preret) . "\nerase " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat');
    fclose($fp);
    } else {
    file_put_contents(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat', str_replace(" ; ", "\n", $preret) . "\nerase " . str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat');
    }
    try {
    if (file_exists(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat')) {
    $ret=shell_exec(str_replace("/",$wds,$_SERVER['DOCUMENT_ROOT']) . $wds . 'open_extravaganza.bat');
    }
    } catch (Exception $e) {
    }  
  //passthru($preret);
//$descriptorspec = [STDIN, STDOUT, STDOUT];
//$cmd = $preret;
//$proc = proc_open($cmd, $descriptorspec, $pipes);
//$ret = fread($pipes[1], 1024);
//$ret .= fread($pipes[2], 1024);

//fclose($pipes[0]);
//fclose($pipes[1]);
//fclose($pipes[2]);

//proc_close($proc);
    //$ret=shell_exec($preret);
    //system($preret, $ret);
 //$file = popen($preret,"r");
 //some code to be executed
 //pclose($file);
   $preret.="\n";
    }
   }
  }
  $delim=' ; ';
  }
  
  $afteropens=[];
  $delim='';
  $thisone=1;

  if ($preret == '' && strpos($_SERVER['SERVER_NAME'], 'rjmprogramming.com.au') !== false) {
    $selstuff=str_replace('POST', 'GET', $selstuff);
    $preret=" <select size=3 title=\"Double click (while set to MAMP) to go to Apache/PHP/MySql MAMP local web server webpage\" ondblclick=\"window.open('//www.mamp.info','_blank');\" data-oncontextmenu=\"window.open('//www.mamp.info','_blank');\" id=opsel onchange=\"if (this.value.length > 0) { wo=window.open(this.value,'_blank','top=0,left=0,width=' + screen.width + ',height=' + screen.height);  }\"><option id=omamp value='' selected>MAMP</option><option id=omacos oncontextmenu=macportchange(this); value='http://localhost:8888/open_extravaganza.php' title='Right click to peruse Apache (perhaps macOS MAMP) port assumption'>macOS</option><option id=owindows oncontextmenu=winportchange(this); value='http://localhost/open_extravaganza.php' title='Right click to peruse Apache (perhaps Windows MAMP) port assumption'>Windows</option></select>";
  }
  
echo "<!doctype HTML>
<html>
<head>
<title>Local Operating System Menu</title>
<meta charset=\"UTF-8\">
<scri" . "pt type=text/javascript>
    var wo=null;
    var formclickmode=0;
    var lastselo=null, aptselo=null, aptformo=null;
    var macosport=':8888', winport='';
    var gmacosport=' ', gwinport=' ';
    
     function macportchange(opto) {
     var spare='';
     var newidea=null;
     if (gmacosport != ' ') {
     newidea=gmacosport.trim();
     gmacosport=' ';
     } else {
     event.stopPropagation();
     newidea=prompt('Change the macOS Apache (perhaps MAMP) port as required?', macosport);
     }
     if (newidea == null) { return ''; }
     if (newidea == macosport) { return ''; }
     var jf=0, formos=document.getElementsByTagName('form');
     if (newidea.trim() != '' && newidea.substring(0,1) != ':') { spare=':' + newidea.trim();  } else {  spare=newidea.trim(); }
     if (macosport != spare) {
           for (jf=0; jf<formos.length; jf++) {
             if (('' + formos.action).indexOf('localhost' + macosport + '/') != -1) {
                formos.action=formos.action.replace('localhost' + macosport + '/', 'localhost' + spare + '/');
             }
           }  
     }
     if (newidea.trim() != '' && newidea.substring(0,1) != ':') { macosport=':' + newidea.trim();  } else {  macosport=newidea.trim(); }
     try {
          window.localStorage.removeItem('open_extravaganza_macport');
     } catch(weeeeeeee) {  }    
     try {
          window.localStorage.setItem('open_extravaganza_macport', encodeURIComponent(macosport));
     } catch(veeeeeeee) {  }  
     return '';  
     }
    
     function winportchange(opto) {
     var spare='';
     var newidea=null;
     if (gwinport != ' ') {
     newidea=gwinport.trim();
     gwinport=' ';
     } else {
     event.stopPropagation();
     newidea=prompt('Change the Windows Apache (perhaps MAMP) port as required?', winport);
     }
     if (newidea == null) { return ''; }
     if (newidea == winport) { return ''; }
     var jf=0, formos=document.getElementsByTagName('form');
     if (newidea.trim() != '' && newidea.substring(0,1) != ':') { spare=':' + newidea.trim();  } else {  spare=newidea.trim(); }
     if (winport != spare) {
           for (jf=0; jf<formos.length; jf++) {
             if (('' + formos.action).indexOf('localhost' + winport + '/') != -1) {
                formos.action=formos.action.replace('localhost' + winport + '/', 'localhost' + spare + '/');
             }
           }  
     }
     if (macosport != ':8888') {
           for (jf=0; jf<formos.length; jf++) {
             if (('' + formos.action).indexOf('localhost:8888/') != -1) {
                formos.action=formos.action.replace(':8888/', macosport + '/');
             }
           }  
     }
     if (newidea.trim() != '' && newidea.substring(0,1) != ':') { winport=':' + newidea.trim();  } else {  winport=newidea.trim(); }
     try {
          window.localStorage.removeItem('open_extravaganza_winport');
     } catch(ueeeeeeee) {  }    
     try {
          window.localStorage.setItem('open_extravaganza_winport', encodeURIComponent(winport));
     } catch(teeeeeeee) {  }    
     return '';
     }
    
    function ocmopt(opto) {
      var remem=false;
      var vis=prompt('Change value#wording? ' + String.fromCharCode(10) + ' Start with a + to add the entry. ' + String.fromCharCode(10) + ' Just - forgets this option. ' + String.fromCharCode(10) + ' Ends with three blanks to remember for next time. ' + String.fromCharCode(10) + ' Ends with two blanks unremembers.', (opto.value + '#' + opto.innerText));
      if (vis == null) { return '';   }
      var hp=eval(1 + eval('' + vis.indexOf('#')));
      if (vis == '') { return '';   }
      if (vis == (opto.value + '#' + opto.innerText)) { return '';   }
      if (vis.replace(/\ \ \ $/g,'') != vis) { 
        remem=true; 
        vis=vis.replace(/\ \ \ $/g,''); 
        try {
          window.localStorage.removeItem('open_extravaganza_selectih');
        } catch(eeeeeee) {  }    
      } else if (vis.replace(/\ \ $/g,'') != vis) {
        try {
          window.localStorage.removeItem('open_extravaganza_selectih');
        } catch(eeeeee) {  }    
      }
      if (vis == '  ') { location.href=document.URL.split('?')[0].split('#')[0]; vis=''; return '';   }
      if (vis == '-') {
      opto.value='';
      opto.innerHTML='';
      } else if (vis.substring(0,1) == '+') {
      if (vis.indexOf('#') != -1) { aptselo.innerHTML+='<option oncontextmenu=ocmopt(this); value=\"' + ' ' + vis.substring(1).split('#')[0] + '\">' + vis.substring(hp) + '</option>'; aptselo.size='' + eval(1 + eval('' + aptselo.size));  } else {  aptselo.innerHTML+='<option oncontextmenu=ocmopt(this); value=\"' + ' ' + vis.substring(1).split('#')[0] + '\">...</option>';  aptselo.size='' + eval(1 + eval('' + aptselo.size));    }
      } else {
      opto.value=' ' + vis.split('#')[0];
      if (vis.indexOf('#') != -1) { opto.innerHTML=vis.substring(hp);   }
      }
      aptformo.action=('' + aptformo.action).split('#') + '#' + encodeURIComponent(aptselo.innerHTML);
      if (remem) {
        try {
          window.localStorage.setItem('open_extravaganza_selectih', encodeURIComponent(aptselo.innerHTML));
        } catch(eeeeeeee) {  }    
      }
      return '';
    }
    
    function fcm() {
      if (formclickmode == 0) {
        formclickmode=0;
      } else if (formclickmode < 0) {
        formclickmode--;
        if (formclickmode <= -10) {
          document.body.style.cursor='pointer';
          if (lastselo) { lastselo.style.cursor='pointer'; lastselo=null; }
          formclickmode=0;
          document.getElementById('sbutwin').click();
        }
      } else {
        formclickmode++;
        if (formclickmode >= 10) {
          document.body.style.cursor='pointer';
          if (lastselo) { lastselo.style.cursor='pointer'; lastselo=null; }
          formclickmode=0;
          document.getElementById('sbutmac').click();
        }
      }
    }
    
    function mostlikely() {
     var spare='';
     try {
          spare=('' + window.localStorage.getItem('open_extravaganza_macport'));
          if (spare != 'null' && spare != 'undefined') {
          macosport=decodeURIComponent(window.localStorage.getItem('open_extravaganza_macport'));
          }
     } catch(zeeeeeeee) {  }    
     try {
          spare=('' + window.localStorage.getItem('open_extravaganza_winport'));
          if (spare != 'null' && spare != 'undefined') {
          winport=decodeURIComponent(window.localStorage.getItem('open_extravaganza_winport'));
          }
     } catch(yeeeeeeee) {  }    
     if (document.getElementById('opsel')) {
      if (('' + navigator.platform).toLowerCase().indexOf('mac') != 0) {
        if (('' + navigator.platform).toLowerCase().indexOf('win') != -1) {
        if (document.getElementById('myformwin')) {
          document.getElementById('myformwin').style.display='block';
          aptselo=document.getElementById('myselwin');
          aptformo=document.getElementById('myformwin');
        }
        }
        document.getElementById('opsel').innerHTML=document.getElementById('omamp').outerHTML + document.getElementById('owindows').outerHTML + document.getElementById('omacos').outerHTML;
      } else {
        if (document.getElementById('myformmac')) {
          document.getElementById('myformmac').style.display='block';
          aptselo=document.getElementById('myselmac');
          aptformo=document.getElementById('myformmac');
        }
      }
     }
     spare='';
     if (aptselo == null) {  aptselo=document.getElementById('mysel');  aptformo=document.getElementById('myform'); }
     if (('' + location.hash).replace(/^undefined/g,'').replace(/^null/g,'').replace(/^\#/g,'').trim() != '') {
        if (decodeURIComponent(('' + location.hash).replace(/^undefined/g,'').replace(/^null/g,'').replace(/^\#/g,'')).indexOf('<option') != -1) {
           if (decodeURIComponent(('' + location.hash).replace(/^undefined/g,'').replace(/^null/g,'').replace(/^\#/g,'')).indexOf('<option') > 0) {
             spare=decodeURIComponent(('' + location.hash).replace(/^undefined/g,'').replace(/^null/g,'').replace(/^\#/g,'')).split('<option')[0].trim();
             if (spare.indexOf('macport') != -1) {
               macosport=spare.split('macport')[1].split(' ')[0].split('winport')[0].replace(/^\=/g,'');
          //alert(245);
     try {
          window.localStorage.removeItem('open_extravaganza_macport');
     } catch(weeeeeeee) {  }    
     try {
          window.localStorage.setItem('open_extravaganza_macport', encodeURIComponent(macosport));
     } catch(veeeeeeee) {  }    
             }
             if (spare.indexOf('winport') != -1) {
               winport=spare.split('winport')[1].split(' ')[0].split('macport')[0].replace(/^\=/g,'');
     try {
          window.localStorage.removeItem('open_extravaganza_winport');
     } catch(ueeeeeeee) {  }    
     try {
          window.localStorage.setItem('open_extravaganza_winport', encodeURIComponent(winport));
     } catch(teeeeeeee) {  }    
             }
           }
           aptselo.innerHTML=decodeURIComponent(('' + location.hash).replace(/^undefined/g,'').replace(/^null/g,'').replace(/^\#/g,'')).substring(decodeURIComponent(('' + location.hash).replace(/^undefined/g,'').replace(/^null/g,'').replace(/^\#/g,'')).indexOf('<option'));
           aptselo.size='' + eval(-1 + eval('' + aptselo.innerHTML.split('</option').length));
           aptformo.action=('' + aptformo.action).split('#') + '#' + encodeURIComponent(aptselo.innerHTML);
        }
     } else {
        try {
          var selih='' + decodeURIComponent('' + window.localStorage.getItem('open_extravaganza_selectih'));
          if (selih.indexOf('<option') != -1) {
           aptselo.innerHTML=selih;
           aptselo.size='' + eval(-1 + eval('' + aptselo.innerHTML.split('</option').length));
           aptformo.action=('' + aptformo.action).split('#') + '#' + encodeURIComponent(aptselo.innerHTML);
          }
        } catch(eeeeee) {  }    
     }
     
     if (document.URL.indexOf('localhost') != -1) {
      if (('' + navigator.platform).toLowerCase().indexOf('mac') != 0) {
        if (('' + navigator.platform).toLowerCase().indexOf('win') != -1) {
        if (document.URL.indexOf('localhost' + winport + '/') == -1) {
          gwinport=document.URL.split('localhost')[1].split('/')[0];
          winportchange(null);
        }
        }
      } else {
        if (document.URL.indexOf('localhost' + macosport + '/') == -1) {
          gmacosport=document.URL.split('localhost')[1].split('/')[0];
          macportchange(null);
        }
      }
     }
     
     var jf=0, formos=document.getElementsByTagName('form');
     if (winport != '') {
           for (jf=0; jf<formos.length; jf++) {
             if (('' + formos.action).indexOf('localhost/') != -1) {
                formos.action=formos.action.replace('localhost/', 'localhost' + winport + '/');
             }
           }  
     }
     if (macosport != ':8888') {
           for (jf=0; jf<formos.length; jf++) {
             if (('' + formos.action).indexOf('localhost:8888/') != -1) {
                formos.action=formos.action.replace(':8888/', macosport + '/');
             }
           }  
     }
    }
    
    function prg(wht, selo) {
      if (selo) { lastselo=selo; lastselo.style.cursor='progress'; }
      document.body.style.cursor='progress';
      return wht;
    }



  function doemail(inemis) {
    var arrinput=[], karr=0;
    var huhhash='youllneverfindthis';
    wasdb='';
    suffis='';
    var anchor=null, xmore=''; 
    var emis='';
    if (('' + aptformo.action).indexOf('#') != -1) { xmore='  Add three spaces at the end to ignore the dropdown option changes you have made in terms of what the recipient sees.'; }
    if (('' + inemis).replace(/^undefined/g,'').replace(/^null/g,'') != '') {
      emis=inemis;
    } else {
      emis=prompt('Please enter email address to send to.' + xmore, '');
    }
    if (emis == null) { emis=''; } 
    if (emis.replace(/\ \ \ $/g,'') != emis) {  emis=emis.replace(/\ \ \ $/g,''); huhhash='#'; }
    if (emis.indexOf('@') != -1) {
                anchor = document.createElement('a');
                if (emis.trim() == emis.trim().toUpperCase()) {
                anchor.href = 'mailto:' + nosq(emis.trim()) + '?subject=My%20Local%20Desktop%20Functionality%20Menu' + (inemis == '' ? '' : encodeURIComponent(' ' + inemis.replace('#',','))) + '&body=' + encodeURIComponent(aptformo.action.split(huhhash)[0]);
                } else {
                anchor.href = 'mailto:' + nosq(emis.trim()) + '?subject=My%20Local%20Desktop%20Functionality%20Menu' + (inemis == '' ? '' : encodeURIComponent(' ' + inemis.replace('#',','))) + '&body=' + encodeURIComponent(aptformo.action.split(huhhash)[0]);
                }
                anchor.style.display='none';
                document.body.appendChild(anchor);
                anchor.innerHTML='Email';
                anchor.target='_top';
                anchor.click();
    } else if (emis.trim() != '' && emis.trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
                anchor = document.createElement('a');
                anchor.href = 'sms:' + nosq(emis.trim()) + '&body=' + encodeURIComponent(aptformo.action.split(huhhash)[0]); 
                anchor.style.display='none';
                anchor.innerHTML='SMS';
                anchor.target='_top';
                anchor.click();
    }
  }
 
  function dosms(inemis) {
    var arrinput=[], karr=0;
    var huhhash='youllneverfindthis';
    wasdb='';
    suffis='';
    var anchor=null, xmore='';
    var emis='';
    if (('' + aptformo.action).indexOf('#') != -1) { xmore='  Add three spaces at the end to ignore the dropdown option changes you have made in terms of what the recipient sees.'; }
    if (('' + inemis).replace(/^undefined/g,'').replace(/^null/g,'') != '') {
      emis=inemis;
    } else {
      emis=prompt('Please enter SMS number to send to.' + xmore, '');
    }
    if (emis == null) { emis=''; }
    if (emis.replace(/\ \ \ $/g,'') != emis) {  emis=emis.replace(/\ \ \ $/g,''); huhhash='#'; }
    if (emis.indexOf('@') != -1) {
                anchor = document.createElement('a');
                if (emis.trim() == emis.trim().toUpperCase()) {
                anchor.href = 'mailto:' + nosq(emis.trim()) + '?subject=My%20Local%20Desktop%20Functionality%20Menu' + (inemis == '' ? '' : encodeURIComponent(' ' + inemis.replace('#',','))) + '&body=' + encodeURIComponent(aptformo.action.split(huhhash)[0]);
                } else {
                anchor.href = 'mailto:' + nosq(emis.trim()) + '?subject=My%20Local%20Desktop%20Functionality%20Menu' + (inemis == '' ? '' : encodeURIComponent(' ' + inemis.replace('#',','))) + '&body=' + encodeURIComponent(aptformo.action.split(huhhash)[0]);
                }
                anchor.style.display='none';
                document.body.appendChild(anchor);
                anchor.innerHTML='Email';
                anchor.target='_top';
                anchor.click();
    } else if (emis.trim() != '' && emis.trim().replace(/0/g,'').replace(/1/g,'').replace(/2/g,'').replace(/3/g,'').replace(/4/g,'').replace(/5/g,'').replace(/6/g,'').replace(/7/g,'').replace(/8/g,'').replace(/9/g,'') == '') {
                anchor = document.createElement('a');
                anchor.href = 'sms:' + nosq(emis.trim()) + '&body=' + encodeURIComponent(aptformo.action.split(huhhash)[0]);
                anchor.style.display='none';
                anchor.innerHTML='SMS';
                anchor.target='_top';
                anchor.click();
    }
  }

    function nosq(inq) {
      return inq;
    }
    
    setInterval(fcm, 1000);
</scri" . "pt>
<style>
 p {
   background-color: orange;
 }
</style>
</head>
<body onload=mostlikely();><h1>Local Operating System " . explode(' ',$preret)[0] . " Menu </h1><h2>RJM Programming</h2><h3>November, 2025 <button onclick=\"setTimeout(function(){ doemail(''); }, 2000);\" id=butemail>Email &#128231;</button>&nbsp;&nbsp;<button onclick=\"setTimeout(function(){ dosms(''); }, 2000);\" id=butsms>SMS &#128223;</button></h3><h4>Thanks to <a target=bank tite='https://scriptingosx.com/2017/02/the-macos-open-command/' href='//scriptingosx.com/2017/02/the-macos-open-command/'>https://scriptingosx.com/2017/02/the-macos-open-command/</a></h4><br><p>" . str_replace("\n","<br>",$preret) . str_replace("\n","<br>",$ret) . "</p>" . $selstuff . "</body>
</html>";
?>
