{"id":55004,"date":"2022-02-26T03:01:18","date_gmt":"2022-02-25T17:01:18","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=55004"},"modified":"2022-03-03T09:37:56","modified_gmt":"2022-03-02T23:37:56","slug":"php-calls-windows-and-macos-google-charts-and-blog-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-and-macos-google-charts-and-blog-tutorial\/","title":{"rendered":"PHP Calls Windows and macOS Google Charts and Blog 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 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% + 5px)&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","protected":false},"excerpt":{"rendered":"<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; the blog you are reading &#8230; &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-calls-windows-and-macos-google-charts-and-blog-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":[2,12,14,29,37],"tags":[2419,69,85,3909,1885,1835,135,151,181,3913,3912,233,234,281,284,319,341,358,360,385,3606,405,3910,409,1839,2718,519,2459,614,624,652,714,3914,2178,744,818,3049,2427,932,3915,944,997,1105,1168,1209,1212,3911,1319,1402,1435,1456],"class_list":["post-55004","post","type-post","status-publish","format-standard","hentry","category-ajax","category-elearning","category-event-driven-programming","category-operating-system","category-tutorials","tag-aesthetics","tag-ajax","tag-apache","tag-apple-script","tag-argument","tag-arguments","tag-batch","tag-blog","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-google-charts","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-pie-chart","tag-programming","tag-script","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\/55004"}],"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=55004"}],"version-history":[{"count":15,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55004\/revisions"}],"predecessor-version":[{"id":55072,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/55004\/revisions\/55072"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=55004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=55004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=55004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}