{"id":54990,"date":"2022-02-25T03:01:57","date_gmt":"2022-02-24T17:01:57","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=54990"},"modified":"2022-02-25T06:13:11","modified_gmt":"2022-02-24T20:13:11","slug":"php-calls-windows-batch-genericization-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-batch-genericization-tutorial\/","title":{"rendered":"PHP Calls Windows Batch Genericization Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php?url=https:\/\/google.com\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP Calls Windows Batch Genericization Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url_windows.gif\" title=\"PHP Calls Windows Batch Genericization Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP Calls Windows Batch Genericization Tutorial<\/p><\/div>\n<p>Just to buck our usual trend in a thread of related blog postings we leave alone the title&#8217;s <i>second last word<\/i> of yesterday&#8217;s <a title='PHP Calls macOS Apple Script Genericization Tutorial' href='#phpcosasgt'>PHP Calls macOS Apple Script Genericization Tutorial<\/a> to create today&#8217;s title.  The reason is &#8230;<\/p>\n<ul>\n<li>yesterday&#8217;s genericization was on the client side (external Javascript) of the &#8220;PHP Calls&#8221; (command line opener of a web browser address bar URL in that operating system&#8217;s default web browser) allowing &#8220;parent master callers&#8221; of our <i>external Javascript\/PHP tool<\/i> control aesthetics and positioning (and a rudimentary filter to usage) &#8230; whereas &#8230;<\/li>\n<li>today&#8217;s genericization (turns hardcodings into arguments <font size=4>(but none from me<\/font><font size=3> &#8230; boom<\/font> <font size=2>boom<\/font><font size=1>!<\/font>)<\/font>) affects the server side (PHP) adding Windows operating system client computer support via DOS <a target=_blank title='DOS Batch' href='https:\/\/en.wikipedia.org\/wiki\/Batch_file#:~:text=A%20batch%20file%20is%20a,in%20a%20plain%20text%20file.&#038;text=When%20a%20batch%20file%20is,normally%20line%2Dby%2Dline.'>Batch<\/a> <i><a target=_blank title='DOS start command' href='https:\/\/www.computerhope.com\/starthlp.htm'>start<\/a> URL<\/i> commands (to add to the existent macOS Apple Script <i>open URL<\/i> commands)<\/li>\n<\/ul>\n<p>Some of the genericization checklist (in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php--GETME\" title=\"apple_script_url.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php--GETME\" title=\"apple_script_url.php\">apple_script_url.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php?url=https:\/\/google.com\" title=\"Click picture\">link to a pressing of an Apple Script window Play button to open Google search engine<\/a>, the PHP code for which we want you to download to (the Document Root of) a macOS or Windows <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server environment, ideally, though you can tailor for another macOS local web server arrangement) items went &#8230;<\/p>\n<ol>\n<li>change any operating system folder delimiter <i>\/<\/i> hardcodings should become <a target=_blank title='PHP pre-defined constants' href='https:\/\/www.php.net\/manual\/en\/dir.constants.php'><i>DIRECTORY_SEPARATOR<\/i><\/a><\/li>\n<li>change <i>if (PHP_OS == &#8220;Darwin&#8221;) { &#8230; }<\/i> hardcodings should become <i>if (PHP_OS == &#8220;Darwin&#8221; || PHP_OS == &#8216;WINNT&#8217; || PHP_OS == &#8216;WIN32&#8217; || PHP_OS == &#8216;Windows&#8217;) { &#8230; }<\/i> for combined parts versus <i>if (PHP_OS == &#8216;WINNT&#8217; || PHP_OS == &#8216;WIN32&#8217; || PHP_OS == &#8216;Windows&#8217;) { &#8230; }<\/i> for Windows only versus <i>if (PHP_OS == &#8220;Darwin&#8221;) { &#8230; }<\/i> for macOS only<\/li>\n<li>a lot of the rest of genericizations work because of &#8230;<br \/>\n&lt;?php<br \/>\n<code><br \/>\n$localsug='HTTP:\/\/localhost:8888\/';<br \/>\n<br \/>\nif (PHP_OS == 'WINNT' || PHP_OS == 'WIN32' || PHP_OS == 'Windows') {<br \/>\n  $homename='USERPROFILE';<br \/>\n  $localsug='HTTP:\/\/localhost\/';<br \/>\n  $openverb='start';<br \/>\n  $openext='.bat';<br \/>\n  $tellprefix='';<br \/>\n} else {<br \/>\n  $homename='HOME';<br \/>\n  $openverb='open';<br \/>\n  $openext='.scpt';<br \/>\n  $tellprefix=\"tell application \\\"Terminal\\\"\\n\tactivate\\n\tdo script \\\"cd '\" . getenv($homename) . DIRECTORY_SEPARATOR . 'Desktop' . \"'\\\" in window 1\\n\tdo script \\\"\";<br \/>\n}<br \/>\n<br \/>\nfunction wincomplexity($inurl) {<br \/>\n  if (PHP_OS == 'WINNT' || PHP_OS == 'WIN32' || PHP_OS == 'Windows') {<br \/>\n    $outurl=str_replace('&', '^&', $inurl);<br \/>\n    $huhs=explode(\"'\", $outurl);<br \/>\n    if (sizeof($huhs) &gt;= 3) { return ' ' . $huhs[1];  }<br \/>\n    return explode('\"', $outurl)[0];<br \/>\n  }<br \/>\n  return $inurl;<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;\n<\/li>\n<\/ol>\n<p> &#8230; and as far as <i>localhost<\/i> port decisions go, we cater for two passes of possibilities (in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.js--GETME\" title=\"apple_script_url.js\">a mildly changed &#8220;external Javascript&#8221;<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.js--GETME\" title=\"apple_script_url.js\">apple_script_url.js<\/a>) &#8230;<\/p>\n<ul>\n<li>first pass using <i>localhost<\/i>:8888 &#8230; suiting what we are familiar with in macOS <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server &#8230; and as of today &#8230;<\/li>\n<li>second pass using <i>localhost<\/i> <font size=1>(where the assumed :80 is not needed)<\/font> &#8230; <font color=blue>suiting<\/font> what we are familiar with in Windows <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server usage &#8230;<br \/>\n<code><br \/>\n<font color=blue>var portstr=':8888';<\/font><br \/>\nvar firstloc='HTTP:\/\/localhost<font color=blue>' + portstr + '<\/font>\/';<br \/>\nvar locfound=false;<br \/>\nvar asuwo=null;<br \/>\n<br \/>\nfunction checkasu() {<br \/>\n  if (asuwo.closed) { \/\/ local web server there<br \/>\n    if (!locfound) {<br \/>\n    <font color=blue>if (portstr == '') {<br \/>\n    document.body.innerHTML+='&lt;style&gt; #asue { position:fixed; left:' + defcssleft + '; top:' + defcsstop + '; z-index:99; cursor:pointer; ' + cssoverriders + ' } &lt;\/style&gt;&lt;div onclick=justplayme(); title=\"DOS Batch script snapshot re-execution via Windows Desktop\" id=asue&gt;&#' + emojin + ';&lt;\/div&gt;';<br \/>\n    } else {<\/font><br \/>\n    document.body.innerHTML+='&lt;style&gt; #asue { position:fixed; left:' + defcssleft + '; top:' + defcsstop + '; z-index:99; cursor:pointer; ' + cssoverriders + ' } &lt;\/style&gt;&lt;div onclick=justplayme(); title=\"Apple Script snapshot re-execution via macOS Desktop\" id=asue&gt;&#' + emojin + ';&lt;\/div&gt;';<br \/>\n    <font color=blue>}<\/font><br \/>\n    }<br \/>\n    locfound=true;<br \/>\n    asuwo=null;<br \/>\n  } else {<br \/>\n    <font color=blue>if (!locfound && firstloc != 'HTTP:\/\/localhost\/') {<br \/>\n      portstr='';<br \/>\n      firstloc='HTTP:\/\/localhost' + portstr + '\/';<br \/>\n      asuwo.close();<br \/>\n      asuwo=null;<br \/>\n      asuwo=window.open(firstloc + 'apple_script_url.php?imagetest=apple_script_url_test.jpg','_blank','top=' + deftop + ',left=' + defleft + ',width=50,height=50');<br \/>\n      setTimeout(checkasu, 2000);<br \/>\n    } else {<\/font><br \/>\n      asuwo.close();<br \/>\n      asuwo=null;<br \/>\n    }<br \/>\n    locfound=false;<br \/>\n  }<br \/>\n}<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p>Windows <font size=2>(via DOS<\/font><font size=1> &#8230; shhhhhhh &#8230; it&#8217;s a mute point<\/font><font size=2>)<\/font> usage lessens the stress on your button pressing digits, not needing any Play button additional presses, as Apple Script does.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-batch-genericization-tutorial\/'>PHP Calls Windows Batch Genericization Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcosasgt'>Previous relevant <a target=_blank title='PHP Calls macOS Apple Script Genericization Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-macos-apple-script-genericization-tutorial\/'>PHP Calls macOS Apple Script Genericization Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php?url=https:\/\/google.com\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP Calls macOS Apple Script Genericization Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url_tailored_look.jpg\" title=\"PHP Calls macOS Apple Script Genericization Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP Calls macOS Apple Script Genericization Tutorial<\/p><\/div>\n<p>We often set off an &#8220;integration&#8221; project, and make it work for &#8220;Case 1&#8221; <font size=1>(akin to <a target=_blank title='Mathematical induction information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Mathematical_induction'>Mathematical Induction<\/a> where you prove for &#8220;Case 1&#8221;, then prove for &#8220;Case 2&#8221; and then prove for &#8220;Case n&#8221;)<\/font> and wake up the next day facing what is hard for us, as a programmer, to bear &#8230; hardcodings that many a programmer will want to &#8220;Genericize&#8221; out in favour of &#8220;Arguments&#8221; <font size=1>(but none from me &#8230; tee hee!)<\/font><\/p>\n<p>And so, today&#8217;s task on top of yesterday&#8217;s <a title='PHP Calls macOS Apple Script Integration Tutorial' href='#phpcosasit'>PHP Calls macOS Apple Script Integration Tutorial<\/a>&#8216;s <font size=1>(all important)<\/font> &#8220;proof of <i>integration<\/i> concept&#8221; work, is to &#8220;Genericize&#8221; in terms of user control of the &#8220;emoji button&#8221; look and positioning and sizing (ie. its CSS styling).<\/p>\n<p>Why bother?  Now is the time to ask &#8230; true.  It&#8217;s because we envisage <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.js-GETME\" title=\"apple_script_url.js\">this changed &#8220;external Javascript&#8221;<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.js-GETME\" title=\"apple_script_url.js\">apple_script_url.js<\/a> can be useful as a servant (or <i>child &#8220;tool&#8221;<\/i>) to many and varied masters (or <i>parent &#8220;callers&#8221;<\/i>), and it will be useful to not have too many versions of the tool just displaying the &#8220;emoji button&#8221; differently, but rather, allow the master code be able to control this &#8220;emoji button&#8221; look, but calling on the same source code.  Exemplifying this in today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url_tailored_look.jpg\" title=\"Tutorial picture\">tutorial picture<\/a> <font color=blue>we added<\/font> call arguments in &#8230;<\/p>\n<p>&lt;?php echo &#8221;<br \/>\n<code><br \/>\n&lt;script type='text\/javascript' src='apple_script_url.js<font color=blue>?left=calc(50% - 85px)&top=calc(50% + 80px)&emoji=128220&css=font-size:30px;opacity:0.8;<\/font>'&gt;&lt;\/script&gt;<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<\/p>\n<p> &#8230; to <font color=blue>achieve this<\/font> &#8230;<\/p>\n<p><code><br \/>\n\/\/ apple_script_url.js<br \/>\n\/\/ RJM Programming<br \/>\n\/\/ February, 2022<br \/>\n\/\/ Make apple_script_url.php useful<br \/>\n<br \/>\nvar firstloc='HTTP:\/\/localhost:8888\/';<br \/>\nvar locfound=false;<br \/>\nvar asuwo=null;<br \/>\n<font color=blue>var defleft='' + eval(-30 + eval('' + screen.width));<br \/>\nvar deftop='50';<br \/>\nvar defcssleft='calc(100% - 30px)';<br \/>\nvar defcsstop='50px';<br \/>\nvar cssoverriders='';<br \/>\nvar emojin='128221';<br \/>\nvar mustcontainc=('' + document.URL + '.').substring(0,1);<\/font><br \/>\n<br \/>\nfunction justplayme() {<br \/>\n  if (locfound) {<br \/>\n   <font color=blue>if (('' + document.URL).indexOf(mustcontainc) != -1) { <\/font><br \/>\n    asuwo=window.open(firstloc + 'apple_script_url.php?justplay=y&showothers=y&tsplus=' + encodeURIComponent(document.URL.split('#')[0].replace('HTTP','http').replace(\/\\.\/g,'_').replace(\/\\?\/g,'_').replace(\/\\&\/g,'_').replace(\/\\=\/g,'_').replace(\/\\:\/g,'_').replace(\/\\\/\/g,'_')) + '&url=' + encodeURIComponent(document.URL.split('#')[0]),'_blank','top=50,left=50,width=50,height=50');<br \/>\n    setTimeout(checkasu, 5000);<br \/>\n   <font color=blue>}<\/font><br \/>\n  }<br \/>\n}<br \/>\n<br \/>\nfunction checkasu() {<br \/>\n  if (asuwo.closed) { \/\/ local web server there<br \/>\n    if (!locfound) {<br \/>\n    document.body.innerHTML+='&lt;style&gt; #asue { position:fixed; left:<font color=blue>' + defcssleft + '<\/font>; top:<font color=blue>' + defcsstop + '<\/font>; z-index:99; cursor:pointer; <font color=blue>' + cssoverriders + '<\/font> } &lt;\/style&gt;&lt;div onclick=justplayme(); title=\"Apple Script snapshot re-execution via macOS Desktop\" id=asue&gt;&#<font color=blue>' + emojin + '<\/font>;&lt;\/div&gt;';<br \/>\n    }<br \/>\n    locfound=true;<br \/>\n    asuwo=null;<br \/>\n  } else {<br \/>\n    locfound=false;<br \/>\n    asuwo.close();<br \/>\n    asuwo=null;<br \/>\n  }<br \/>\n}<br \/>\n<br \/>\n<font color=blue>function changethedefaultsmaybe() {<br \/>\n  var defpallette='', thisonepal='', calcpal='', calcper='', icalcper=-1;<br \/>\n  if (document.head.innerHTML.indexOf('apple_s' + 'cript_url.js?') != -1) {<br \/>\n    defpallette=document.head.innerHTML.split('apple_s' + 'cript_url.js?')[1].split('&gt;')[0].split('\"')[0].split(\"'\")[0].replace(\/\\&amp\\;\/g,'&').replace(\/mustcontain\\=\\&$\/g, 'mustcontain=' + encodeURIComponent('&')).replace('mustcontain=&&', 'mustcontain=' + encodeURIComponent('&') + '&').replace('mustcontain=&#', 'mustcontain=' + encodeURIComponent('&') + '#');<br \/>\n    if (defpallette.toLowerCase().indexOf('mustcontain=') != -1) {<br \/>\n      mustcontainc=decodeURIComponent(defpallette.toLowerCase().split('mustcontain=')[1].split('&')[0]);<br \/>\n      if (mustcontainc.trim() == '') { mustcontainc=('' + document.URL + '.').substring(0,1);  }<br \/>\n    }<br \/>\n    if (defpallette.toLowerCase().indexOf('left=') != -1) {<br \/>\n      thisonepal=decodeURIComponent(defpallette.toLowerCase().split('left=')[1].split('&')[0].replace(\/\\%$\/g,'%25').replace(\/\\%\\ \/g,'%25%20').replace(\/\\%\\+\/g,'%25%2b').replace(\/\\%\\-\/g,'%25%2d').replace(\/\\%\\)\/g,'%25%29').replace(\/\\ \/g,'%20').replace(\/\\(\/g,'%28').replace(\/\\)\/g,'%29').replace(\/\\+\/g,'%2b').replace(\/\\-\/g,'%2d'));<br \/>\n      if (thisonepal.indexOf('calc(') != -1 || thisonepal.indexOf('vx') != -1 || thisonepal.indexOf('%') != -1 || thisonepal.indexOf('px') != -1) {<br \/>\n        defcssleft=thisonepal;<br \/>\n        calcpal=thisonepal.replace(\/calc\/g,'').replace(\/px\/g,'').replace(\/vx\/g,'%');<br \/>\n        calcper='';<br \/>\n        if (calcpal.indexOf('%') != -1) { icalcper=eval(-1 + eval('' + calcpal.indexOf('%'))); while (calcpal.substring(icalcper,eval(1 + icalcper)) &gt;= '0' && calcpal.substring(icalcper,eval(1 + icalcper)) &lt;= '9') { calcper=calcpal.substring(icalcper,eval(1 + icalcper)) + calcper; icalcper--;   }  calcpal=calcpal.replace(calcper + '%', '' + eval(eval('' + calcper) * eval('' + screen.width) \/ 100));   }<br \/>\n        calcper='';<br \/>\n        if (calcpal.indexOf('%') != -1) { icalcper=eval(-1 + eval('' + calcpal.indexOf('%'))); while (calcpal.substring(icalcper,eval(1 + icalcper)) &gt;= '0' && calcpal.substring(icalcper,eval(1 + icalcper)) &lt;= '9') { calcper=calcpal.substring(icalcper,eval(1 + icalcper)) + calcper; icalcper--;   }  calcpal=calcpal.replace(calcper + '%', '' + eval(eval('' + calcper) * eval('' + screen.width) \/ 100));   }<br \/>\n        calcper='';<br \/>\n        if (calcpal.indexOf('%') != -1) { icalcper=eval(-1 + eval('' + calcpal.indexOf('%'))); while (calcpal.substring(icalcper,eval(1 + icalcper)) &gt;= '0' && calcpal.substring(icalcper,eval(1 + icalcper)) &lt;= '9') { calcper=calcpal.substring(icalcper,eval(1 + icalcper)) + calcper; icalcper--;   }  calcpal=calcpal.replace(calcper + '%', '' + eval(eval('' + calcper) * eval('' + screen.width) \/ 100));   }<br \/>\n        defleft=eval('' + calcpal);<br \/>\n      }<br \/>\n    }<br \/>\n    if (defpallette.toLowerCase().indexOf('top=') != -1) {<br \/>\n      thisonepal=decodeURIComponent(defpallette.toLowerCase().split('top=')[1].split('&')[0].replace(\/\\%$\/g,'%25').replace(\/\\%\\ \/g,'%25%20').replace(\/\\%\\+\/g,'%25%2b').replace(\/\\%\\-\/g,'%25%2d').replace(\/\\%\\)\/g,'%25%29').replace(\/\\ \/g,'%20').replace(\/\\(\/g,'%28').replace(\/\\)\/g,'%29').replace(\/\\+\/g,'%2b').replace(\/\\-\/g,'%2d'));<br \/>\n      if (thisonepal.indexOf('calc(') != -1 || thisonepal.indexOf('vh') != -1 || thisonepal.indexOf('%') != -1 || thisonepal.indexOf('px') != -1) {<br \/>\n        defcsstop=thisonepal;<br \/>\n        calcpal=thisonepal.replace(\/calc\/g,'').replace(\/px\/g,'').replace(\/vh\/g,'%');<br \/>\n        calcper='';<br \/>\n        if (calcpal.indexOf('%') != -1) { icalcper=eval(-1 + eval('' + calcpal.indexOf('%'))); while (calcpal.substring(icalcper,eval(1 + icalcper)) &gt;= '0' && calcpal.substring(icalcper,eval(1 + icalcper)) &lt;= '9') { calcper=calcpal.substring(icalcper,eval(1 + icalcper)) + calcper; icalcper--;   }  calcpal=calcpal.replace(calcper + '%', '' + eval(eval('' + calcper) * eval('' + screen.height) \/ 100));   }<br \/>\n        calcper='';<br \/>\n        if (calcpal.indexOf('%') != -1) { icalcper=eval(-1 + eval('' + calcpal.indexOf('%'))); while (calcpal.substring(icalcper,eval(1 + icalcper)) &gt;= '0' && calcpal.substring(icalcper,eval(1 + icalcper)) &lt;= '9') { calcper=calcpal.substring(icalcper,eval(1 + icalcper)) + calcper; icalcper--;   }  calcpal=calcpal.replace(calcper + '%', '' + eval(eval('' + calcper) * eval('' + screen.height) \/ 100));   }<br \/>\n        calcper='';<br \/>\n        if (calcpal.indexOf('%') != -1) { icalcper=eval(-1 + eval('' + calcpal.indexOf('%'))); while (calcpal.substring(icalcper,eval(1 + icalcper)) &gt;= '0' && calcpal.substring(icalcper,eval(1 + icalcper)) &lt;= '9') { calcper=calcpal.substring(icalcper,eval(1 + icalcper)) + calcper; icalcper--;   }  calcpal=calcpal.replace(calcper + '%', '' + eval(eval('' + calcper) * eval('' + screen.height) \/ 100));   }<br \/>\n        deftop=eval('' + calcpal);<br \/>\n      }<br \/>\n    }<br \/>\n    if (defpallette.toLowerCase().indexOf('css=') != -1) {<br \/>\n      cssoverriders=decodeURIComponent(defpallette.toLowerCase().split('css=')[1].split('&')[0].replace(\/\\%$\/g,'%25').replace(\/\\%\\ \/g,'%25%20').replace(\/\\%\\+\/g,'%25%2b').replace(\/\\%\\-\/g,'%25%2d').replace(\/\\%\\)\/g,'%25%29').replace(\/\\ \/g,'%20').replace(\/\\(\/g,'%28').replace(\/\\)\/g,'%29').replace(\/\\+\/g,'%2b').replace(\/\\-\/g,'%2d'));<br \/>\n    }<br \/>\n    if (defpallette.toLowerCase().indexOf('emoji=') != -1) {<br \/>\n      emojin=decodeURIComponent(defpallette.toLowerCase().split('emoji=')[1].split('&')[0].replace(\/\\%$\/g,'%25').replace(\/\\%\\ \/g,'%25%20').replace(\/\\%\\+\/g,'%25%2b').replace(\/\\%\\-\/g,'%25%2d').replace(\/\\%\\)\/g,'%25%29').replace(\/\\ \/g,'%20').replace(\/\\(\/g,'%28').replace(\/\\)\/g,'%29').replace(\/\\+\/g,'%2b').replace(\/\\-\/g,'%2d').replace(\/\\,\/g,'%2c').replace(\/\\.\/g,'%2e').replace(\/\\:\/g,'%3a').replace(\/\\;\/g,'%3b')).replace(\/^\\&\\#\/g,'').replace(\/\\;$\/g,'').replace(\/\\,\/g,';&#').replace(\/\\.\/g,';&#');<br \/>\n    }<br \/>\n  }<br \/>\n}<\/font><br \/>\n<br \/>\nif (!navigator.userAgent.match(\/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile\/i)) {<br \/>\n <font color=blue>changethedefaultsmaybe(); <\/font><br \/>\n asuwo=window.open(firstloc + 'apple_script_url.php?imagetest=apple_script_url_test.jpg','_blank','top=<font color=blue>' + deftop + '<\/font>,left=<font color=blue>' + defleft + '<\/font>,width=50,height=50');<br \/>\n setTimeout(checkasu, 2000);<br \/>\n}<br \/>\n<\/code><\/p>\n<p>More integration awaits!<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-macos-apple-script-genericization-tutorial\/'>PHP Calls macOS Apple Script Genericization Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcosasit'>Previous relevant <a target=_blank title='PHP Calls macOS Apple Script Integration Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-macos-apple-script-integration-tutorial\/'>PHP Calls macOS Apple Script Integration Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php?url=https:\/\/google.com\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP Calls macOS Apple Script Integration Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url_parent.jpg\" title=\"PHP Calls macOS Apple Script Integration Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP Calls macOS Apple Script Integration Tutorial<\/p><\/div>\n<p>Building on yesterday&#8217;s <a title='PHP Calls macOS Apple Script Primer Tutorial' href='#phpcosaspt'>PHP Calls macOS Apple Script Primer Tutorial<\/a> we want to integrate yesterday&#8217;s start onto the recent &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/what_is_the_english_word.php------GETME\" title=\"what_is_the_english_word.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/what_is_the_english_word.php------GETME\" title=\"what_is_the_english_word.php\">what_is_the_english_word.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/what_is_the_english_word.php\" title=\"Click picture\">English Word Guessing Game<\/a> up at the RJM Programming public domain<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/start_word_for_wordle_helper.php-----GETME\" title=\"start_word_for_wordle_helper.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/start_word_for_wordle_helper.php-----GETME\" title=\"start_word_for_wordle_helper.php\">start_word_for_wordle_helper.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/start_word_for_wordle_helper.php\" title=\"Click picture\">Start Word for Wordle Suggestions<\/a> up at the RJM Programming public domain<\/li>\n<\/ul>\n<p> &#8230; as macOS (perhaps <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server) &#8220;Intranet style&#8221; integrations using the two lynchpins &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.js_GETME\" title=\"apple_script_url.js\">apple_script_url.js<\/a> external Javascript called (in the integrated PHP above) via &#8230;<br \/>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n&lt;script type='text\/javascript' src='apple_script_url.js'&gt;&lt;\/script&gt;<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<br \/>\n &#8230; just (needed) up at the RJM Programming public domain (perhaps in the same folder as the integrated PHP)<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php-GETME\" title=\"apple_script_url.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php-GETME\" title=\"apple_script_url.php\">apple_script_url.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php?url=https:\/\/google.com\" title=\"Click picture\">link to a pressing of an Apple Script window Play button to open Google search engine<\/a> up at the RJM Programming public domain and we want you to download to (the Document Root of) a macOS <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server environment, ideally, though you can tailor for another macOS local web server arrangement<\/li>\n<\/ul>\n<p> &#8230; leading to a top right &#128221; emoji button accessing these <a target=_blank title='AppleScript information from Apple' href='https:\/\/developer.apple.com\/library\/archive\/documentation\/AppleScript\/Conceptual\/AppleScriptLangGuide\/introduction\/ASLR_intro.html'>Apple Scripts<\/a> saved over at the macOS system&#8217;s &#8220;home Desktop&#8221; folder, ready for ongoing recall and extending.  Is this an <i>intersessional<\/i> (macOS or Mac OS X only) feeling piece of functionality that interests you?  Well, get downloading (and perhaps) tweaking, to find out!<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-macos-apple-script-integration-tutorial\/'>PHP Calls macOS Apple Script Integration Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcosaspt'>Previous relevant <a target=_blank title='PHP Calls macOS Apple Script Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-macos-apple-script-primer-tutorial\/'>PHP Calls macOS Apple Script Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php?url=https:\/\/google.com\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP Calls macOS Apple Script Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.jpg\" title=\"PHP Calls macOS Apple Script Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP Calls macOS Apple Script Primer Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/apple-script-execution-of-start-word-suggestions-for-wordle-tutorial\/' title='Apple Script Execution of Start Word Suggestions for Wordle Tutorial'>Apple Script Execution of Start Word Suggestions for Wordle Tutorial<\/a> struck a chord of interest for us.  Its use of &#8230;<\/p>\n<ul>\n<li>macOS command line via Terminal application &#8230;<\/li>\n<li><a target=_blank title='AppleScript information from Apple' href='https:\/\/developer.apple.com\/library\/archive\/documentation\/AppleScript\/Conceptual\/AppleScriptLangGuide\/introduction\/ASLR_intro.html'>Apple Script<\/a>ing &#8230; and &#8230;<\/li>\n<li>&#8220;open&#8221; command on that command line<\/li.\n<\/ul>\n<p> &#8230; opens the door to an idea we&#8217;ve wondered about before &#8230; perhaps involve multiple web browser &#8220;brands&#8221; in a single &#8230;<\/p>\n<ul>\n<li>web application<\/li>\n<li>command line application<\/li>\n<li>curl web application<\/li>\n<\/ul>\n<p> &#8230; using <font size=1>&#8230; you guessed it &#8230;<\/font> PHP in (what we see as) its 3 modes of use.<\/p>\n<p>Here&#8217;s our first draft of <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php_GETME\">apple_script_url.php<\/a> we want you to download to (the Document Root of) a macOS <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server environment, ideally, though you can tailor for another macOS local web server arrangement, perhaps &#8230;<\/p>\n<p><code><br \/>\n&lt;?php<br \/>\n\/\/ apple_script_url.php<br \/>\n\/\/ RJM Programming<br \/>\n\/\/ February 2022<br \/>\n<br \/>\n$ts=date('_dmY_his', time());<br \/>\n<br \/>\nif (isset($argc)) {<br \/>\n  if (PHP_OS == \"Darwin\") {<br \/>\n    if ($argc &gt;= 2) {<br \/>\n     if (file_exists(getenv('HOME') . '\/Desktop\/MyAppleScript' . $ts . '.scpt')) {<br \/>\n       unlink(getenv('HOME') . '\/Desktop\/MyAppleScript' . $ts . '.scpt');<br \/>\n     }<br \/>\n     file_put_contents(getenv('HOME') . '\/Desktop\/MyAppleScript' . $ts . '.scpt', \"tell application \\\"Terminal\\\"\\n\tactivate\\n\tdo script \\\"cd '\" . getenv('HOME') . '\/Desktop' . \"'\\\" in window 1\\n\tdo script \\\"open '\" . $argv[1] . \"'\\\" in window 1\\nend tell\");<br \/>\n     exec(\"cd \" . getenv('HOME') . '\/Desktop ; open MyAppleScript' . $ts . '.scpt');<br \/>\n    }<br \/>\n  }<br \/>\n} else if (isset($_GET['url'])) {<br \/>\n  if (PHP_OS == \"Darwin\") {<br \/>\n    if (file_exists(getenv('HOME') . '\/Desktop\/MyAppleScript' . $ts . '.scpt')) {<br \/>\n       unlink(getenv('HOME') . '\/Desktop\/MyAppleScript' . $ts . '.scpt');<br \/>\n    }<br \/>\n    file_put_contents(getenv('HOME') . '\/Desktop\/MyAppleScript' . $ts . '.scpt', \"tell application \\\"Terminal\\\"\\n\tactivate\\n\tdo script \\\"cd '\" . getenv('HOME') . '\/Desktop' . \"'\\\" in window 1\\n\tdo script \\\"open '\" . str_replace('+','%20',$_GET['url']) . \"'\\\" in window 1\\nend tell\");<br \/>\n    \/\/exec('open \\\"' . getenv('HOME') . '\/Desktop\/MyAppleScript' . $ts . '.scpt\\\"');<br \/>\n    passthru(\"cd \" . getenv('HOME') . '\/Desktop ; open MyAppleScript' . $ts . '.scpt');<br \/>\n  } else if (strpos($_SERVER['SERVER_NAME'], 'localhost') === false) {<br \/>\n    echo \"&lt;html&gt;&lt;body onload=\\\" window.open('HTTP:\/\/localhost:8888\/apple_script_url.php?url=\" . str_replace('+','%20',$_GET['url']) . \"','_self');  \\\"&gt;&lt;\/body&gt;&lt;\/html&gt;\";<br \/>\n  }<br \/>\n}<br \/>\n?&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; and if you have downloaded, you may get some joy with it calling <a target=_blank title=Google href='https:\/\/google.com'>Google<\/a> into a new web browser arrangement <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url.php?url=https:\/\/google.com\" title=\"Click picture\">via the pressing of an Apple Script window Play button<\/a> &#8230; or &#8230; get to the macOS Terminal prompt and type &#8230;<\/p>\n<p><code><br \/>\nphp \/Applications\/MAMP\/htdocs\/apple_script_url.php https:\/\/google.com<br \/>\n<\/code><\/p>\n<p> &#8230; or &#8230;<\/p>\n<p><code><br \/>\ncurl \"HTTP:\/\/localhost:8888\/apple_script_url.php?url=https:\/\/google.com\"<br \/>\n<\/code><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d54964' onclick='var dv=document.getElementById(\"d54964\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/command-line\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d54964' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d54974' onclick='var dv=document.getElementById(\"d54974\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/external-javascript\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d54974' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d54979' onclick='var dv=document.getElementById(\"d54979\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/argument\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d54979' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d54990' onclick='var dv=document.getElementById(\"d54990\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/windows\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d54990' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Just to buck our usual trend in a thread of related blog postings we leave alone the title&#8217;s second last word of yesterday&#8217;s PHP Calls macOS Apple Script Genericization Tutorial to create today&#8217;s title. The reason is &#8230; yesterday&#8217;s genericization &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-batch-genericization-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,37],"tags":[2419,85,3909,1885,1835,135,181,3913,3912,233,234,281,284,319,341,358,360,385,3606,405,3910,409,1839,2718,2459,614,624,652,714,3914,2178,744,818,3049,2427,932,3915,997,1105,1168,1209,1212,3911,1319,1402,1435],"class_list":["post-54990","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-aesthetics","tag-apache","tag-apple-script","tag-argument","tag-arguments","tag-batch","tag-call","tag-called","tag-caller","tag-command","tag-command-line","tag-css","tag-curl","tag-desktop","tag-display","tag-dos","tag-download","tag-emoji","tag-emoji-button","tag-exec","tag-execute","tag-external-javascript","tag-genericization","tag-genericize","tag-induction","tag-integration","tag-intranet","tag-javascript","tag-local-web-server","tag-look","tag-macos","tag-mamp","tag-ms-dos","tag-open","tag-passthru","tag-php","tag-php_os","tag-programming","tag-script","tag-software-integration","tag-style","tag-styling","tag-terminla","tag-tutorial","tag-web-application","tag-windows"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/54990"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=54990"}],"version-history":[{"count":13,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/54990\/revisions"}],"predecessor-version":[{"id":55003,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/54990\/revisions\/55003"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=54990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=54990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=54990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}