{"id":55028,"date":"2022-02-28T03:01:29","date_gmt":"2022-02-27T17:01:29","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=55028"},"modified":"2022-02-27T13:25:23","modified_gmt":"2022-02-27T03:25:23","slug":"php-calls-windows-and-macos-nimh-game-integration-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-and-macos-nimh-game-integration-tutorial\/","title":{"rendered":"PHP Calls Windows and macOS Nimh Game Integration Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Gmaes\/Nimh\/\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP Calls Windows and macOS Nimh Game Integration Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/nimh-game-integration-of-url-recall.gif\" title=\"PHP Calls Windows and macOS Nimh Game Integration Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP Calls Windows and macOS Nimh Game Integration Tutorial<\/p><\/div>\n<p>On top of yesterday&#8217;s <a title='PHP Calls Windows and macOS Gimp Guillotine Follow Up Tutorial' href='#phpcwosggfut'>PHP Calls Windows and macOS Gimp Guillotine Follow Up Tutorial<\/a>&#8216;s progress with our &#8220;PHP Calls Windows (DOS Batch) and macOS (Apple Script) URL Recall&#8221; tool integrations, today &#8230;<\/p>\n<ul>\n<li>improving a filename length issue integrating with our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Gmaes\/Nimh\/\" title=\"Click picture\">Nimh game<\/a> &#8230; and also &#8230;<\/li>\n<li>add some sharing &#8220;double click&#8221; logic for &#8230;\n<ol>\n<li>email via the default email client application, where body content is the same URL link we are interested in with Apple Script or DOS Batch interfacing &#8230; or &#8230;<\/li>\n<li>SMS via the default SMS client application, <font color=blue>if clicking the bottom right part<\/font> of the &#8220;emoji button&#8221; in an &#8220;a&#8221; element, as per &#8230;<br \/>\n<code><br \/>\nfunction postplayme() {<br \/>\n     var aois=document.getElementById('asue');<br \/>\n     aois.title='Now email off this URL link.  ' + '' + aois.title;<br \/>\n     aois.href='mailto:?subject=Email%20URL%20Snapshot%20%2e%2e%2e&body=' + encodeURIComponent(document.URL.split('#')[0]);<br \/>\n     aois.target='_top';<br \/>\n}<br \/>\n<br \/>\nfunction justplayme(aoisev) {<br \/>\n  var aax=0, aay=0, aarect=null, vsx=0, vsy=0, recipt='';<br \/>\n  if (locfound) {<br \/>\n   <font color=blue>var aois=aoisev.target;<br \/>\n   if (('' + document.URL).indexOf(mustcontainc) != -1 && aois.title.indexOf(' ... ') == -1) {<br \/>\n   if (('' + aois.href).replace(\/^null\/g,'') == '') {<br \/>\n     if (aoisev.clientX) {<br \/>\n        aax = aoisev.clientX;<br \/>\n        aay = aoisev.clientY;<br \/>\n     } else {<br \/>\n        aax = aoisev.pageX;<br \/>\n        aay = aoisev.pageY;<br \/>\n     }<br \/>\n     aarect=aois.getBoundingClientRect();<br \/>\n     vsx=eval(eval('' + aarect.left) + eval(eval('' + aarect.width) * 0.70));<br \/>\n     vsy=eval(eval('' + aarect.top) + eval(eval('' + aarect.height) * 0.70));<br \/>\n     \/\/if (eval('' + aax) &gt;= vsx) { alert('X is SMS aay=' + aay + ' should be greater than vsy=' + vsy + ' aarect.bottom=' + aarect.bottom + ' aarect.top=' + aarect.top + ' aarect.height=' + aarect.height); }<br \/>\n     \/\/if (eval('' + aay) &gt;= vsy) { alert('Y is SMS'); }<br \/>\n     if (eval('' + aax) &gt;= vsx && eval('' + aay) &gt;= vsy) {<\/font><br \/>\n     recipt=prompt('Enter SMS or email address to send to.', '');<br \/>\n     if (recipt == null) { recipt=''; }<br \/>\n     if (recipt.trim() != '') {<br \/>\n     if (recipt.trim().indexOf('@') &gt; 0) {<br \/>\n     aois.title='Now email off this URL link ... ' + '' + aois.title;<br \/>\n     aois.href='mailto:' + recipt.trim() + '?subject=Email%20URL%20Snapshot%20%2e%2e%2e&body=' + encodeURIComponent(document.URL.split('#')[0]);<br \/>\n     aois.target='_top';<br \/>\n     aois.click();<br \/>\n     } else if (recipt.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,'') == '') {<br \/>\n     aois.title='Now SMS off this URL link ... ' + '' + aois.title;<br \/>\n     aois.href='sms:' + recipt.trim() + '&body=' + encodeURIComponent(document.URL.split('#')[0]);<br \/>\n     aois.target='_top';<br \/>\n     aois.click();<br \/>\n     }<br \/>\n     }<br \/>\n     } else {<br \/>\n     setTimeout(postplayme, 2000);<br \/>\n     \/\/aois.title='Now email off this URL link.  ' + '' + aois.title;<br \/>\n     \/\/aois.href='mailto:?subject=Email%20URL%20Snapshot%20%2e%2e%2e&body=' + encodeURIComponent(document.URL.split('#')[0]);<br \/>\n     \/\/aois.target='_top';<br \/>\n     }<br \/>\n   \/\/if (document.URL.indexOf('why=') != -1) {<br \/>\n   \/\/ asuwo=window.open(firstloc + 'apple_script_url.php?justplay=y&showothers=y&tsplus=' + encodeURIComponent(document.URL.split('#')[0].split('&blurb=Sorry')[0].replace('HTTP','http').replace(\/\\.\/g,'_').replace(\/\\?\/g,'_').replace(\/\\&\/g,'_').replace(\/\\=\/g,'_').replace(\/\\:\/g,'_').replace(\/\\\/\/g,'_').replace(\/\\,\/g,'_').replace(\/\\[\/g,'_').replace(\/\\]\/g,'_').replace(\/\\~\/g,'_').replace(\/\\`\/g,'_')).replace(\/\\%20\/g,'_').replace(\/\\+\/g,'_') + '&url=' + encodeURIComponent(document.URL.split('#')[0].split('&blurb=Sorry')[0]),'_blank','top=50,left=50,width=500,height=500');<br \/>\n   \/\/ setTimeout(checkasu, 35000);<br \/>\n   \/\/} else {<br \/>\n    if (nothingis != '') {<br \/>\n    documentURL=document.URL;<br \/>\n    while (documentURL.indexOf(nothingis) != -1) {<br \/>\n      documentURL=documentURL.replace(nothingis,'');<br \/>\n    }<br \/>\n    asuwo=window.open(firstloc + 'apple_script_url.php?justplay=y&nothing=' + encodeURIComponent(nothingis) + '&showothers=y&tsplus=' + encodeURIComponent(documentURL.split('#')[0].split('&blurb=Sorry')[0].replace('HTTP','http').replace(\/\\.\/g,'_').replace(\/\\?\/g,'_').replace(\/\\&\/g,'_').replace(\/\\=\/g,'_').replace(\/\\:\/g,'_').replace(\/\\\/\/g,'_').replace(\/\\,\/g,'_').replace(\/\\[\/g,'_').replace(\/\\]\/g,'_').replace(\/\\~\/g,'_').replace(\/\\`\/g,'_').replace(\/\\%\\)\/g,'__').replace(\/\\(\/g,'_').replace(\/\\)\/g,'_').replace(\/\\\/\/g,'_').replace(\/\\{\/g,'_').replace(\/\\}\/g,'_').replace(\/\\:\/g,'_').replace(\/\\*\/g,'_').replace(\/\\$\/g,'_').replace(\/\\,\/g,'_').replace(\/\\.\/g,'_').replace(\/\\;\/g,'_')).replace(\/\\%20\/g,'_').replace(\/\\+\/g,'_') + '&url=' + encodeURIComponent(document.URL.split('#')[0].split('&blurb=Sorry')[0]),'_blank','top=50,left=50,width=50,height=50');<br \/>\n    } else {<br \/>\n    asuwo=window.open(firstloc + 'apple_script_url.php?justplay=y&showothers=y&tsplus=' + encodeURIComponent(document.URL.split('#')[0].split('&blurb=Sorry')[0].replace('HTTP','http').replace(\/\\.\/g,'_').replace(\/\\?\/g,'_').replace(\/\\&\/g,'_').replace(\/\\=\/g,'_').replace(\/\\:\/g,'_').replace(\/\\\/\/g,'_').replace(\/\\,\/g,'_').replace(\/\\[\/g,'_').replace(\/\\]\/g,'_').replace(\/\\~\/g,'_').replace(\/\\`\/g,'_').replace(\/\\%\\)\/g,'__').replace(\/\\(\/g,'_').replace(\/\\)\/g,'_').replace(\/\\\/\/g,'_').replace(\/\\{\/g,'_').replace(\/\\}\/g,'_').replace(\/\\:\/g,'_').replace(\/\\*\/g,'_').replace(\/\\$\/g,'_').replace(\/\\,\/g,'_').replace(\/\\.\/g,'_').replace(\/\\;\/g,'_')).replace(\/\\%20\/g,'_').replace(\/\\+\/g,'_') + '&url=' + encodeURIComponent(document.URL.split('#')[0].split('&blurb=Sorry')[0]),'_blank','top=50,left=50,width=50,height=50');<br \/>\n    }<br \/>\n    setTimeout(checkasu, 5000);<br \/>\n   \/\/}<br \/>\n   }<br \/>\n   }<br \/>\n  }<br \/>\n}<br \/>\n<\/code>\n<\/ol>\n<\/li>\n<\/ul>\n<p>Our PHP code got tweaked, and the macOS (Terminal application) command line problem below &#8230;<\/p>\n<blockquote><p>\nzsh: file name too long\n<\/p><\/blockquote>\n<p> &#8230; tweaked upon via temporary and strategic &#8220;file_put_contents&#8221; PHP codelines &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\n  if (isset($_GET['tsplus'])) {<br \/>\n      \/\/ .replace(\/\\%\\)\/g,'__').replace(\/\\(\/g,'_').replace(\/\\)\/g,'_').replace(\/\\\/\/g,'_').replace(\/\\{\/g,'_').replace(\/\\}\/g,'_').replace(\/\\:\/g,'_').replace(\/\\*\/g,'_').replace(\/\\$\/g,'_').replace(\/\\,\/g,'_').replace(\/\\.\/g,'_').replace(\/\\;\/g,'_')<br \/>\n  if (isset($_GET['nothing'])) {<br \/>\n      $tsplus= str_replace('.','_',  str_replace(',','_',  str_replace('*','_',   str_replace('$','_',  str_replace(':','_', str_replace(';','_',   str_replace('}','_', str_replace('{','_',  str_replace('\/','_', str_replace(')','_', str_replace('(','_', str_replace('%)','__', str_replace(str_replace('+',' ',urldecode($_GET['nothing'])), '',   str_replace(' ','',str_replace('+','',urldecode($_GET['tsplus'])))  )  ))))))))))));<br \/>\n      \/\/file_put_contents('xxxx0xx.vvvvvv', str_replace(' ','',str_replace('+','',urldecode($_GET['tsplus']))) . ' ... ' . $tsplus);<br \/>\n  } else {<br \/>\n      $tsplus= str_replace('.','_',  str_replace(',','_',  str_replace('*','_',   str_replace('$','_',  str_replace(':','_', str_replace(';','_',   str_replace('}','_', str_replace('{','_',  str_replace('\/','_', str_replace(')','_', str_replace('(','_', str_replace('%)','__',   str_replace(' ','',str_replace('+','',urldecode($_GET['tsplus'])))  ))))))))))));<br \/>\n      \/\/file_put_contents('xxxx1xx.vvvvvv', $tsplus);<br \/>\n  }<br \/>\n      \/\/file_put_contents('xxxxxx.vvvvvv', $tsplus);<br \/>\n  }<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p> &#8230; to arrive at a new strategy (<font color=blue>and new argument<\/font> <font size=1>(a less than 5 minute one)<\/font>) used in the new Nimh Game codeline &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\n&lt;script type='text\/javascript' src='\/apple_script_url.js?mustconZtain=&&lefXt=calc(50% - 85px)&toXp=calc(50% + 80px)&emojXi=128220&csXs=font-size:30px;opacity:0.8;<font color=blue>&nothing=,<\/font>'&gt;&lt;\/script&gt;<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p> &#8230; that won the day getting the filename lengths back in order with &#8230;<\/p>\n<ol>\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&nbsp;Google&nbsp;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)<\/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.js-----GETME\" title=\"apple_script_url.js\">the 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> (which is only needed up at the RJM Programming domain <font size=1>(when using RJM Programming domain web applications <a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=PtR4cWb4HNg'>that is<\/a>)<\/font>)<\/li>\n<\/ol>\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-and-macos-nimh-game-integration-tutorial\/'>PHP Calls Windows and macOS Nimh Game Integration Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcwosggfut'>Previous relevant <a target=_blank title='PHP Calls Windows and macOS Gimp Guillotine Follow Up Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-and-macos-gimp-guillotine-follow-up-tutorial\/'>PHP Calls Windows and macOS Gimp Guillotine Follow Up 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\/gimp_guillotine_followup.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP Calls Windows and macOS Gimp Guillotine Follow Up Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url_guillotine.jpg\" title=\"PHP Calls Windows and macOS Gimp Guillotine Follow Up Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP Calls Windows and macOS Gimp Guillotine Follow Up Tutorial<\/p><\/div>\n<p>It&#8217;s amazing with integration how data springs up surprises.  Just as you think your tool is bulletproof, data issues can come and spoil the <font size=1><a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=fAs8H6ENZGw'>Barty<\/a><\/font> party.  On the same theme as yesterday&#8217;s <a title='PHP Calls Windows and macOS Google Charts and Blog Tutorial' href='#phpcwosgcbt'>PHP Calls Windows and macOS Google Charts and Blog Tutorial<\/a> we wanted to integrate the recent &#8220;PHP Calls Windows (DOS Batch) and macOS (Apple Script) URL Recall&#8221; tool with the &#8220;Gimp Guillotine Follow Up&#8221; web application featuring lots of ways to represent a set of related images.<\/p>\n<p>Another overcomable issue arose thinking about this.  We think it is wise quite often when using navigation via &#8230;<\/p>\n<ul>\n<li>PHP (or other serverside code) &#8230; using &#8230;<\/li>\n<li>HTML element form &#8230; with &#8230;<\/li>\n<li>action=[the same URL as the form belongs to] <font size=1> &#8230; or &#8230; (the &#8220;here&#8217;s looking at you, kid&#8221;, clause&#8221;)<\/font><\/li>\n<\/ul>\n<p> &#8230; to also use <i>method=POST<\/i> because the data sizes (involved with the form navigation) might make &#8220;method=GET&#8221; alternative approach unviable (and you get <a target=_blank title='HTTP error 414' href='https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Status\/414'>HTTP error 414<\/a>).  But here&#8217;s an occasion, integrating this recent &#8220;PHP Calls Windows (DOS Batch) and macOS (Apple Script) URL Recall&#8221; tool, where &#8220;method=GET&#8221; comes back into our thinking.  Why?  Well, with &#8220;method=GET&#8221; being used with the HTML form, we can end up with some useful and meaningful macOS or Windows Desktop folder files describing a situation that you might want to retain and recover <font size=1>(the same scenario of)<\/font> at a later date.  And now that we are happy we can discover whether the &#8220;PHP Calls Windows (DOS Batch) and macOS (Apple Script) URL Recall&#8221; tool exists or not, we can switch from &#8230;<\/p>\n<ul>\n<li>form <i>method=POST<\/i> to &#8230;<\/li>\n<li><i>method=GET<\/i> &#8230; if we amend the document.body onload event function &#8220;selopts&#8221; <font color=blue>as per<\/font> &#8230;<br \/>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n  function selopts() {<br \/>\n  <font color=blue>if (document.getElementById('asue') && eval('' + document.getElementsByTagName('form').length) > 0) {<br \/>\n    document.getElementsByTagName('form')[0].method='GET';<br \/>\n  }<\/font><br \/>\n  \" . $selopts . \"<br \/>\n   }<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<br \/>\n &#8230; dynamically (and only as potentially needed), and teamed with the new &#8220;within head element&#8221; &#8230;<br \/>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n&lt;script type='text\/javascript' src='apple_script_url.js?mustconXtain=&&lefXt=calc(50% - 85px)&toXp=calc(50% + 80px)&emojXi=128220&csXs=font-size:30px;opacity:0.8;&gt;&lt;\/script&gt;<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<br \/>\n &#8230; in <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/gimp_guillotine_followup.php---------------------------------GETME' title='gimp_guillotine_followup.php'>the changed<\/a> <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/PHP\/gimp_guillotine_followup.php---------------------------------GETME' title='gimp_guillotine_followup.php'>gimp_guillotine_followup.php<\/a> that you can try out at this <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/PHP\/gimp_guillotine_followup.php\" title=\"Click picture\">live run<\/a> link\n<\/li>\n<\/ul>\n<p> &#8230; all &#8220;good to go&#8221; where the data length won&#8217;t exceed <i>method=GET<\/i> URL length limits around 800-900 characters we seem to have up at the RJM Programming domain webpages.   Happily, in the case of &#8220;Gimp Guillotine Follow Up&#8221; work, this should not be a problem.   Sadly, in many other <i>method=POST<\/i> PHP scenarios, this will not be the case.<\/p>\n<p>And then, as far as data complexity goes, yes, this &#8220;Gimp Guillotine Follow Up&#8221; integrating got us &#8220;a bit kludgy&#8221; amending &#8230;<\/p>\n<ol>\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&nbsp;Google&nbsp;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) <font color=blue>&#8230;<\/font><br \/>\n&lt;?php<br \/>\n<code><br \/>\n  if (isset($_GET['tsplus'])) {<br \/>\n      $tsplus= <font color=blue>str_replace('.','_',  str_replace(',','_', str_replace('*','_',   str_replace('$','_',  str_replace(':','_', str_replace(';','_',   str_replace('}','_', str_replace('{','_',  str_replace('\/','_', str_replace(')','_', str_replace('(','_', str_replace('%)','__',   <\/font>str_replace(' ','',str_replace('+','',urldecode($_GET['tsplus'])))  <font color=blue>))))))))))))<\/font>;<br \/>\n  }<br \/>\n<\/code><br \/>\n?&gt;<br \/>\n &#8230; the symptom of there being a problem is that no Desktop files are created if these data massages allow through characters not suited to file naming (on a hard disk) purposes\n<\/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.js----GETME\" title=\"apple_script_url.js\">a 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> (which is only needed up at the RJM Programming domain <font size=1>(when using RJM Programming domain web applications <a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=PtR4cWb4HNg'>that is<\/a>)<\/font>)<\/li>\n<\/ol>\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-and-macos-gimp-guillotine-follow-up-tutorial\/'>PHP Calls Windows and macOS Gimp Guillotine Follow Up Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcwosgcbt'>Previous relevant <a target=_blank title='PHP Calls Windows and macOS Google Charts and Blog Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-and-macos-google-charts-and-blog-tutorial\/'>PHP Calls Windows and macOS Google Charts and Blog 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 Windows and macOS Google Charts and Blog Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/apple_script_url_chartsblog.jpg\" title=\"PHP Calls Windows and macOS Google Charts and Blog Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP Calls Windows and macOS Google Charts and Blog Tutorial<\/p><\/div>\n<p>We tackle two more integrations of our current &#8220;PHP Calls Windows (DOS Batch) and macOS (Apple Script) URL Recall&#8221; tool (made up of external Javascript and local web server downloaded PHP), those being &#8230;<\/p>\n<ul>\n<li><a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-and-macos-google-charts-and-blog-tutorial\/'>the blog you are reading<\/a> &#8230; a one line change into our TwentyTen themed header.php&#8217;s &#8230;<br \/>\n&lt;?php echo &#8221;<br \/>\n<code><br \/>\n&lt;script type='text\/javascript' src='\/apple_script_url.js?mustconXtain=&&left=calc(65% + 11px)&top=calc(0% + 58px)&emojXi=128220&css=font-size:22px;opacity:0.8;'&gt;&lt;\/script&gt;<br \/>\n<\/code><br \/>\n&#8220;; ?&gt;<br \/>\n &#8230; for non-mobile users <font size=1><a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=PtR4cWb4HNg'>that is<\/a><\/font> &#8230;<\/li>\n<li>our inhouse <a title=\"Google Chart Tools provide a perfect way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart galley provides a large number of well-designed chart types. Populating your data is easy using the provided client- and server-side tools.\" href=\"https:\/\/developers.google.com\/chart\/interactive\/docs\/index\" target=\"_blank\">Google Chart<\/a> interfacers such as <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/PieChart\/\">Pie Chart<\/a> &#8230; for non-mobile users <font size=1><a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=PtR4cWb4HNg'>that is<\/a><\/font><\/li>\n<\/ul>\n<p> &#8230; onto yesterday&#8217;s <a title='PHP Calls Windows Batch Genericization Tutorial' href='#phpcwbgt'>PHP Calls Windows Batch Genericization Tutorial<\/a> &#8220;end of our <i>genericizations drive<\/i>&#8221; <font size-1>(for the forseeable future)<\/font>.<\/p>\n<p>Hang on!  There are quite a few Google Chart interfacers (eg. Line Chart, TimeLine Chart, Histogram Chart, Map Chart, Geo Chart <a target=_blank title='?' href='https:\/\/www.youtube.com\/watch?v=1JHH6iwgIek'>etcetera etcetera etcetera<\/a>), so that must have been a lot of work?!  Well, no, it wasn&#8217;t, because we intervened into another external Javascript&#8217;s workings which is called by all these interfacers, and so only needed to &#8230;<\/p>\n<ul>\n<li><a title=\"gchartgen.js\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/gchartgen.js------------------GETME\" target=\"_blank\">change this way<\/a> &#8230;<br \/>\n<code><br \/>\nfunction ggmuchlater() {<br \/>\n    var scriptz = document.createElement(\"script\");  \/\/ create a script DOM node<br \/>\n    scriptz.src = '\/apple_script_url.js?left=calc(100% - 60px)&top=2px&emojXi=128220&css=font-size:30px;opacity:0.8;&mustcontain=&';  \/\/ set its src to the provided URL<br \/>\n    document.head.appendChild(scriptz);  \/\/ add it to the end of the head section of the page (could change 'head' to 'body' to add it to the end of the body section instead) ... thanks to <a target=_blank title='https:\/\/dev-answers.com\/solutions\/3287e028\/how-do-i-include-a-javascript-file-in-another-javascript-file' href='https:\/\/dev-answers.com\/solutions\/3287e028\/how-do-i-include-a-javascript-file-in-another-javascript-file'>https:\/\/dev-answers.com\/solutions\/3287e028\/how-do-i-include-a-javascript-file-in-another-javascript-file<\/a><br \/>\n}<br \/>\n<br \/>\nsetTimeout(ggmuchlater, 7000);<br \/>\n<\/code><br \/>\n &#8230; the <a title=\"gchartgen.js\" href=\"http:\/\/www.rjmprogramming.com.au\/gchartgen.js------------------GETME\" target=\"_blank\">gchartgen.js<\/a> Google Chart interfacing helper external Javascript (only needed up at the RJM Programming domain) &#8230; thanks to <a target=_blank title='https:\/\/dev-answers.com\/solutions\/3287e028\/how-do-i-include-a-javascript-file-in-another-javascript-file' href='https:\/\/dev-answers.com\/solutions\/3287e028\/how-do-i-include-a-javascript-file-in-another-javascript-file'>https:\/\/dev-answers.com\/solutions\/3287e028\/how-do-i-include-a-javascript-file-in-another-javascript-file<\/a> &#8230; but this change required, also &#8230;<\/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.js---GETME\" title=\"apple_script_url.js\">a strategically 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>, featuring <a target=_blank title='Ajax information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Ajax_(programming)'>Ajax<\/a> <font color=blue>&#8230;<\/font><br \/>\n<code><br \/>\n<font color=blue>var gczhr=null;<br \/>\nvar plusscr='';<br \/>\nvar retgcval='';<\/font><br \/>\n<br \/>\n<font color=blue>function gcshowStuff() {<br \/>\n  if (gczhr != null) {<br \/>\n  if (gczhr.readyState == 4) {<br \/>\n    if (gczhr.status == 200) {<br \/>\n      plusscr+=gczhr.responseText;<br \/>\n    }<br \/>\n  }<br \/>\n  }<br \/>\n}<br \/>\n<br \/> <br \/>\nfunction gcajaxit(gcurlis) {<br \/>\n   gczhr = new XMLHttpRequest();<br \/>\n   gczhr.open('get', gcurlis, true);<br \/>\n   gczhr.onreadystatechange = gcshowStuff;<br \/>\n   gczhr.send(null);<br \/>\n}<\/font><br \/>\n<br \/>\nfunction changethedefaultsmaybe() {<br \/>\n  var defpallette='', thisonepal='', calcpal='', calcper='', icalcper=-1, proposedport='';<br \/>\n  <font color=blue>if (document.head.innerHTML.indexOf('apple_s' + 'cript_url.js?') == -1 && document.head.innerHTML.indexOf('\/gchart' + 'gen.js') != -1 && plusscr == '') {<br \/>\n    var efforts=document.head.innerHTML.split('\/gchart' + 'gen.js');<br \/>\n    var slicerz=-1;<br \/>\n    var gcslicerz='';<br \/>\n    while (slicerz &lt; 0) {<br \/>\n      if (efforts[0].slice(slicerz).substring(0,1) == \"'\" || efforts[0].slice(slicerz).substring(0,1) == '\"' || efforts[0].slice(slicerz).substring(0,1) == '=') {<br \/>\n       slicerz=0;<br \/>\n      } else {<br \/>\n       gcslicerz=efforts[0].slice(slicerz).substring(0,1) + gcslicerz;<br \/>\n       slicerz--;<br \/>\n      }<br \/>\n    }<br \/>\n    gcajaxit(gcslicerz + '\/gchart' + 'gen.js');<br \/>\n    return '1';<br \/>\n  }<\/font><br \/>\n  if (<font color=blue>(<\/font>document.head.innerHTML<font color=blue> + plusscr)<\/font>.indexOf('apple_s' + 'cript_url.js?') != -1) {<br \/>\n    defpallette=<font color=blue>(<\/font>document.head.innerHTML<font color=blue> + plusscr)<\/font>.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    \/\/ rest in this if block unchanged<br \/>\n  }<br \/>\n  \/\/ rest unchanged in this function, except at the end of this function ...<br \/>\n  <font color=blue>return '';<\/font><br \/>\n}<br \/>\n<br \/>\n\/\/ ... then ... at the end of the external Javascript file ...<br \/>\n<br \/>\n<font color=blue>function anotherajaxgo() {<br \/>\n  changethedefaultsmaybe();<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}<\/font><br \/>\n<br \/>\nif (!navigator.userAgent.match(\/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile\/i)) {<br \/>\n <font color=blue>retgcval=<\/font>changethedefaultsmaybe();<br \/>\n <font color=blue>if (retgcval != '') {<br \/>\n plusscr=' ';<br \/>\n setTimeout(anotherajaxgo, 4000);<br \/>\n } else {<\/font><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 <font color=blue>}<\/font><br \/>\n}<br \/>\n<\/code><br \/>\n &#8230; calls, &#8220;PHP Calls Windows (DOS Batch) and macOS (Apple Script) URL Recall&#8221; tool external Javascript component (only needed up at the RJM Programming domain)<\/li>\n<\/ul>\n<p>Note, how with the Google Charts interfacing, we made use of the &#8220;end of argument list&#8221; &#8230;<\/p>\n<p><code><br \/>\n&mustcontain=&<br \/>\n<\/code><\/p>\n<p> &#8230; inclusion to limit the &#8220;PHP Calls Windows (DOS Batch) and macOS (Apple Script) URL Recall&#8221; tool enthusiasms to the situations <b>after<\/b> the user has entered in all their interactive inputs they perform in Javascript prompt windows.<\/p>\n<p>Nothing changed, here, today regarding our &#8220;PHP Calls Windows (DOS Batch) and macOS (Apple Script) URL Recall&#8221; tool PHP <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).<\/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-and-macos-google-charts-and-blog-tutorial\/'>PHP Calls Windows and macOS Google Charts and Blog Tutorial<\/a>.<\/p-->\n<hr>\n<p id='phpcwbgt'>Previous relevant <a target=_blank title='PHP Calls Windows Batch Genericization Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-batch-genericization-tutorial\/'>PHP Calls Windows Batch 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 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<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='#d55004' onclick='var dv=document.getElementById(\"d55004\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/google-charts\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55004' 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='#d55018' onclick='var dv=document.getElementById(\"d55018\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/form\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55018' 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='#d55028' onclick='var dv=document.getElementById(\"d55028\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/game\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d55028' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>On top of yesterday&#8217;s PHP Calls Windows and macOS Gimp Guillotine Follow Up Tutorial&#8216;s progress with our &#8220;PHP Calls Windows (DOS Batch) and macOS (Apple Script) URL Recall&#8221; tool integrations, today &#8230; improving a filename length issue integrating with our &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-and-macos-nimh-game-integration-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,15,29,37],"tags":[3028,2419,69,85,3909,1885,1835,135,151,181,3913,3912,3917,233,234,281,284,290,319,341,358,360,380,385,3606,405,3910,409,452,3916,477,1839,2718,1533,519,2903,2459,614,624,652,3656,714,3914,2178,744,1830,818,830,3049,2427,932,3915,944,970,997,1105,1159,1168,1209,1212,3911,1319,1402,1435,1456],"class_list":["post-55028","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-games","category-operating-system","category-tutorials","tag-action","tag-aesthetics","tag-ajax","tag-apache","tag-apple-script","tag-argument","tag-arguments","tag-batch","tag-blog","tag-call","tag-called","tag-caller","tag-client-application","tag-command","tag-command-line","tag-css","tag-curl","tag-data","tag-desktop","tag-display","tag-dos","tag-download","tag-email","tag-emoji","tag-emoji-button","tag-exec","tag-execute","tag-external-javascript","tag-form","tag-gam","tag-games-2","tag-genericization","tag-genericize","tag-get","tag-google-charts","tag-http-error","tag-induction","tag-integration","tag-intranet","tag-javascript","tag-length","tag-local-web-server","tag-look","tag-macos","tag-mamp","tag-method","tag-ms-dos","tag-navigation","tag-open","tag-passthru","tag-php","tag-php_os","tag-pie-chart","tag-post","tag-programming","tag-script","tag-sms","tag-software-integration","tag-style","tag-styling","tag-terminla","tag-tutorial","tag-web-application","tag-windows","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55028"}],"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=55028"}],"version-history":[{"count":2,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55028\/revisions"}],"predecessor-version":[{"id":55030,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55028\/revisions\/55030"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=55028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=55028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=55028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}