On top of yesterday’s Pandoc Document Conversion Command Line Tutorial Document Conversion progress we’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’ve got it so that …
… offers that last Email and Download link to help out a user …
- who is not interested in installing any PHP local Apache web servers … but …
- is using macOS or Mac OS X (and so can access textutil) … and/or …
- has installed (the Open Source) pandoc (with pdflatex perhaps)
… and who establishes an inhouse Downloads folder listener script such as our convert_this_please.ksh Korn Shell one that we execute (in the background) via …
ksh convert_this_please.ksh &
… and looks out for the Email Document(s) button functionality of …
… with the file naming conventions (after email attachment download(s)) …
Downloads Path |
---|
${HOME}/Downloads |
Downloads Input Name |
convert_this_please_[OutputExt]_[OriginalInput_Name].[OriginalInput_Ext] |
Downloads Output Name |
convertthisplease[OutputExt][OriginalInputName].[OutputExt] |
… effectively bypassing any local PHP web server for direct command line processing via downloaded email attachments.
The changed macos_textutil_convert.php live run link calls on a changed client_browsing.htm and gets you to a “surfing the web” incarnation.
As intimated, below we show this functionality in action …
Previous relevant Pandoc Document Conversion Command Line Tutorial is shown below.
Yesterday’s Pandoc Document Conversion Multiple Tutorial intimated what direction we might be taking up today, when it said …
… still assuming the files selected are off your local web server’s Document Root (but more on that later down the track, maybe).
Considering this challenge, the “outside your usual thought pattern box”, perhaps, would be to remember that PHP’s modes of use can be…
- surfing the web (with a web browser) …
- curl (at command line) …
- command line
… and it is introducing that “command line” PHP mode of use above that can strip out the relevance of $_SERVER[‘DOCUMENT_ROOT’] (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 …
Description | Default |
---|---|
Input path | dirname(__FILE__) |
Input filespec | |
Output path | dirname(__FILE__) |
Output file extension |
This web application (now also command line app, given you have a local web server featuring PHP such as MAMP) suits this “command line” mode of use ahead of its “surfing the net” way for a couple of reasons (to us) …
- we think “command line” gets conversions done faster …
- as per yesterday’s challenge, given file permission allowances, you can read and write to places that aren’t within the $_SERVER[‘DOCUMENT_ROOT’] directory hierarchy
- as a PHP programmer, these modes of use can be neatly separated … the “command line” mode of use code is totally self contained …
<?php
if (isset($argv)) { // command line
$numargs = sizeof($argv);
if ($numargs <= 4) {
if (PHP_OS == 'WINNT') {
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";
$line = stream_get_line(STDIN, 1024, PHP_EOL);
if (str_replace("\n", "", $line) == "") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
$lineinspec = stream_get_line(STDIN, 1024, PHP_EOL);
$outline = stream_get_line(STDIN, 1024, PHP_EOL);
if (str_replace("\n", "", $outline) == "") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
$outlineinspec = stream_get_line(STDIN, 1024, PHP_EOL);
} else {
$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");
if (str_replace("\n", "", $line) == "") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
$lineinspec = readline('');
$outline = readline('');
if (str_replace("\n", "", $outline) == "") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
$outlineinspec = readline('');
}
$cmdsuff="";
if ($verb != "textutil" && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] == "pdf") {
if (file_exists("/Library/TeX/Root/bin/x86_64-darwin/pdflatex")) {
$cmdsuff=" --pdf-engine=/Library/TeX/Root/bin/x86_64-darwin/pdflatex";
} else if (file_exists("/Library/TeX/texbin/pdflatex")) {
$cmdsuff=" --pdf-engine=/Library/TeX/texbin/pdflatex";
} else {
$cmdsuff=" --pdf-engine=pdflatex";
}
}
$openers="";
$openersdelim="";
foreach (glob($line . $lineinspec) as $filename) {
$outnameis=$outline . str_replace("." . explode(".", basename($filename))[-1 + sizeof(explode(".", basename($filename)))], ".", basename($filename)) . str_replace(".", "", $outlineinspec);
if (file_exists($outnameis)) {
$sufext="_0";
$iext=0;
$rone="";
$rtwo="";
while (file_exists($outnameis . $sufext)) {
$iext++;
$sufext="_" . $iext;
}
$rtwo=$outnameis;
$rone=$outnameis . $sufext;
echo "Renaming " . $outnameis . " to " . $outnameis . $sufext . "\n";
try {
rename($outnameis, $outnameis . $sufext);
} catch (Exception $e) {
echo $e->getMessage() . "\n";
}
if (!file_exists($outnameis . $sufext)) {
echo "Renaming did not happen." . "\n";
}
}
if (explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] == "pdJUNKf") {
echo ("php " . $argv[0] . " " . $line . " " . basename($filename) . " " . $outline . " " . $outlineinspec . "\n");
passthru("php " . $argv[0] . " " . $line . " " . basename($filename) . " " . $outline . " " . $outlineinspec);
} else {
//echo ($verb . " " . $switchone . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
echo ($verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err \n");
exec($verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
if (file_exists("macos_textutil_convert.out") && file_exists("macos_textutil_convert.err")) {
if (filesize("macos_textutil_convert.out") == 0 && filesize("macos_textutil_convert.err") != 0) {
if ($rone != "" && $rtwo != "") {
echo "Renaming " . $rone . " back to " . $rtwo . "\n";
rename($rone, $rtwo);
}
echo "\n\n" . file_get_contents("macos_textutil_convert.err") . "\n\n";
}
}
if (PHP_OS == "Darwin") { // && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] != "pdf") {
if (file_exists($outnameis)) {
$openers.=$openersdelim . "open " . $outnameis;
$openersdelim=" ; ";
}
}
}
}
if (PHP_OS == "Darwin" && $openers != "") {
echo "\n\nWill try to open successful (or old resurrected) files in 8 seconds ...\n";
sleep(8);
echo ($openers . " \n");
exec($openers);
}
//echo "do the work";
} else {
$openers="";
$openersdelim="";
$line=trim($argv[1]);
if (str_replace("\n", "", $line) == "") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
$lineinspec=$argv[2];
$outline=trim($argv[3]);
if (str_replace("\n", "", $outline) == "") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
$outlineinspec=$argv[4];
$cmdsuff="";
if ($verb != "textutil" && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] == "pdf") {
if (file_exists("/Library/TeX/Root/bin/x86_64-darwin/pdflatex")) {
$cmdsuff=" --pdf-engine=/Library/TeX/Root/bin/x86_64-darwin/pdflatex";
} else if (file_exists("/Library/TeX/texbin/pdflatex")) {
$cmdsuff=" --pdf-engine=/Library/TeX/texbin/pdflatex";
} else {
$cmdsuff=" --pdf-engine=pdflatex";
}
}
foreach (glob($line . $lineinspec) as $filename) {
$outnameis=$outline . str_replace("." . explode(".", basename($filename))[-1 + sizeof(explode(".", basename($filename)))], ".", basename($filename)) . str_replace(".", "", $outlineinspec);
if (file_exists($outnameis)) {
$sufext="_0";
$iext=0;
$rone="";
$rtwo="";
while (file_exists($outnameis . $sufext)) {
$iext++;
$sufext="_" . $iext;
}
$rtwo=$outnameis;
$rone=$outnameis . $sufext;
echo "Renaming " . $outnameis . " to " . $outnameis . $sufext . "\n";
rename($outnameis, $outnameis . $sufext);
}
//echo ($verb . " " . $switchone . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
echo ($verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err \n");
exec($verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
if (file_exists("macos_textutil_convert.out") && file_exists("macos_textutil_convert.err")) {
if (filesize("macos_textutil_convert.out") == 0 && filesize("macos_textutil_convert.err") != 0) {
if ($rone != "" && $rtwo != "") {
echo "Renaming " . $rone . " back to " . $rtwo . "\n";
rename($rone, $rtwo);
}
echo "\n\n" . file_get_contents("macos_textutil_convert.err") . "\n\n";
}
}
if (PHP_OS == "Darwin") { // && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] != "pdf") {
if (file_exists($outnameis)) {
$openers.=$openersdelim . "open " . $outnameis;
$openersdelim=" ; ";
}
}
}
if (PHP_OS == "Darwin" && $openers != "") {
echo "\n\nWill try to open successful (or old resurrected) files in 8 seconds ...\n";
sleep(8);
echo ($openers . " \n");
exec($openers);
}
//echo "Do the work ";
}
exit;
}
?>
The changed macos_textutil_convert.php live run link gets you to a “surfing the web” incarnation.
Previous relevant Pandoc Document Conversion Multiple Tutorial is shown below.
For …
- longer than we can remember we’ve really enjoyed batch processing …
- as long as we can remember we’ve really enjoyed the File API that came with HTML5 …
- ([as long as we can remember] – 2 months) we’ve really enjoyed the File API input type=file multiple attribute …
… and, adding to the recent Pandoc Document Conversion Primer Tutorial all get a guernsey today … yay !!!
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 “batch of data” 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’d be hard pressed to hear about much of it in the public realm, which is so admiring of individual use and personalization. “Big data” thoughts though, bring thinking back to grouping those individual data sets together into a useful group analysis raison d’être (no doubt needing batch processing again).
To “sort of” meet the “batch processing” 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 …
<input type=file accept=".pdf,.doc,.docx,.htm,.html,.txt" multiple></input>
… along with the knowledge that even multiple files are selected from a single file path hidden from a File API coder but “localhost derivable” in that similar approach we used with the Haiku Creation web application (alas, only helping out macOS users (in this programmatical “in the background” approach), though Windows Pandoc’ers can fill the paths in within two new textboxes) …
<?php
if (isset($_GET['vsfs']) && isset($_GET['vsfn']) && isset($_GET['vsfi']) && isset($_GET['vsfu'])) {
$docroot=dirname(__FILE__);
if (file_exists("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))))) {
unlink("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
}
exec("find " . $_SERVER['DOCUMENT_ROOT'] . " -name '" . str_replace(")","*",str_replace("(","*",str_replace("+"," ",urldecode($_GET['vsfn'])))) . "' -exec ls -l {} \\; 2> /dev/null > lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
if (file_exists("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))))) {
$infois=file_get_contents(("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn']))))));
$lines=explode("\n", $infois);
for ($il=0; $il<sizeof($lines); $il++) {
$lines[$il]=str_replace("\r","",$lines[$il]);
if (strpos($lines[$il], " " . $_GET['vsfs'] . " ") !== false) {
//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" . '<html><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]))]) . "'; " . '"></body></html>');
if (strpos(explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))], $_SERVER['DOCUMENT_ROOT']) !== false) {
//file_put_contents("x7.x7",'<html><body onload=" if (parent.document.getElementById(' . "'" . 'eangle' . "'" . ')) { parent.document.getElementById(' . "'" . 'eangle' . "'" . ').value=' . "'" . $ort . "'" . '; } top.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . $ort . "'; " . '"></body></html>');
if (isset($_GET['turl'])) {
echo "<html><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); "></body></html>';
} //else {
//echo '<html><body onload=" if (parent.document.getElementById(' . "'" . 'eangle' . "'" . ')) { parent.document.getElementById(' . "'" . 'eangle' . "'" . ').value=' . "'" . $ort . "'" . '; } top.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . $ort . "'; " . '"></body></html>';
//}
} //else if (isset($_GET['turl'])) {
//echo '<html><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); "></body></html>';
//} else {
// echo '<html><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]))]) . "'; " . '"></body></html>';
//}
unlink("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
} else {
unlink("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
}
}
}
exit;
}
?>
… still assuming the files selected are off your local web server’s Document Root (but more on that later down the track, maybe).
How do we reflect this multiple file (batch’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.
The changed macos_textutil_convert.php live run link calls on a changed client_browsing.htm to reflect on this “batch’y” style multiple file capable Pandoc or textutil Document Conversion functionality.
Previous relevant Pandoc Document Conversion Primer Tutorial is shown below.
Yesterday’s MacOS Document Conversion Primer Tutorial left off with a link, as per …
… read here
… 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 pandoc …
- 3 command-line file conversion tools for Linux
- Where do I get the pdflatex program for Mac?
- where is pandoc installed on windows
- Setting up LaTeX on a Mac
- Getting MiKTeX
… 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 …
--pdf-engine=[pathTo]pdflatex
… 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) …
$ brew install pandoc
$ brew cask install basictex
… and, visually, you can see some of with today’s tutorial picture.
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?!
The changed macos_textutil_convert.php reflects this Pandoc integration.
Previous relevant MacOS Document Conversion Primer Tutorial is shown below.
A good thing about a “version control” or “source control” system is that you can …
- “pick up” from any version …
- “clone” to another name …
- “branch off” immediately into a new version …
… to effectively “clone” the suitable progress point from a previous project as the start to a new project.
So on top of yesterday’s “way back when” MacOS Text to Audio Primer Tutorial early stage “progression point” of our “Voiceover Ideas” back to “macOS say” (just works with macOS and MacOS X underlying operating system under PHP “online presence”) interfacing, we “start off” a new “Document Conversion” web application (you guessed it) initially only working with macOS and MacOS X underlying operating system under PHP “online presence”.
Like for below, Document Conversion via Mac OS X’s command line textutil command used by PHP via exec to make macos_textutil_convert.php … cloned via macos_textutil_convert.php … (which is useful as a download to a Mac OS X laptop using MAMP) which, today, does not yet have a very interesting live run because the web server of domain rjmprogramming.com.au is a CentOS Linux server … Linux equivalent of Mac OS X’s textutil? … read here.
Previous relevant MacOS Text to Audio Primer Tutorial is shown below.
The previous Mac OS X Text to English Speech Primer Tutorial …
- lauded the …
Text to English Speech via Mac OS X’s command line say command
- and today we write some PHP (with its very useful exec conduit to “say”) to make use of the same (macOS) “say” and its Text to Audio talents (via its “-o” switch usage)
… and it’s at times like this we wish that the RJM Programming domain’s web server had a macOS operating system. Alas, “say” is a macOS and Mac OS X application, but not a Linux one.
None the less, we integrated …
- today’s changed haiku_animated_gif.html‘s Haiku creation and sharing web application live run link’s workings (last talked about at Haiku Animated Gif Creator Tutorial) with …
- macos_say_record.php macOS “say” PHP helper
… so that if you had a MAMP local Apache/PHP/MySql web server going, and you …
- downloaded tutorial_to_animated_gif.php to same MAMP subdirectory as …
- downloaded haiku_animated_gif.html to same MAMP place (which can be the same MAMP document root place as talked about below, in which case HTTP://localhost:8888/haiku_animated_gif.html is what you’d type into the web browser address bar to try this for yourself on a macOS or Mac OS X system) … and …
- downloaded macos_say_record.php to MAMP document root (for us, equating to URL HTTP://localhost:8888/macos_say_record.php)
… then you would be in the position to see a Haiku creation scenario (where we used the Safari web browser) like with today’s tutorial picture, interesting, in our view, regarding the integration “tactics” …
- parent Haiku window opens …
- child (popup) PHP “say” helper web application … which …
- passes back to parent …
window.opener.document.getElementById('aurl').value=document.getElementById('result').value;
window.opener.atab(window.opener.document.getElementById('aurl'));
… achieving functionality we often ask HTML iframe elements achieve for our code. HTML iframe does have a role today, though. It uses a favoured “client pre-emptive iframe” approach to determine whether we even try to open that popup window above via …
- HTML …
<div id=dif></div>
- Javascript …
var mampok=false, mampprefix='';
if (document.URL.indexOf('/localhost') != -1) {
mampprefix="http://localhost" + document.URL.split('/localhost')[1].split('/')[0] + "/";
document.getElementById('dif').innerHTML="<iframe onload='oicheck(this);' style='display:none;' src='http://localhost" + document.URL.split('/localhost')[1].split('/')[0] + "/'></iframe>";
}
function oicheck(iois) {
mampok=false;
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
if (aconto.body.innerHTML.toLowerCase().indexOf('>not found<') == -1 && aconto.body.innerHTML.toLowerCase().indexOf("our home page for your perusal") == -1) { mampok=true; }
}
}
}
}
// and then later when the textarea has text and its onblur event is triggered ...
if (mampok) {
if (wois) { wois.close(); wois=null; }
wois=window.open(mampprefix + "macos_say_record.php?saythis=" + encodeURIComponent(document.getElementById('myta').value),"_blank","top=460,left=400,width=700,height=400");
}
- Text to English Speech via Mac OS X’s command line say command used by PHP via exec to make say.php (which is useful as a download to a Mac OS X laptop using MAMP) which, today, does not have a live run because the web server of domain rjmprogramming.com.au is a CentOS Linux server … Linux equivalent of Mac OS X’s say? … read here
- Trying to present this brought up the usual movie production problem with iMovie overlaying the audio on top of the video (though you may want to try, and you could start reading with this link) versus QuickTime Player talent to catch both audio and video tracks (and that we ended up using), but not of the “screen goings on”, alas versus MPlayer OSX Extended which can play separately but not two tracks on top and doesn’t do any reconstituting … so …
- Improved on our inhouse Video/Audio synchronizing efforts by allowing audio_video.html supervisor (changed in this way) be able to be called to press one of its preconceived synchronization buttons onload which we do with (the newly added) Macbeth Act 1 Scene 1 … in a small celebration of the Bard … who, am thinking (in that Falstaff way), would have got a huge chuckle out of “anonymous” instead of “anon” during the Three Witches scene … we had to do something to say Happy Birthday
Previous relevant Mac OS X Text to English Speech Primer Tutorial is shown below.
We’ve got a few new ideas today …
Along the way we tried filming the MacBook Pro with the iPad to a YouTube …
… but weren’t happy with the audio quality, alas (too/two).
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.