{"id":49731,"date":"2020-07-25T03:01:18","date_gmt":"2020-07-24T17:01:18","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=49731"},"modified":"2020-07-25T13:58:51","modified_gmt":"2020-07-25T03:58:51","slug":"pandoc-document-conversion-email-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/pandoc-document-conversion-email-tutorial\/","title":{"rendered":"Pandoc Document Conversion Email Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Pandoc Document Conversion Email Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/pandoc_email.jpg\" title=\"Pandoc Document Conversion Email Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Pandoc Document Conversion Email Tutorial<\/p><\/div>\n<p>On top of yesterday&#8217;s <a title='Pandoc Document Conversion Command Line Tutorial' href='#pdcclt'>Pandoc Document Conversion Command Line Tutorial<\/a> Document Conversion progress we&#8217;ve been wondering how to offer assistance in our public realm up at the rjmprogramming.com.au domain.  Today, as you can see with <a target=_blank title='YouTube video' href='https:\/\/www.youtube.com\/embed\/8Byc33kimjE'>our YouTube video presentation<\/a>, we&#8217;ve got it so that &#8230;<\/p>\n<p><iframe style='width:95%;height:180px;border:1px solid red;background-color:#f0f0f0;' src='http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php'><\/iframe><\/p>\n<p> &#8230; offers that last <i>Email and Download<\/i> link to help out a user &#8230;<\/p>\n<ul>\n<li>who is not interested in installing any PHP local Apache web servers &#8230; but &#8230;<\/li>\n<li>is using macOS or Mac OS X (and so can access <i>textutil<\/i>) &#8230; and\/or &#8230;<\/li>\n<li>has installed (the Open Source) <i>pandoc<\/i> (with <i>pdflatex<\/i> perhaps)<\/li>\n<\/ul>\n<p> &#8230; and who establishes an inhouse <i>Downloads<\/i> folder listener script such as our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/convert_this_please.ksh_GETME\" title=\"convert_this_please.ksh\">convert_this_please.ksh<\/a> Korn Shell one that we execute (in the background) via &#8230;<\/p>\n<p><code><br \/>\nksh convert_this_please.ksh &<br \/>\n<\/code><\/p>\n<p> &#8230; and looks out for the <i>Email Document(s)<\/i> button functionality of &#8230;<\/p>\n<p><iframe style='width:100%;height:400px;' src='http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php?emailanyway=y'><\/iframe><\/p>\n<p> &#8230; with the file naming conventions (after email attachment download(s)) &#8230;<\/p>\n<table style=width:100%;>\n<tr>\n<th>Downloads Path<\/th>\n<\/tr>\n<tr>\n<td>${HOME}\/Downloads<\/td>\n<\/tr>\n<tr>\n<th>Downloads Input Name<\/th>\n<\/tr>\n<tr>\n<td>convert_this_please_[OutputExt]_[OriginalInput_Name].[OriginalInput_Ext]<\/td>\n<\/tr>\n<tr>\n<th>Downloads Output Name<\/th>\n<\/tr>\n<tr>\n<td>convertthisplease[OutputExt][OriginalInputName].[OutputExt]<\/td>\n<\/tr>\n<\/table>\n<p> &#8230; effectively bypassing any local PHP web server for direct command line processing via downloaded email attachments.<\/p>\n<p><a target=_blank title='macos_textutil_convert.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php-----GETME'>The changed<\/a> <a target=_blank title='macos_textutil_convert.php' href='http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php-----GETME'>macos_textutil_convert.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php\" title=\"Click picture\">live run<\/a> link  calls on <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.html--------------GETME\">a changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.html--------------GETME\">client_browsing.htm<\/a> and gets you to a &#8220;surfing the web&#8221; incarnation.<\/p>\n<p>As intimated, below we show this functionality in action &#8230;<\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/8Byc33kimjE\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/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\/pandoc-document-conversion-email-tutorial\/'>Pandoc Document Conversion Email Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdcclt'>Previous relevant <a target=_blank title='Pandoc Document Conversion Command Line Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pandoc-document-conversion-command-line-tutorial\/'>Pandoc Document Conversion Command Line Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Pandoc Document Conversion Command Line Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/pandoc_commandline.jpg\" title=\"Pandoc Document Conversion Command Line Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Pandoc Document Conversion Command Line Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a title='Pandoc Document Conversion Multiple Tutorial' href='#pdcmt'>Pandoc Document Conversion Multiple Tutorial<\/a> intimated what direction we might be taking up today, when it said &#8230;<\/p>\n<blockquote cite='\/\/www.rjmprogramming.com.au\/ITblog\/pandoc-document-conversion-multiple-tutorial\/'><p>\n &#8230; still assuming the files selected are off your local web server&#8217;s Document Root (but more on that later down the track, maybe).\n<\/p><\/blockquote>\n<p>Considering this challenge, the &#8220;outside your usual thought pattern box&#8221;, perhaps, would be to remember that PHP&#8217;s modes of use can be&#8230;<\/p>\n<ul>\n<li>surfing the web (with a web browser) &#8230;<\/li>\n<li><a target=_blank title='Linux or unix curl information from computerhope' href='http:\/\/www.computerhope.com\/unix\/curl.htm'>curl<\/a> (at command line) &#8230;<\/li>\n<li>command line<\/li>\n<\/ul>\n<p> &#8230; and it is introducing that &#8220;command line&#8221; PHP mode of use above that can strip out the relevance of $_SERVER[&#8216;DOCUMENT_ROOT&#8217;] (per se) as a concept, so that in this mode of use, we effectively start from scratch asking the user for four pieces of information as per &#8230;<\/p>\n<table style=width:100%;>\n<tr>\n<th>Description<\/th>\n<th>Default<\/th>\n<\/tr>\n<tr>\n<td>Input path<\/td>\n<td>dirname(__FILE__)<\/td>\n<\/tr>\n<tr>\n<td>Input filespec<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Output path<\/td>\n<td>dirname(__FILE__)<\/td>\n<\/tr>\n<tr>\n<td>Output file extension<\/td>\n<td><\/td>\n<\/tr>\n<\/table>\n<p>This web application (now also command line app, given you have a local web server featuring PHP such as <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'><i>MAMP<\/i><\/a>) suits this &#8220;command line&#8221; mode of use ahead of its &#8220;surfing the net&#8221; way for a couple of reasons (to us) &#8230;<\/p>\n<ul>\n<li>we think &#8220;command line&#8221; gets conversions done faster &#8230;<\/li>\n<li>as per yesterday&#8217;s challenge, given file permission allowances, you can read and write to places that aren&#8217;t within the $_SERVER[&#8216;DOCUMENT_ROOT&#8217;] directory hierarchy<\/li>\n<li>as a PHP programmer, these modes of use can be neatly separated &#8230; the &#8220;command line&#8221; mode of use code is totally self contained &#8230;<br \/>\n&lt;?php<br \/>\n<code><br \/>\n if (isset($argv)) { \/\/ command line<br \/>\n  $numargs = sizeof($argv);<br \/>\n  if ($numargs &lt;= 4) {<br \/>\n   if (PHP_OS == 'WINNT') {<br \/>\n    echo '$ Input path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then *.pdf,*.doc,*.docx,*.htm,*.html,*.txt Input File(spec) then Output path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then .pdf,.doc,.docx,.htm,.html,.txt Output File Extension below ...' . \"\\n\";<br \/>\n    $line = stream_get_line(STDIN, 1024, PHP_EOL);<br \/>\n    if (str_replace(\"\\n\", \"\", $line) == \"\") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }<br \/>\n    $lineinspec = stream_get_line(STDIN, 1024, PHP_EOL);<br \/>\n    $outline = stream_get_line(STDIN, 1024, PHP_EOL);<br \/>\n    if (str_replace(\"\\n\", \"\", $outline) == \"\") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }<br \/>\n    $outlineinspec = stream_get_line(STDIN, 1024, PHP_EOL);<br \/>\n   } else {<br \/>\n    $line = readline('$ Input path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then *.pdf,*.doc,*.docx,*.htm,*.html,*.txt Input File(spec) then Output path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then .pdf,.doc,.docx,.htm,.html,.txt Output File Extension below ...' . \"\\n\");<br \/>\n    if (str_replace(\"\\n\", \"\", $line) == \"\") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }<br \/>\n    $lineinspec = readline('');<br \/>\n    $outline = readline('');<br \/>\n    if (str_replace(\"\\n\", \"\", $outline) == \"\") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }<br \/>\n    $outlineinspec = readline('');<br \/>\n   }<br \/>\n  $cmdsuff=\"\";<br \/>\n  if ($verb != \"textutil\" &#038;&#038; explode(\".\",$outlineinspec)[-1 + sizeof(explode(\".\",$outlineinspec))] == \"pdf\") {<br \/>\n  if (file_exists(\"\/Library\/TeX\/Root\/bin\/x86_64-darwin\/pdflatex\")) {<br \/>\n  $cmdsuff=\" --pdf-engine=\/Library\/TeX\/Root\/bin\/x86_64-darwin\/pdflatex\";<br \/>\n  } else if (file_exists(\"\/Library\/TeX\/texbin\/pdflatex\")) {<br \/>\n  $cmdsuff=\" --pdf-engine=\/Library\/TeX\/texbin\/pdflatex\";<br \/>\n  } else {<br \/>\n  $cmdsuff=\" --pdf-engine=pdflatex\";<br \/>\n  }<br \/>\n  }<br \/>\n   $openers=\"\";<br \/>\n   $openersdelim=\"\";<br \/>\n   foreach (glob($line . $lineinspec) as $filename) {<br \/>\n    $outnameis=$outline . str_replace(\".\" . explode(\".\", basename($filename))[-1 + sizeof(explode(\".\", basename($filename)))], \".\", basename($filename)) . str_replace(\".\", \"\", $outlineinspec);<br \/>\n  if (file_exists($outnameis)) {<br \/>\n  $sufext=\"_0\";<br \/>\n  $iext=0;<br \/>\n  $rone=\"\";<br \/>\n  $rtwo=\"\";<br \/>\n    while (file_exists($outnameis . $sufext)) {<br \/>\n      $iext++;<br \/>\n      $sufext=\"_\" . $iext;<br \/>\n    }<br \/>\n    $rtwo=$outnameis;<br \/>\n    $rone=$outnameis . $sufext;<br \/>\n    echo \"Renaming \" . $outnameis . \" to \" . $outnameis . $sufext . \"\\n\";<br \/>\n    try {<br \/>\n    rename($outnameis, $outnameis . $sufext);<br \/>\n    } catch (Exception $e) {<br \/>\n    echo $e-&gt;getMessage() . \"\\n\";<br \/>\n    }<br \/>\n    if (!file_exists($outnameis . $sufext)) {<br \/>\n    echo \"Renaming did not happen.\" . \"\\n\";<br \/>\n    }<br \/>\n  }<br \/>\n    if (explode(\".\",$outlineinspec)[-1 + sizeof(explode(\".\",$outlineinspec))] == \"pdJUNKf\") {<br \/>\n    echo (\"php \" . $argv[0] . \" \" . $line . \" \" . basename($filename) . \" \" . $outline . \" \" . $outlineinspec . \"\\n\");<br \/>\n    passthru(\"php \" . $argv[0] . \" \" . $line . \" \" . basename($filename) . \" \" . $outline . \" \" . $outlineinspec);<br \/>\n    } else {<br \/>\n    \/\/echo ($verb . \" \" . $switchone . \" \" . $filename . \" \" . $switchtwo . \" \" . $outnameis . $cmdsuff . \" &gt; macos_textutil_convert.out 2&gt; macos_textutil_convert.err\");<br \/>\n    echo ($verb . \" \" . $switchone . \" \" . str_replace(\".\", \"\", $outlineinspec) . \" \" . $filename . \" \" . $switchtwo . \" \" . $outnameis . $cmdsuff . \" &gt; macos_textutil_convert.out 2&gt; macos_textutil_convert.err \\n\");<br \/>\n    exec($verb . \" \" . $switchone . \" \" . str_replace(\".\", \"\", $outlineinspec) . \" \" . $filename . \" \" . $switchtwo . \" \" . $outnameis . $cmdsuff . \" &gt; macos_textutil_convert.out 2&gt; macos_textutil_convert.err\");<br \/>\n  if (file_exists(\"macos_textutil_convert.out\") &#038;&#038; file_exists(\"macos_textutil_convert.err\")) {<br \/>\n  if (filesize(\"macos_textutil_convert.out\") == 0 &#038;&#038; filesize(\"macos_textutil_convert.err\") != 0) {<br \/>\n     if ($rone != \"\" &#038;&#038; $rtwo != \"\") {<br \/>\n    echo \"Renaming \" . $rone . \" back to \" . $rtwo . \"\\n\";<br \/>\n      rename($rone, $rtwo);<br \/>\n     }<br \/>\n     echo \"\\n\\n\" . file_get_contents(\"macos_textutil_convert.err\") . \"\\n\\n\";<br \/>\n  }<br \/>\n  }<br \/>\n    if (PHP_OS == \"Darwin\") { \/\/ &#038;&#038; explode(\".\",$outlineinspec)[-1 + sizeof(explode(\".\",$outlineinspec))] != \"pdf\") {<br \/>\n       if (file_exists($outnameis)) {<br \/>\n       $openers.=$openersdelim . \"open \" . $outnameis;<br \/>\n       $openersdelim=\" ; \";<br \/>\n       }<br \/>\n    }<br \/>\n    }<br \/>\n   }<br \/>\n   if (PHP_OS == \"Darwin\" &#038;&#038; $openers != \"\") {<br \/>\n    echo \"\\n\\nWill try to open successful (or old resurrected) files in 8 seconds ...\\n\";<br \/>\n    sleep(8);<br \/>\n    echo ($openers . \" \\n\");<br \/>\n    exec($openers);<br \/>\n   }<br \/>\n   \/\/echo \"do the work\";<br \/>\n  } else {<br \/>\n   $openers=\"\";<br \/>\n   $openersdelim=\"\";<br \/>\n   $line=trim($argv[1]);<br \/>\n   if (str_replace(\"\\n\", \"\", $line) == \"\") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }<br \/>\n   $lineinspec=$argv[2];<br \/>\n   $outline=trim($argv[3]);<br \/>\n   if (str_replace(\"\\n\", \"\", $outline) == \"\") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }<br \/>\n   $outlineinspec=$argv[4];<br \/>\n  $cmdsuff=\"\";<br \/>\n  if ($verb != \"textutil\" &#038;&#038; explode(\".\",$outlineinspec)[-1 + sizeof(explode(\".\",$outlineinspec))] == \"pdf\") {<br \/>\n  if (file_exists(\"\/Library\/TeX\/Root\/bin\/x86_64-darwin\/pdflatex\")) {<br \/>\n  $cmdsuff=\" --pdf-engine=\/Library\/TeX\/Root\/bin\/x86_64-darwin\/pdflatex\";<br \/>\n  } else if (file_exists(\"\/Library\/TeX\/texbin\/pdflatex\")) {<br \/>\n  $cmdsuff=\" --pdf-engine=\/Library\/TeX\/texbin\/pdflatex\";<br \/>\n  } else {<br \/>\n  $cmdsuff=\" --pdf-engine=pdflatex\";<br \/>\n  }<br \/>\n  }<br \/>\n   foreach (glob($line . $lineinspec) as $filename) {<br \/>\n     $outnameis=$outline . str_replace(\".\" . explode(\".\", basename($filename))[-1 + sizeof(explode(\".\", basename($filename)))], \".\", basename($filename)) . str_replace(\".\", \"\", $outlineinspec);<br \/>\n  if (file_exists($outnameis)) {<br \/>\n  $sufext=\"_0\";<br \/>\n  $iext=0;<br \/>\n  $rone=\"\";<br \/>\n  $rtwo=\"\";<br \/>\n    while (file_exists($outnameis . $sufext)) {<br \/>\n      $iext++;<br \/>\n      $sufext=\"_\" . $iext;<br \/>\n    }<br \/>\n    $rtwo=$outnameis;<br \/>\n    $rone=$outnameis . $sufext;<br \/>\n    echo \"Renaming \" . $outnameis . \" to \" . $outnameis . $sufext . \"\\n\";<br \/>\n    rename($outnameis, $outnameis . $sufext);<br \/>\n  }<br \/>\n    \/\/echo ($verb . \" \" . $switchone . \" \" . $filename . \" \" . $switchtwo . \" \" . $outnameis . $cmdsuff . \" &gt; macos_textutil_convert.out 2&gt; macos_textutil_convert.err\");<br \/>\n    echo ($verb . \" \" . $switchone . \" \" . str_replace(\".\", \"\", $outlineinspec) . \" \" . $filename . \" \" . $switchtwo . \" \" . $outnameis . $cmdsuff . \" &gt; macos_textutil_convert.out 2&gt; macos_textutil_convert.err \\n\");<br \/>\n    exec($verb . \" \" . $switchone . \" \" . str_replace(\".\", \"\", $outlineinspec) . \" \" . $filename . \" \" . $switchtwo . \" \" . $outnameis . $cmdsuff . \" &gt; macos_textutil_convert.out 2&gt; macos_textutil_convert.err\");<br \/>\n  if (file_exists(\"macos_textutil_convert.out\") &#038;&#038; file_exists(\"macos_textutil_convert.err\")) {<br \/>\n  if (filesize(\"macos_textutil_convert.out\") == 0 &#038;&#038; filesize(\"macos_textutil_convert.err\") != 0) {<br \/>\n     if ($rone != \"\" &#038;&#038; $rtwo != \"\") {<br \/>\n    echo \"Renaming \" . $rone . \" back to \" . $rtwo . \"\\n\";<br \/>\n      rename($rone, $rtwo);<br \/>\n     }<br \/>\n     echo \"\\n\\n\" . file_get_contents(\"macos_textutil_convert.err\") . \"\\n\\n\";<br \/>\n  }<br \/>\n  }<br \/>\n    if (PHP_OS == \"Darwin\") { \/\/ &#038;&#038; explode(\".\",$outlineinspec)[-1 + sizeof(explode(\".\",$outlineinspec))] != \"pdf\") {<br \/>\n       if (file_exists($outnameis)) {<br \/>\n       $openers.=$openersdelim . \"open \" . $outnameis;<br \/>\n       $openersdelim=\" ; \";<br \/>\n       }<br \/>\n    }<br \/>\n   }<br \/>\n   if (PHP_OS == \"Darwin\" &#038;&#038; $openers != \"\") {<br \/>\n    echo \"\\n\\nWill try to open successful (or old resurrected) files in 8 seconds ...\\n\";<br \/>\n    sleep(8);<br \/>\n    echo ($openers . \" \\n\");<br \/>\n    exec($openers);<br \/>\n   }<br \/>\n   \/\/echo \"Do the work \";<br \/>\n  }<br \/>\n  exit;<br \/>\n }<br \/>\n<\/code><br \/>\n?&gt;\n<\/li>\n<\/ul>\n<p><a target=_blank title='macos_textutil_convert.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php----GETME'>The changed<\/a> <a target=_blank title='macos_textutil_convert.php' href='http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php----GETME'>macos_textutil_convert.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php\" title=\"Click picture\">live run<\/a> link gets you to a &#8220;surfing the web&#8221; incarnation.<\/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\/pandoc-document-conversion-command-line-tutorial\/'>Pandoc Document Conversion Command Line Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdcmt'>Previous relevant <a target=_blank title='Pandoc Document Conversion Multiple Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pandoc-document-conversion-multiple-tutorial\/'>Pandoc Document Conversion Multiple Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Pandoc Document Conversion Multiple Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/pandoc_multiple.jpg\" title=\"Pandoc Document Conversion Multiple Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Pandoc Document Conversion Multiple Tutorial<\/p><\/div>\n<p>For &#8230;<\/p>\n<ul>\n<li>longer than we can remember we&#8217;ve really enjoyed batch processing &#8230;<\/li>\n<li>as long as we can remember we&#8217;ve really enjoyed the <a target=_blank title='Great link' href='http:\/\/www.html5rocks.com\/en\/tutorials\/file\/dndfiles\/'>File API<\/a> that came with HTML5 &#8230;<\/li>\n<li>([as long as we can remember] &#8211; 2 months) we&#8217;ve really enjoyed the File API input type=file <a target=_blank title='HTML input multiple property information from W3schools' href='https:\/\/www.w3schools.com\/tags\/att_input_multiple.asp#:~:text=The%20multiple%20attribute%20is%20a,types%3A%20email%2C%20and%20file.'>multiple<\/a> attribute &#8230;<\/li>\n<\/ul>\n<p> &#8230; and, adding to the recent <a title='Pandoc Document Conversion Primer Tutorial' href='#pdcpt'>Pandoc Document Conversion Primer Tutorial<\/a> all get a guernsey today &#8230; yay !!!<\/p>\n<p>It was the normal natural way to think, before GUI style operating systems, and the normal being command line, to achieve the most use of those precious (and more resource limited) computing resources to organize programs towards achieving procedural programmatical work for a &#8220;batch of data&#8221; if possible.  Of course, batch processing is still performing a lot of the hard computing tasks being performed on servers around the world today, but you&#8217;d be hard pressed to hear about much of it in the public realm, which is so admiring of individual use and personalization.  &#8220;Big data&#8221; thoughts though, bring thinking back to grouping those individual data sets together into a useful group analysis raison d&#8217;\u00eatre (no doubt needing batch processing again).<\/p>\n<p>To &#8220;sort of&#8221; meet the &#8220;batch processing&#8221; world with a web browser web application we have the File API input type=file multiple attribute to work with, and with our Document Conversion work (still focussed on local web server usage) the HTML &#8230;<\/p>\n<p><code><br \/>\n&lt;input type=file accept=\".pdf,.doc,.docx,.htm,.html,.txt\" <font color=red><a target=_blank title='HTML input multiple property information from W3schools' href='https:\/\/www.w3schools.com\/tags\/att_input_multiple.asp#:~:text=The%20multiple%20attribute%20is%20a,types%3A%20email%2C%20and%20file.'>multiple<\/a><\/font>&gt;&lt;\/input&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; along with the knowledge that even multiple files are selected from a single file path hidden from a File API coder but &#8220;localhost derivable&#8221; in that similar approach we used with the Haiku Creation web application (alas, only helping out macOS users (in this programmatical &#8220;in the background&#8221; approach), though Windows Pandoc&#8217;ers can fill the paths in within two new textboxes) &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\nif (isset($_GET['vsfs']) && isset($_GET['vsfn']) && isset($_GET['vsfi']) && isset($_GET['vsfu'])) {<br \/>\n  $docroot=dirname(__FILE__);<br \/>\n  if (file_exists(\"lookup_\" . str_replace(\")\",\"\",str_replace(\"(\",\"\",str_replace(\"+\",\" \",urldecode($_GET['vsfn'])))))) {<br \/>\n    unlink(\"lookup_\" . str_replace(\")\",\"\",str_replace(\"(\",\"\",str_replace(\"+\",\" \",urldecode($_GET['vsfn'])))));<br \/>\n  }<br \/>\n  exec(\"find \" . $_SERVER['DOCUMENT_ROOT'] . \" -name '\" . str_replace(\")\",\"*\",str_replace(\"(\",\"*\",str_replace(\"+\",\" \",urldecode($_GET['vsfn'])))) . \"' -exec ls -l {} \\\\; 2&gt; \/dev\/null &gt; lookup_\" . str_replace(\")\",\"\",str_replace(\"(\",\"\",str_replace(\"+\",\" \",urldecode($_GET['vsfn'])))));<br \/>\n  if (file_exists(\"lookup_\" . str_replace(\")\",\"\",str_replace(\"(\",\"\",str_replace(\"+\",\" \",urldecode($_GET['vsfn'])))))) {<br \/>\n    $infois=file_get_contents((\"lookup_\" . str_replace(\")\",\"\",str_replace(\"(\",\"\",str_replace(\"+\",\" \",urldecode($_GET['vsfn']))))));<br \/>\n    $lines=explode(\"\\n\", $infois);<br \/>\n    for ($il=0; $il&lt;sizeof($lines); $il++) {<br \/>\n      $lines[$il]=str_replace(\"\\r\",\"\",$lines[$il]);<br \/>\n      if (strpos($lines[$il], \" \" . $_GET['vsfs'] . \" \") !== false) {<br \/>\n        \/\/file_put_contents(\"look_\" . str_replace(\")\",\"\",str_replace(\"(\",\"\",str_replace(\"+\",\" \",urldecode($_GET['vsfn'])))), \"thisplace=\" . $docroot . \"\\n\" . \"rootplace=\" . $_SERVER['DOCUMENT_ROOT'] . \"\\n\" . \"origplace=\" . str_replace(\"+\",\" \",urldecode($_GET['vsfu'])) . \"\\n\" . \"foundplace=\" . explode(\" \", $lines[$il])[-1 + sizeof( explode(\" \", $lines[$il]))] . \"\\n\" . '&lt;html&gt;&lt;body onload=\" parent.document.getElementById(' . \"'\" . str_replace(\"+\",\" \",urldecode($_GET['vsfi'])) . \"'\" . \").value='\" . str_replace($_SERVER['DOCUMENT_ROOT'],explode(\"localhost\",str_replace(\"+\",\" \",urldecode($_GET['vsfu'])))[0] . \"localhost\" . explode(\"\/\",explode(\"localhost\",str_replace(\"+\",\" \",urldecode($_GET['vsfu'])))[1])[0] . \"\",explode(\" \", $lines[$il])[-1 + sizeof( explode(\" \", $lines[$il]))]) . \"'; \" . '\"&gt;&lt;\/body&gt;&lt;\/html&gt;');<br \/>\n        if (strpos(explode(\" \", $lines[$il])[-1 + sizeof( explode(\" \", $lines[$il]))], $_SERVER['DOCUMENT_ROOT']) !== false) {<br \/>\n          \/\/file_put_contents(\"x7.x7\",'&lt;html&gt;&lt;body onload=\" if (parent.document.getElementById(' . \"'\" . 'eangle' . \"'\" . ')) { parent.document.getElementById(' . \"'\" . 'eangle' . \"'\" . ').value=' . \"'\" . $ort . \"'\" . ';  } top.document.getElementById(' . \"'\" . str_replace(\"+\",\" \",urldecode($_GET['vsfi'])) . \"'\" . \").value='\" . $ort . \"'; \" . '\"&gt;&lt;\/body&gt;&lt;\/html&gt;');<br \/>\n          if (isset($_GET['turl'])) {<br \/>\n          echo \"&lt;html&gt;&lt;body onload=\\\" var tp='\" . str_replace(\"junk\" . $_SERVER['DOCUMENT_ROOT'],\"juJUNKnk\" . explode(\"localhost\",str_replace(\"+\",\" \",urldecode($_GET['vsfu'])))[0] . \"localhost\" . explode(\"\/\",explode(\"localhost\",str_replace(\"+\",\" \",urldecode($_GET['vsfu'])))[1])[0] . \"\",explode(\" \", $lines[$il])[-1 + sizeof( explode(\" \", $lines[$il]))]) . \"'; \" . \"  var tt='\" . str_replace(\"+\",\" \",urldecode($_GET['vsfn'])) . \"'; \"  . ' var ct=top.document.getElementById(' . \"'\" . 'cto' . \"'\" . ').value; ct=ct.replace(' . \"'\" . '*' . \"'\" . ',' . \"'\" . 'html' . \"'\" . '); top.document.getElementById(' . \"'\" . 'sin' . \"'\" . ').style.display=' . \"'\" . 'inline-block' . \"'\" . '; top.document.getElementById(' . \"'\" . 'path' . \"'\" . \").value=tp.replace(tt, ''); \" . ' top.document.getElementById(' . \"'\" . 'opath' . \"'\" . \").value=tp.replace(tt, ''); \" . '  top.selch(ct);   \"&gt;&lt;\/body&gt;&lt;\/html&gt;';<br \/>\n          } \/\/else {<br \/>\n          \/\/echo '&lt;html&gt;&lt;body onload=\" if (parent.document.getElementById(' . \"'\" . 'eangle' . \"'\" . ')) { parent.document.getElementById(' . \"'\" . 'eangle' . \"'\" . ').value=' . \"'\" . $ort . \"'\" . ';  } top.document.getElementById(' . \"'\" . str_replace(\"+\",\" \",urldecode($_GET['vsfi'])) . \"'\" . \").value='\" . $ort . \"'; \" . '\"&gt;&lt;\/body&gt;&lt;\/html&gt;';<br \/>\n          \/\/}<br \/>\n        } \/\/else if (isset($_GET['turl'])) {<br \/>\n          \/\/echo '&lt;html&gt;&lt;body onload=\" top.document.getElementById(' . \"'\" . 'turl' . \"'\" . \").placeholder='\" . str_replace($_SERVER['DOCUMENT_ROOT'],explode(\"localhost\",str_replace(\"+\",\" \",urldecode($_GET['vsfu'])))[0] . \"localhost\" . explode(\"\/\",explode(\"localhost\",str_replace(\"+\",\" \",urldecode($_GET['vsfu'])))[1])[0] . \"\",explode(\" \", $lines[$il])[-1 + sizeof( explode(\" \", $lines[$il]))]) . \"'; \" . '  top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').title=top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').placeholder;   top.document.getElementById(' . \"'\" . 'thewords' . \"'\" . ').title=top.document.getElementById(' . \"'\" . 'thewords' . \"'\" . ').title.replace( top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').value, top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').placeholder);   top.document.getElementById(' . \"'\" . 'thewords' . \"'\" . ').value=top.document.getElementById(' . \"'\" . 'thewords' . \"'\" . ').value.replace( top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').value, top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').placeholder);   top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').value=top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').placeholder;   top.document.getElementById(' . \"'\" . 'thewords' . \"'\" . ').value=top.document.getElementById(' . \"'\" . 'thewords' . \"'\" . ').value.replace( top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').value, top.document.getElementById(' . \"'\" . 'turl' . \"'\" . ').placeholder);  \"&gt;&lt;\/body&gt;&lt;\/html&gt;';<br \/>\n        \/\/} else {<br \/>\n        \/\/  echo '&lt;html&gt;&lt;body onload=\" parent.document.getElementById(' . \"'\" . str_replace(\"+\",\" \",urldecode($_GET['vsfi'])) . \"'\" . \").value='\" . str_replace($_SERVER['DOCUMENT_ROOT'],explode(\"localhost\",str_replace(\"+\",\" \",urldecode($_GET['vsfu'])))[0] . \"localhost\" . explode(\"\/\",explode(\"localhost\",str_replace(\"+\",\" \",urldecode($_GET['vsfu'])))[1])[0] . \"\",explode(\" \", $lines[$il])[-1 + sizeof( explode(\" \", $lines[$il]))]) . \"'; \" . '\"&gt;&lt;\/body&gt;&lt;\/html&gt;';<br \/>\n        \/\/}<br \/>\n        unlink(\"lookup_\" . str_replace(\")\",\"\",str_replace(\"(\",\"\",str_replace(\"+\",\" \",urldecode($_GET['vsfn'])))));<br \/>\n      } else {<br \/>\n        unlink(\"lookup_\" . str_replace(\")\",\"\",str_replace(\"(\",\"\",str_replace(\"+\",\" \",urldecode($_GET['vsfn'])))));<br \/>\n      }<br \/>\n    }<br \/>\n  }<br \/>\n  exit;<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p> &#8230; still assuming the files selected are off your local web server&#8217;s Document Root (but more on that later down the track, maybe).<\/p>\n<p>How do we reflect this multiple file (batch&#8217;y) processing talent with a way to display this in a web browser web application?   We choose to hive off each single input\/output Document Conversion data set into an individual popup window instance, and display there that output data as converted, if possible.<\/p>\n<p><a target=_blank title='macos_textutil_convert.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php---GETME'>The changed<\/a> <a target=_blank title='macos_textutil_convert.php' href='http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php---GETME'>macos_textutil_convert.php<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php\" title=\"Click picture\">live run<\/a> link calls on <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.html-------------GETME\">a changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/client_browsing.html-------------GETME\">client_browsing.htm<\/a> to reflect on this &#8220;batch&#8217;y&#8221; style multiple file capable Pandoc or textutil Document Conversion functionality.<\/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\/pandoc-document-conversion-multiple-tutorial\/'>Pandoc Document Conversion Multiple Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdcpt'>Previous relevant <a target=_blank title='Pandoc Document Conversion Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pandoc-document-conversion-primer-tutorial\/'>Pandoc Document Conversion 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\/macos_textutil_convert.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Pandoc Document Conversion Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/pandoc_matters.gif\" title=\"Pandoc Document Conversion Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Pandoc Document Conversion Primer Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a title='MacOS Document Conversion Primer Tutorial' href='#mosdcpt'>MacOS Document Conversion Primer Tutorial<\/a> left off with a link, as per &#8230;<\/p>\n<blockquote cite='\/\/www.rjmprogramming.com.au\/ITblog\/macos-document-conversion-primer-tutorial\/'><p>\n &#8230; read <a target=_blank title='Useful link' href='https:\/\/unix.stackexchange.com\/questions\/20859\/is-there-a-linux-equivalent-of-the-mac-os-x-command-textutil'>here<\/a>\n<\/p><\/blockquote>\n<p> &#8230; and it was here and with help from other links below that we took a big interest in a great Open Source product (great at Document Conversions) called <a target=_blank title='pandoc Document Conversion' href='https:\/\/pandoc.org\/'>pandoc<\/a> &#8230;<\/p>\n<ul>\n<li><a target=_blank title='3 command-line file conversion tools for Linux' href='https:\/\/opensource.com\/life\/16\/10\/3-file-conversion-tools-linux-command-line'>3 command-line file conversion tools for Linux<\/a><\/li>\n<li><a target=_blank title='Where do I get the pdflatex program for Mac?' href='https:\/\/superuser.com\/questions\/1038612\/where-do-i-get-the-pdflatex-program-for-mac'>Where do I get the pdflatex program for Mac?<\/a><\/li>\n<li><a target=_blank title='where is pandoc installed on windows' href='https:\/\/www.google.com\/search?q=where+is+pandoc+installed+on+windows&#038;rlz=1C5CHFA_enAU832AU832&#038;oq=where+is+pandoc+installed+on+windows&#038;aqs=chrome..69i57j0l4.10264j0j8&#038;sourceid=chrome&#038;ie=UTF-8'>where is pandoc installed on windows<\/a><\/li>\n<li><a target=_blank title='Setting up LaTeX on a Mac' href='http:\/\/nickgeorge.net\/programming\/latex_setup\/'>Setting up LaTeX on a Mac<\/a><\/li>\n<li><a target=_blank title='Getting MiKTeX' href='https:\/\/miktex.org\/download'>Getting MiKTeX<\/a><\/li>\n<\/ul>\n<p> &#8230; the reason for the interest in MikTeX being a wish to include pdflatex into the PATH as distinct from our preferred approach to add an additional switch &#8230;<\/p>\n<p><code><br \/>\n --pdf-engine=[pathTo]pdflatex<br \/>\n<\/code><\/p>\n<p> &#8230; to try to match the success of pandoc at the Terminal application command line but not with PHP exec usage.  This issue occurred with our macOS system after our two Homebrew install commands (in Terminal session) &#8230;<\/p>\n<p><code><br \/>\n$ brew install pandoc<br \/>\n$ brew cask install basictex<br \/>\n<\/code><\/p>\n<p> &#8230; and, visually, you can see some of with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/pandoc_matters.gif\">tutorial picture<\/a>.<\/p>\n<p>This Pandoc integration allows a way in for our web application to be operable for Windows or Linux servers where you have installed Pandoc, as well as pdflatex for Word to PDF conversions.  Clearly, to open the door to more platforms is a step we welcome, and may spare us a Panadol?!<\/p>\n<p><a target=_blank title='macos_textutil_convert.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php--GETME'>The changed<\/a> <a target=_blank title='macos_textutil_convert.php' href='http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php--GETME'>macos_textutil_convert.php<\/a> reflects this Pandoc integration.<\/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\/pandoc-document-conversion-primer-tutorial\/'>Pandoc Document Conversion Primer Tutorial<\/a>.<\/p-->\n<hr>\n<p id='mosdcpt'>Previous relevant <a target=_blank title='MacOS Document Conversion Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/macos-document-conversion-primer-tutorial\/'>MacOS Document Conversion 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\/macos_textutil_convert.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"MacOS Document Conversion Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/textutil_convert.jpg\" title=\"MacOS Document Conversion Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">MacOS Document Conversion Primer Tutorial<\/p><\/div>\n<p>A good thing about a &#8220;version control&#8221; or &#8220;source control&#8221; system is that you can &#8230;<\/p>\n<ul>\n<li>&#8220;pick up&#8221; from any version &#8230;<\/li>\n<li>&#8220;clone&#8221; to another name &#8230;<\/li>\n<li>&#8220;branch off&#8221; immediately into a new version &#8230;<\/li>\n<\/ul>\n<p> &#8230; to effectively &#8220;clone&#8221; the suitable progress point from a previous project as the start to a new project.<\/p>\n<p>So on top of yesterday&#8217;s &#8220;way back when&#8221; <a title='MacOS Text to Audio Primer Tutorial' href='#mostapt'>MacOS Text to Audio Primer Tutorial<\/a> early stage &#8220;progression point&#8221; of our &#8220;Voiceover Ideas&#8221; back to &#8220;macOS say&#8221; (just works with macOS and MacOS X underlying operating system under PHP &#8220;online presence&#8221;) interfacing, we &#8220;start off&#8221; a new &#8220;Document Conversion&#8221; web application (you guessed it) initially only working with macOS and MacOS X underlying operating system under PHP &#8220;online presence&#8221;.<\/p>\n<p>Like for below, Document Conversion via Mac OS X&#8217;s command line <a target=_blank title='textutil command information from Apple' href='https:\/\/ss64.com\/osx\/textutil.html'><i>textutil<\/i><\/a> command used by PHP via <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'><i>exec<\/i><\/a> to make <a target=_blank title='say.php' href='http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php-GETME'>macos_textutil_convert.php<\/a> &#8230; cloned via <a target=_blank title='say.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/macos_textutil_convert.php-GETME'>macos_textutil_convert.php<\/a> &#8230; (which is useful as a download to a Mac OS X laptop using <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a>) which, today, does not yet have a very interesting live run because the web server of domain <i>rjmprogramming.com.au<\/i> is a CentOS Linux server &#8230; Linux equivalent of Mac OS X&#8217;s <i>textutil<\/i>? &#8230; read <a target=_blank title='Useful link' href='https:\/\/unix.stackexchange.com\/questions\/20859\/is-there-a-linux-equivalent-of-the-mac-os-x-command-textutil'>here<\/a>.<\/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\/macos-document-conversion-primer-tutorial\/'>MacOS Document Conversion Primer Tutorial<\/a>.<\/p-->\n<hr>\n<p id='mostapt'>Previous relevant <a target=_blank title='MacOS Text to Audio Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/macos-text-to-audio-primer-tutorial\/'>MacOS Text to Audio 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\/animegif\/haiku_animated_gif.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"MacOS Text to Audio Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku__say.jpg\" title=\"MacOS Text to Audio Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">MacOS Text to Audio Primer Tutorial<\/p><\/div>\n<p>The previous <a title='Mac OS X Text to English Speech Primer Tutorial' href='#mosxtespt'>Mac OS X Text to English Speech Primer Tutorial<\/a> &#8230;<\/p>\n<ul>\n<li>lauded the &#8230;<br \/>\n<blockquote cite='\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-text-to-english-speech-primer-tutorial\/'><p>\nText to English Speech via Mac OS X&#8217;s command line <a target=_blank title='say command information from Apple' href='https:\/\/ss64.com\/osx\/say.html'><i>say<\/i><\/a> command\n<\/p><\/blockquote>\n<\/li>\n<li>and today we write some PHP (with its very useful <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'><i>exec<\/i><\/a> conduit to &#8220;say&#8221;) to make use of the same (macOS) &#8220;say&#8221; and its Text to Audio talents (via its &#8220;-o&#8221; switch usage)<\/li>\n<\/ul>\n<p> &#8230; and it&#8217;s at times like this we wish that the RJM Programming domain&#8217;s web server had a macOS operating system.  Alas, &#8220;say&#8221; is a macOS and Mac OS X application, but not a Linux one.<\/p>\n<p>None the less, we integrated &#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\/animegif\/haiku_animated_gif.html--GETME\" title=\"haiku_animated_gif.html\">today&#8217;s changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku_animated_gif.html--GETME\">haiku_animated_gif.html<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku_animated_gif.html\">Haiku creation and sharing web application live run<\/a> link&#8217;s workings (last talked about at <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/haiku-animated-gif-creator-tutorial\/' title='Haiku Animated Gif Creator Tutorial'>Haiku Animated Gif Creator Tutorial<\/a>) with &#8230;<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_say_record.php_GETME\" title=\"macos_say_record.php\">macos_say_record.php<\/a> macOS &#8220;say&#8221; PHP helper<\/li>\n<\/ul>\n<p> &#8230; so that if you had a <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'><i>MAMP<\/i><\/a> local Apache\/PHP\/MySql web server going, and you &#8230;<\/p>\n<ul>\n<li>downloaded <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php---------------GETME\" title=\"tutorial_to_animated_gif.php\">tutorial_to_animated_gif.php<\/a> to same MAMP subdirectory as &#8230;<\/li>\n<li>downloaded <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku_animated_gif.html--GETME\">haiku_animated_gif.html<\/a> to same MAMP place (which can be the same MAMP document root place as talked about below, in which case <i>HTTP:\/\/localhost:8888\/haiku_animated_gif.html<\/i> is what you&#8217;d type into the web browser address bar to try this for yourself on a macOS or Mac OS X system) &#8230; and &#8230;<\/li>\n<li>downloaded <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_say_record.php_GETME\" title=\"macos_say_record.php\">macos_say_record.php<\/a> to MAMP document root (for us, equating to URL <i>HTTP:\/\/localhost:8888\/macos_say_record.php<\/i>)<\/li>\n<\/ul>\n<p> &#8230; then you would be in the position to see a Haiku creation scenario (where we used the Safari web browser) like with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku__say.jpg\" title=\"tutorial picture\">tutorial picture<\/a>, interesting, in our view, regarding the integration &#8220;tactics&#8221; &#8230;<\/p>\n<ul>\n<li>parent Haiku window opens &#8230;<\/li>\n<li>child (popup) PHP &#8220;say&#8221; helper web application &#8230; which &#8230;<\/li>\n<li>passes back to parent &#8230;<br \/>\n<code><br \/>\n    <a target=_blank title='window.opener information from W3Schools' href='https:\/\/www.w3schools.com\/jsref\/prop_win_opener.asp'>window.opener<\/a>.document.getElementById('aurl').value=document.getElementById('result').value;<br \/>\n    window.opener.atab(window.opener.document.getElementById('aurl'));<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p> &#8230; achieving functionality we often ask HTML <a target=_blank title='HTML iframe information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>iframe<\/a> elements achieve for our code.  HTML iframe does have a role today, though.  It uses a favoured &#8220;client pre-emptive iframe&#8221; approach to determine whether we even try to open that popup window above via &#8230;<\/p>\n<ul>\n<li>HTML &#8230;<br \/>\n<code><br \/>\n&lt;div id=dif&gt;&lt;\/div&gt;<br \/>\n<\/code>\n<\/li>\n<li>Javascript &#8230;<br \/>\n<code><br \/>\n     var mampok=false, mampprefix='';<br \/>\n<br \/>\n     if (document.URL.indexOf('\/localhost') != -1) {<br \/>\n       mampprefix=\"http:\/\/localhost\" + document.URL.split('\/localhost')[1].split('\/')[0] + \"\/\";<br \/>\n       document.getElementById('dif').innerHTML=\"&lt;iframe onload='oicheck(this);' style='display:none;' src='http:\/\/localhost\" + document.URL.split('\/localhost')[1].split('\/')[0] + \"\/'&gt;&lt;\/iframe&gt;\";<br \/>\n     }<br \/>\n<br \/>\n function oicheck(iois) {<br \/>\n  mampok=false;<br \/>\n  if (iois != null) {<br \/>\n    var aconto = (iois.contentWindow || iois.contentDocument);<br \/>\n    if (aconto != null) {<br \/>\n     if (aconto.document) { aconto = aconto.document; }<br \/>\n     if (aconto.body != null) {<br \/>\n      if (aconto.body.innerHTML.toLowerCase().indexOf('&gt;not found&lt;') == -1 && aconto.body.innerHTML.toLowerCase().indexOf(\"our home page for your perusal\") == -1) { mampok=true; }<br \/>\n     }<br \/>\n    }<br \/>\n  }<br \/>\n }<br \/>\n<br \/>\n\/\/ and then later when the textarea has text and its onblur event is triggered ...<br \/>\n if (mampok) {<br \/>\n if (wois) { wois.close(); wois=null; }<br \/>\n wois=window.open(mampprefix + \"macos_say_record.php?saythis=\" + encodeURIComponent(document.getElementById('myta').value),\"_blank\",\"top=460,left=400,width=700,height=400\");<br \/>\n }<br \/>\n<\/code>\n<\/li>\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\/macos-text-to-audio-primer-tutorial\/'>MacOS Text to Audio Primer Tutorial<\/a>.<\/p-->\n<hr>\n<p id='mosxtespt'>Previous relevant <a target=_blank title='Mac OS X Text to English Speech Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-text-to-english-speech-primer-tutorial\/'>Mac OS X Text to English Speech 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\/audio_video.html?clickit=submitmb\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Mac OS X Text to English Speech Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/say.jpg\" title=\"Mac OS X Text to English Speech Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Mac OS X Text to English Speech Primer Tutorial<\/p><\/div>\n<p>We&#8217;ve got a few new ideas today &#8230;<\/p>\n<ol>\n<li>Text to English Speech via Mac OS X&#8217;s command line <a target=_blank title='say command information from Apple' href='https:\/\/ss64.com\/osx\/say.html'><i>say<\/i><\/a> command used by PHP via <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'><i>exec<\/i><\/a> to make <a target=_blank title='say.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/say.php_GETME'>say.php<\/a> (which is useful as a download to a Mac OS X laptop using <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a>) which, today, does not have a live run because the web server of domain <i>rjmprogramming.com.au<\/i> is a CentOS Linux server &#8230; Linux equivalent of Mac OS X&#8217;s <i>say<\/i>? &#8230; read <a target=_blank title='Useful link' href='https:\/\/github.com\/usc-isi-i2\/festival-text-to-speech-service\/blob\/master\/README.md'>here<\/a><\/li>\n<li>Trying to present this brought up the usual movie production problem with <a target=_blank title='iMovie for Mac information from Apple' href='http:\/\/www.apple.com\/au\/mac\/imovie\/'>iMovie<\/a> overlaying the audio on top of the video (though you may want to try, and you could start reading with <a target=_blank title='Semi useful link' href='http:\/\/video.stackexchange.com\/questions\/2579\/can-you-link-an-audio-track-to-a-video-track-in-imovie'>this link<\/a>) versus <a target=_blank title='QuickTime information from Apple' href='https:\/\/support.apple.com\/downloads\/quicktime'>QuickTime Player<\/a> talent to catch both audio and video tracks (and that we ended up using), but not of the &#8220;screen goings on&#8221;, alas versus <a target=_blank title='MPlayer OSX Extended information' href='http:\/\/mplayerosx.ch\/'>MPlayer OSX Extended<\/a> which can play separately but not two tracks on top and doesn&#8217;t do any reconstituting &#8230; so &#8230;<\/li>\n<li>Improved on our inhouse Video\/Audio synchronizing efforts by allowing <a target=_blank title='audio_video.html' href='http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html---GETME'>audio_video.html<\/a> supervisor (changed in <a target=_blank title='audio_video.html' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html---GETME'>this way<\/a>) be able to be called to press one of its preconceived synchronization buttons <i>onload<\/i> which we do with (the newly added) <a target=_blank title='Macbeth Act 1 Scene 1' href='http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html?clickit=submitmb'>Macbeth Act 1 Scene 1<\/a> &#8230; in a small <a target=_blank title='Birthday of Shakespeare' href='http:\/\/www.shakespeare.org.uk\/visit-the-houses\/whats-on.html\/birthday-celebrations.html'>celebration<\/a> of the Bard &#8230; who, am thinking (in that Falstaff way), would have got a huge chuckle out of &#8220;anonymous&#8221; instead of &#8220;anon&#8221; during the Three Witches scene &#8230; we <i>had<\/i> to do something to say Happy Birthday<\/li>\n<\/ol>\n<p>Along the way we tried filming the MacBook Pro with the iPad to a <a target=_blank title='YouTube' href='http:\/\/youtube.com'>YouTube<\/a> &#8230;<\/p>\n<p><iframe loading=\"lazy\" width=\"420\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/9-Hvlz8g1Mg\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p> &#8230; but weren&#8217;t happy with the audio quality, alas (too\/two).<\/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='#d21904' onclick='var dv=document.getElementById(\"d21904\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/text-to-speech\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d21904' 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='#d49544' onclick='var dv=document.getElementById(\"d49544\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/audio\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49544' 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='#d49695' onclick='var dv=document.getElementById(\"d49695\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/document\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49695' 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='#d49700' onclick='var dv=document.getElementById(\"d49700\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/pdf\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49700' 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='#d49713' onclick='var dv=document.getElementById(\"d49713\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/batch\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49713' 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='#d49721' onclick='var dv=document.getElementById(\"d49721\"); 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='d49721' 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='#d49731' onclick='var dv=document.getElementById(\"d49731\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/email\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49731' 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 Pandoc Document Conversion Command Line Tutorial Document Conversion progress we&#8217;ve been wondering how to offer assistance in our public realm up at the rjmprogramming.com.au domain. Today, as you can see with our YouTube video presentation, we&#8217;ve &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/pandoc-document-conversion-email-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,29,37],"tags":[113,126,135,3349,234,284,349,380,405,587,677,2114,714,725,2178,744,760,2092,885,3365,913,3366,932,967,997,1083,2350,1105,3350,1258,1262,3364,1319,1411,1583,1433,3010],"class_list":["post-49731","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-operating-system","category-tutorials","tag-audio","tag-background","tag-batch","tag-client-pre-emptive-iframe","tag-command-line","tag-curl","tag-document","tag-email","tag-exec","tag-iframe","tag-korn-shell","tag-listener","tag-local-web-server","tag-mac-os-x","tag-macos","tag-mamp","tag-media","tag-multiple","tag-operating-system-2","tag-pandoc","tag-pdf","tag-pdflatex","tag-php","tag-popup","tag-programming","tag-safari","tag-say","tag-script","tag-text-to-audio","tag-text-to-speech","tag-textarea","tag-textutil","tag-tutorial","tag-web-server","tag-window","tag-window-open","tag-window-opener"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49731"}],"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=49731"}],"version-history":[{"count":14,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49731\/revisions"}],"predecessor-version":[{"id":49753,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49731\/revisions\/49753"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=49731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=49731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=49731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}