WordPress Blog Search Within Search Preview Tutorial

WordPress Blog Search Within Search Preview Tutorial

WordPress Blog Search Within Search Preview Tutorial

Yesterday’s “filter a search” (or “search within a search”) ideas of WordPress Blog Search Within Search Implementation Tutorial as shown below, were improvements on the day before, but we feel as though the user lacks some controls that would be good on the functionality.

By that we mean that many windows may open without the chance for the user to review their findings. We think the user would feel more in control of things if it were possible for them to have a dropdown (HTML select) element that can review the findings, and then they can pick or choose what is interesting … after all, with yesterday’s scenario, they are not told what the resultant blog posting titles are ahead of having them come up in a new web browser tab already displayed, so, today, as an optionally available extra piece of functionality we allow in the Javascript Prompt window the additional prefixes of …

  • @!@ … just dropdown
  • @+@ … additional dropdown
  • @|@ … just open dropdown (ie. all the options are available to see, on a non-mobile platform)
  • @*@ … additional open dropdown
  • @[secsDelay]@ … stage the finding openings with a [secsDelay] seconds delay between new browser tabs opening

To make this happen, and not involve server files, and be able to handle the changes in the Javascript (written out by the PHP), we use an iframe element which can “look back” to top.document to alter the parent web page’s content … in this case, the parent webpage’s relevant dropdown (HTML select) element containing Blog Posting findings of interest picked up from our “filtered search” (or “search within a search”) functionality.

We hope you find this useful and will leave you with changes to the WordPress blog’s TwentyTen theme’s header.php in red bold itallic for the latest changes and in bold itallic for yesterday’s changes and just in bold for day before yesterday’s (WordPress Blog Search Within a Search Primer Tutorial) changes below …



var spc=' ', cminus='-', fmtname='w411tform', fmcname='w411cform', edelim='/', radis="", formihis="";

var precwopen='', cwopen='', scmdis='', tcdelay=0, ourtcdelay=0, ourtcprefix='', tcprefix='', tcsuffix=' ... prefixes: @!@ just dropdown, @+@ additional dropdown, @|@ just open dropdown, @*@ additional open dropdown, @[secsDelay]@';
var iurlcnt=0, jurlcnt=0, urllist = new Array(), whenlist = new Array(), nextis=-1, optcol='yellow';
function checkseltc() {
var wqe=document.getElementById('seltc').innerHTML.split('value=');
var zdelim=' ', zurllist;
jurlcnt=eval(-1 + wqe.length);
if (jurlcnt > 0) {
for (var iyt=2; iyt<wqe.length; iyt++) {
zdelim = wqe[iyt].substring(0,1);
zurllist = wqe[iyt].substring(1).split(zdelim);
urllist[eval(-2 + iyt)] = zurllist[0];
if (iyt == 2) {
whenlist[eval(-2 + iyt)] = tcdelay;
} else {
whenlist[eval(-2 + iyt)] = eval(tcdelay + eval(whenlist[eval(-3 + iyt)]));
}
if (nextis < 0) nextis = 0;
}
}
document.getElementById('seltc').size = eval(-1 + wqe.length);
iurlcnt++;
if (nextis >= 0) {
if (eval(nextis) < eval(whenlist.length)) {
if (eval(iurlcnt) == whenlist[nextis]) {
if (urllist[nextis] != "") tcwindowopen(urllist[nextis]);
nextis++;
if (eval(nextis) == eval(whenlist.length)) top.document.getElementById('seltc').style.display='block';
}
}
}
}
function reprompt(insg) {
tcprefix="";
if ((insg + " ").substring(0,1) == "@") {
var tcst=insg.substring(1).split("@");
if (tcst.length > 1) {
tcprefix = tcst[0];
insg=insg.replace("@" + tcprefix + "@", "");
if (tcprefix == "!") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='http://www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix == "|") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='http://www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix == "+") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='http://www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix == "*") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='http://www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix != "") {
var tcd=tcprefix.split(".");
tcdelay=eval(tcd[0]);
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='http://www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
tcprefix='';
optcol='lightgreen';
}
}
}
return insg;
}
function reurl(inu) {
var newinu;
if (tcprefix != "") {
if (tcprefix.substring(0,1) == '!' || tcprefix.substring(0,1) == '+' || tcprefix.substring(0,1) == '|' || tcprefix.substring(0,1) == '*') {
newinu=inu.replace('window.open(', '').replace('location.href=', '').replace(';', '').replace(';', '').split(', "_blank');
document.getElementById('tciframe').src=eval(newinu[0]) + "&tcprefix=" + tcprefix;
if (tcprefix.substring(0,1) == '|' || tcprefix.substring(0,1) == '*') setInterval(checkseltc, 1000);
if (tcprefix.substring(0,1) == '!' || tcprefix.substring(0,1) == '|') {
return "";
}
}
inu = inu; //.replace("wopenall", "tcprefix=" + tcprefix + "&wopenall");
}
if (tcdelay != 0) {
inu = inu; //.replace("wopenall", "&tcdelay=" + tcdelay + "&wopenall");
newinu=inu.replace('window.open(', '').replace('location.href=', '').replace(';', '').replace(';', '').split(', "_blank');
document.getElementById('tciframe').src=eval(newinu[0]) + "&tcdelay=" + tcdelay;
setInterval(checkseltc, 1000);
return "";
}
return eval(inu);
}

function preradiocc() {
if (document.getElementById('s').value != "" && radis != "") {
radiocc(radis);
}
}
function radiocc(tvis) {
var cok=1;
cwopen="";
radis=tvis;
if (document.getElementById('s').value != "") {
if (tvis == "Search") {
document.getElementById('searchsubmit').click();
} else if (tvis == "Tag") {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Tag findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + ")", document.getElementById('s').value);
if (cwopen != null) {
precwopen = document.getElementById("s").value;
cwopen=reprompt(cwopen);
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "?tag=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "?tag=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;');
}
} else {
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "tag/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "tag/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;');
}
}
}
} else if (tvis == "Category") {
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (document.getElementById('s').value.substring(0,1) >= '0' && document.getElementById('s').value.substring(0,1) <= '9') {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (number) findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + ")", "Tutorial");
if (cwopen != null) {
precwopen = document.getElementById("s").value;
cwopen=reprompt(cwopen);
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "?cat=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "?cat=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;');
}
}
} else {
cok=0;
alert("Please enter the category as a number");
document.getElementById('s').value = '';
}
} else {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (alphabetic) findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + ")", document.getElementById('s').value);
if (cwopen != null) {
precwopen = document.getElementById("s").value;
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "category/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "category/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;');
}
}
}
}
if (cok == 1) {
document.getElementById('s').value = '';
radis="";
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
}
}
}

function preprecc(inidea) { // wopenallwas= form
<?php
$tblurbwas="";
if (isset($_GET['wopenallwas']) || isset($_GET['wopenall'])) {
$tblurbwas = " var ourwovwas=location.search.split(inidea + '=')[1] ? location.search.split(inidea + '=')[1].split('&')[0] : ' '; \n";
$tblurbwas .= " if (ourwovwas != ' ') { \n";
$tblurbwas .= " document.body.innerHTML = '<div id=\"verytop\" align=\"center\" style=\"background-color: yellow;\"><table cellpadding=25 cellspacing=25><tr><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 3.0.3<br><br><form action=\"http://www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Tag (alpha): <input type=\"text\" name=\"tag\" id=\"tag\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form action=\"http://www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Category (numerical): <input type=\"number\" name=\"cat\" id=\"cat\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 4.1.1<br><br><form id=\"w411tform\" action=\"https://www.rjmprogramming.com.au/ITblog/tag/\" method=\"GET\"> Tag (alpha): <input type=\"text\" onblur=\" document.getElementById(fmtname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form id=\"w411cform\" action=\"https://www.rjmprogramming.com.au/ITblog/category/\" method=\"GET\"> Category (alpha): <input onblur=\" document.getElementById(fmcname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" type=\"text\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td></tr></table></div>' + document.body.innerHTML; \n";
$tblurbwas .= " } \n";
}
echo $tblurbwas;
?>
}

function tcwindowopen(inuis) {
window.open(inuis, '_blank');
}

function precc() { // wopenall= functionality
preprecc('wopenallwas');
document.getElementById('searchsubmit').style.display='none';
formihis = document.getElementById('searchform').innerHTML.replace("</div>", "<input style='display:none;' type='radio' name='stype' value=''><input onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Search<input onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'>Tag<input onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>Category<select id='seltc' style='display:none;' onchange=\"tcwindowopen(this.value);\" size='1'><option value=''>Blog Postings below ...</option></select></div>");
formihis = formihis.replace("input id", "input onblur='preradiocc();' id");
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
<?php
$tblurb="";
if (isset($_GET['wopenall'])) {
$tpage=1;
$furl="";
$sru=explode("?", $_SERVER['REQUEST_URI']);
if (isset($_GET['paged'])) {
$tpage=$_GET['paged'];
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
$furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
} else if (isset($_GET['tag']) || isset($_GET['cat']) || isset($_GET['s'])) {
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
if (1 == 2) $furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
} else if (strpos("/wordpress/", $_SERVER['REQUEST_URI']) !== false) {
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$tblurb = " location.href='" . $nurl . "'; \n";
} else {
$tstuff=explode("page/", $sru[0]);
if (sizeof($tstuff) > 1) {
$tstu=explode("/", $tstuff[1]);
$tpage=$tstu[0];
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
} else {
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
if (1 == 2) $furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
}
}
if ($tblurb == "") {
$tblurb = " ourtcprefix=location.search.split('tcprefix=')[1] ? location.search.split('tcprefix=')[1].split('&')[0] : ''; \n";
$tblurb .= " ourtcdelay=location.search.split('tcdelay=')[1] ? location.search.split('tcdelay=')[1].split('&')[0] : 0; \n";
$tblurb .=
" var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' '; \n";
$tblurb .= " var ows, owstwo, iot, hl=1; \n";
$tblurb .= " if (ourwov != ' ') { \n";
$tblurb .= " var hones=docgetclass('entry-title', 'h1'); \n";
$tblurb .= " hl=hones.length; \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " for (iot=0; iot<hones.length; iot++) { \n";
$tblurb .= " if (hones[iot].innerHTML.indexOf('Not Found') != -1) hl=eval(-1 + hl); \n";
$tblurb .= " if (ourwov == '' || hones[iot].innerHTML.toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";
$tblurb .= " ows=hones[iot].innerHTML.split('href='); \n";
$tblurb .= " if (ows.length > 1) { \n";
$tblurb .= " owstwo=ows[1].substring(1).split(ows[1].substring(0,1)); \n";
$tblurb .= " if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*') || (ourtcprefix != '' || tcprefix != '') || (ourtcdelay != 0 || tcdelay != 0)) { if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*')) { top.document.getElementById('seltc').style.display='block'; } else { optcol='lightgreen'; } top.document.getElementById('seltc').innerHTML += '<option style=\"background-color:' + optcol + ';\" value=\"' + owstwo[0] + '\">' + hones[iot].innerHTML + '</option>'; } else { window.open(owstwo[0], '_blank'); } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " hones=docgetclass('nav-previous', 'div'); \n";
$tblurb .= " if (hones.length > 0 && ((tcprefix == '!' || tcprefix == '+' || tcprefix == '|' || tcprefix == '*'))) { \n";
if (strpos($nurl, "/page/2/") !== false || strpos($nurl, "paged=2") !== false) {
$tblurb .= " location.href = '" . $nurl . "'; \n";
} else {
$tblurb .= " location.href = '" . $nurl . "'; \n";
}
$tblurb .= " } else
if (hones.length > 0) { \n";
$tblurb .= " location.href = '" . $nurl . "'; \n";
$tblurb .= " } else { \n";
$tblurb .= " preprecc('wopenall'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
if ($furl != "") $tblurb .= " if (hl == 0) { \n";
if ($furl != "") $tblurb .= " location.href = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "'; \n";
if ($furl != "") $tblurb .= " } \n";
$tblurb .= " } \n";
}
echo $tblurb;
}
?>
}

</script>
</head>
<body onload="precc(); courseCookies();" <?php body_class(); ?>>

Please feel free to try it out here, where you are.


Previous relevant WordPress Blog Search Within Search Implementation Tutorial is shown below.

WordPress Blog Search Within Search Implementation Tutorial

WordPress Blog Search Within Search Implementation Tutorial

Yesterday’s “filter a search” (or “search within a search”) ideas of WordPress Blog Search Within a Search Primer Tutorial, as shown below, were good in terms of a method to achieve something, but they only suit for regular readers of this blog, because there is nothing sitting there on the screen for the usual URLs you would navigate to, to remind you that that functionality can happen, let alone how to achieve that functionality.

So where should such functionality be placed and implemented? Luckily, that is an easy question. We are going to change the look of the website Search TextBox and Button. The Button used to be a … button … but now we are going to turn that ordinary (form “submit”) button into radio buttons with the options …

  • Search … performs as it used to, for ordinary searches, when this radio button is clicked … yes, we are using the onclick event … maybe the onchange event may have worked too … but we prefer the clarity of thought behind the onclick event …
  • Tag … allow the TextBox be a Tag to find and then use a Javascript Prompt window answer to further filter the Blog Posting Titles found …
  • Category … allow the TextBox be a Category to find and then use a Javascript Prompt window answer to further filter the Blog Posting Titles found

So, why radio buttons and not checkboxes? We only want to perform one action at a time, so radio buttons suit here.

So, are the radio buttons acting like three ordinary buttons? That’s the go here, and we do that by having a hidden fourth radio button with value=” that is actually selected at the start and at completion, so that you are encouraged to reclick the option you want to perform, and get that onclick event to be triggered.

So, can you tune into   702ABC Sydney  with the Category radio button? Very droll, but we’ll get right onto it.

The test is, then, is what you come up with an improvement regarding user friendliness to the methods you use “when you are in the know”, like for yesterday’s? We think so, and hope you do too. See how it is done today with our changes to the WordPress blog’s TwentyTen theme’s header.php in bold itallic for the latest changes and just in bold for yesterday’s (WordPress Blog Search Within a Search Primer Tutorial) changes below …



var spc=' ', cminus='-', fmtname='w411tform', fmcname='w411cform', edelim='/', radis="", formihis="";
function preradiocc() {
if (document.getElementById('s').value != "" && radis != "") {
radiocc(radis);
}
}
function radiocc(tvis) {
var cwopen="", cok=1;
radis=tvis;
if (document.getElementById('s').value != "") {
if (tvis == "Search") {
document.getElementById('searchsubmit').click();
} else if (tvis == "Tag") {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Tag findings Blog Posting Title search filter (blank causes no filtering)", document.getElementById('s').value);
if (cwopen != null) {
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (1 == 1) {
window.open(document.getElementById('searchform').action + "?tag=" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");
} else {
location.href=document.getElementById('searchform').action + "?tag=" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;
}
} else {
if (1 == 1) {
window.open(document.getElementById('searchform').action + "tag/" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");
} else {
location.href=document.getElementById('searchform').action + "tag/" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;
}
}
}
} else if (tvis == "Category") {
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (document.getElementById('s').value.substring(0,1) >= '0' && document.getElementById('s').value.substring(0,1) <= '9') {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (number) findings Blog Posting Title search filter (blank causes no filtering)", "Tutorial");
if (cwopen != null) {
if (1 == 1) {
window.open(document.getElementById('searchform').action + "?cat=" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");
} else {
location.href=document.getElementById('searchform').action + "?cat=" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;
}
}
} else {
cok=0;
alert("Please enter the category as a number");
document.getElementById('s').value = '';
}
} else {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (alphabetic) findings Blog Posting Title search filter (blank causes no filtering)", document.getElementById('s').value);
if (cwopen != null) {
if (1 == 1) {
window.open(document.getElementById('searchform').action + "category/" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");
} else {
location.href=document.getElementById('searchform').action + "category/" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;
}
}
}
}
if (cok == 1) {
document.getElementById('s').value = '';
radis="";
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
}
}
}

function preprecc(inidea) { // wopenallwas= form
<?php
$tblurbwas="";
if (isset($_GET['wopenallwas']) || isset($_GET['wopenall'])) {
$tblurbwas = " var ourwovwas=location.search.split(inidea + '=')[1] ? location.search.split(inidea + '=')[1].split('&')[0] : ' '; \n";
$tblurbwas .= " if (ourwovwas != ' ') { \n";
$tblurbwas .= " document.body.innerHTML = '<div id=\"verytop\" align=\"center\" style=\"background-color: yellow;\"><table cellpadding=25 cellspacing=25><tr><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 3.0.3<br><br><form action=\"http://www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Tag (alpha): <input type=\"text\" name=\"tag\" id=\"tag\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form action=\"http://www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Category (numerical): <input type=\"number\" name=\"cat\" id=\"cat\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 4.1.1<br><br><form id=\"w411tform\" action=\"https://www.rjmprogramming.com.au/ITblog/tag/\" method=\"GET\"> Tag (alpha): <input type=\"text\" onblur=\" document.getElementById(fmtname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form id=\"w411cform\" action=\"https://www.rjmprogramming.com.au/ITblog/category/\" method=\"GET\"> Category (alpha): <input onblur=\" document.getElementById(fmcname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" type=\"text\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td></tr></table></div>' + document.body.innerHTML; \n";
$tblurbwas .= " } \n";
}
echo $tblurbwas;
?>
}
function precc() { // wopenall= functionality
preprecc('wopenallwas');
document.getElementById('searchsubmit').style.display='none';
formihis = document.getElementById('searchform').innerHTML.replace("</div>", "<input style='display:none;' type='radio' name='stype' value=''><input onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Search<input onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'>Tag<input onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>Category</div>");
formihis = formihis.replace("input id", "input onblur='preradiocc();' id");
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;

<?php
$tblurb="";
if (isset($_GET['wopenall'])) {
$tpage=1;
$furl="";
$sru=explode("?", $_SERVER['REQUEST_URI']);
if (isset($_GET['paged'])) {
$tpage=$_GET['paged'];
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
$furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
} else if (isset($_GET['tag']) || isset($_GET['cat']) || isset($_GET['s'])) {
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
if (1 == 2) $furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
} else if (strpos("/wordpress/", $_SERVER['REQUEST_URI']) !== false) {
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$tblurb = " location.href='" . $nurl . "'; \n";
} else {
$tstuff=explode("page/", $sru[0]);
if (sizeof($tstuff) > 1) {
$tstu=explode("/", $tstuff[1]);
$tpage=$tstu[0];
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
} else {
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
if (1 == 2) $furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
}
}
if ($tblurb == "") {
$tblurb = " var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' '; \n";
$tblurb .= " var ows, owstwo, iot, hl=1; \n";
$tblurb .= " if (ourwov != ' ') { \n";
$tblurb .= " var hones=docgetclass('entry-title', 'h1'); \n";
$tblurb .= " hl=hones.length; \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " for (iot=0; iot<hones.length; iot++) { \n";
$tblurb .= " if (hones[iot].innerHTML.indexOf('Not Found') != -1) hl=eval(-1 + hl); \n";
$tblurb .= " if (ourwov == '' || hones[iot].innerHTML.toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";
$tblurb .= " ows=hones[iot].innerHTML.split('href='); \n";
$tblurb .= " if (ows.length > 1) { \n";
$tblurb .= " owstwo=ows[1].substring(1).split(ows[1].substring(0,1)); \n";
$tblurb .= " window.open(owstwo[0], '_blank'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " hones=docgetclass('nav-previous', 'div'); \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " location.href = '" . $nurl . "'; \n";
$tblurb .= " } else { \n";
$tblurb .= " preprecc('wopenall'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
if ($furl != "") $tblurb .= " if (hl == 0) { \n";
if ($furl != "") $tblurb .= " location.href = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "'; \n";
if ($furl != "") $tblurb .= " } \n";
$tblurb .= " } \n";
}
echo $tblurb;
}
?>
}

</script>
</head>
<body onload="precc(); courseCookies();" <?php body_class(); ?>>


Previous relevant WordPress Blog Search Within a Search Primer Tutorial is shown below.

WordPress Blog Search Within a Search Primer Tutorial

WordPress Blog Search Within a Search Primer Tutorial

You know how you often find yourself, while surfing the web, wanting to “filter a search” within that web page’s search functionality (or maybe you think of it as “search within a search”) which you do. Well, yesterday’s (WordPress Blog amendment) work at AppleScript Surfing Primer Tutorial as shown below, set me to thinking of how it could be done at this WordPress Blog, and yes, yesterday’s work was a start in the same direction.

The thinking has some resemblances to the Oldest Post work we did some time back, but is different enough that we did this job differently.

Perhaps we’d best explain what we mean with an example. We end up arriving at what we want (which is the “Probability Game” we wrote) by …

  1. tag by “mathematics” …
  2. filter (the blog title) by ” probability” … which you can try with this link

… and hone in exactly on what we want, much better than with the traditional search box method resulting in ( at the time of writing was 8 ) … here.

And so, can you see the power of that first instinctive feeling you might have had, like, “I wish we could filter the search”. Often that “first instinctive feeling” is both the correct one to go by, and the best one to implement.

This type of improvement is often arrived at by opening up your software for user acceptance, because it is amazing how many ideas come out of testing the software with lots of users, if this is possible. This is often called “user acceptance testing”.

So, it behoves us to show the bold changes to the WordPress header.php (our usual “suspect”) below, suiting both permalink URL (WordPress 4.1.1) scenarios and non-permalink URL (WordPress 3.0.3) scenarios …



var spc=' ', cminus='-', fmtname='w411tform', fmcname='w411cform', edelim='/';
function preprecc(inidea) { // wopenallwas= form
<?php
$tblurbwas="";
if (isset($_GET['wopenallwas']) || isset($_GET['wopenall'])) {
$tblurbwas = " var ourwovwas=location.search.split(inidea + '=')[1] ? location.search.split(inidea + '=')[1].split('&')[0] : ' '; \n";
$tblurbwas .= " if (ourwovwas != ' ') { \n";
$tblurbwas .= " document.body.innerHTML = '<div align=\"center\" style=\"background-color: yellow;\"><table cellpadding=25 cellspacing=25><tr><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 3.0.3<br><br><form action=\"http://www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Tag (alpha): <input type=\"text\" name=\"tag\" id=\"tag\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form action=\"http://www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Category (numerical): <input type=\"number\" name=\"cat\" id=\"cat\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 4.1.1<br><br><form id=\"w411tform\" action=\"https://www.rjmprogramming.com.au/ITblog/tag/\" method=\"GET\"> Tag (alpha): <input type=\"text\" onblur=\" document.getElementById(fmtname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form id=\"w411cform\" action=\"https://www.rjmprogramming.com.au/ITblog/category/\" method=\"GET\"> Category (alpha): <input onblur=\" document.getElementById(fmcname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" type=\"text\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td></tr></table></div>' + document.body.innerHTML; \n";
$tblurbwas .= " } \n";
}
echo $tblurbwas;
?>
}
function precc() { // wopenall= functionality
preprecc('wopenallwas');
<?php
$tblurb="";
if (isset($_GET['wopenall'])) {
$tpage=1;
$furl="";
$sru=explode("?", $_SERVER['REQUEST_URI']);
if (isset($_GET['paged'])) {
$tpage=$_GET['paged'];
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
$furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
} else if (isset($_GET['tag']) || isset($_GET['cat']) || isset($_GET['s'])) {
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
if (1 == 2) $furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
} else if (strpos("/wordpress/", $_SERVER['REQUEST_URI']) !== false) {
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$tblurb = " location.href='" . $nurl . "'; \n";
} else {
$tstuff=explode("page/", $sru[0]);
if (sizeof($tstuff) > 1) {
$tstu=explode("/", $tstuff[1]);
$tpage=$tstu[0];
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
} else {
$nurl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
if (1 == 2) $furl = "http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
}
}
if ($tblurb == "") {
$tblurb = " var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' '; \n";
$tblurb .= " var ows, owstwo, iot, hl=1; \n";
$tblurb .= " if (ourwov != ' ') { \n";
$tblurb .= " var hones=docgetclass('entry-title', 'h1'); \n";
$tblurb .= " hl=hones.length; \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " for (iot=0; iot<hones.length; iot++) { \n";
$tblurb .= " if (hones[iot].innerHTML.indexOf('Not Found') != -1) hl=eval(-1 + hl); \n";
$tblurb .= " if (ourwov == '' || hones[iot].innerHTML.toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";
$tblurb .= " ows=hones[iot].innerHTML.split('href='); \n";
$tblurb .= " if (ows.length > 1) { \n";
$tblurb .= " owstwo=ows[1].substring(1).split(ows[1].substring(0,1)); \n";
$tblurb .= " window.open(owstwo[0], '_blank'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " hones=docgetclass('nav-previous', 'div'); \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " location.href = '" . $nurl . "'; \n";
$tblurb .= " } else { \n";
$tblurb .= " preprecc('wopenall'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
if ($furl != "") $tblurb .= " if (hl == 0) { \n";
if ($furl != "") $tblurb .= " location.href = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "'; \n";
if ($furl != "") $tblurb .= " } \n";
$tblurb .= " } \n";
}
echo $tblurb;
}
?>
}

</script>
</head>
<body onload="precc(); courseCookies();" <?php body_class(); ?>>

You’ll see that PHP and Javascript are great to use together, to the point, often, you forget that PHP is not with you there when the messaging reaches the client … but the pre-emptive “if”ing you can do, can make it appear that it is wiser than it is.

So, if you get what is required URL-wise, go for it, else try a “tag” or “category” search on this blog and add to the address bar “?wopenall=[OptionalSearchOfBlogPostingTitleFilterString]” to try all this out, if you like, for our “filtered search” (or “search within a search”) functionality today.


Previous relevant AppleScript Surfing Primer Tutorial is shown below.

AppleScript Surfing Primer Tutorial

AppleScript Surfing Primer Tutorial

What AutoHotKey is as a recording piece of functionality for Windows is, AppleScript is Mac OS X’s recording functionality equivalent.

Today we shaped to want to show you the equivalent functionality AutoHotKey achieved surfing the net with Internet Explorer as shown below with AutoHotKey Surfing ASP.Net Primer Tutorial on a Mac (using Mac OS X Mavericks) and using Firefox, and ran into a roadblock that is either that AppleScript is not as featureful as AutoHotKey, or we’re not up to the AppleScript smarts required. So we compromised and changed the WordPress blog code’s header.php to help out, some of the way, to helping via the bold changes below …



function precc() {
var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' ';
var ows, owstwo, iot;
if (ourwov != ' ') {
var hones=docgetclass("entry-title", "h1");
if (hones.length > 0) {
for (iot=0; iot<hones.length; iot++) {
if (ourwov == "" || hones[iot].innerHTML.toLowerCase().indexOf(ourwov.toLowerCase()) != -1) {
ows=hones[iot].innerHTML.split("href=");
if (ows.length > 1) {
owstwo=ows[1].substring(1).split(ows[1].substring(0,1));
window.open(owstwo[0], "_blank");
}
}
}
}
}
}

</script>
</head>
<body onload="precc(); courseCookies();" <?php body_class(); ?>>

… which make the open location … statement of our AppleScript script as below …


tell application "Finder"
activate
set target of Finder window 1 to folder "Applications" of startup disk
set name of application file "Firefox.app" of folder "Applications" of startup disk to "Firefox.app"
open application file "Firefox.app" of folder "Applications" of startup disk
delay 4
open location "https://www.rjmprogramming.com.au/ITblog/tag/applescript?wopenall=applescript"
end tell

… be more meaningful with the ?wopenall=applescript being used to open the first page worth of blog posting links be opened as new tab web pages in Firefox … semi-cute, huh?!

So if you have a Mac and Mac OS X and have the Firefox web browser installed and you look in Applications->Utilities and find the AppleScript Editor why not try FirefoxBrowser.scpt or see what happens with today’s tutorial picture or just see the use, in isolation, of the WordPress changes with this link.


Previous relevant AutoHotKey Surfing ASP.Net Primer Tutorial is shown below.

AutoHotKey Surfing ASP.Net Primer Tutorial

AutoHotKey Surfing ASP.Net Primer Tutorial

When, some time back, we talked about the “sisterly” (to today’s ASP.Net) PHP way of approaching the AutoHotKey Surfing “interface” to a web application with AutoHotKey Surfing PHP exec Tutorial as shown below, it was inferred that we might approach this, in ASP.Net (using Microsoft’s Visual Studio IDE under Windows), by using a “new Process()” technique … well, please scratch that idea … Windows security has come down pretty hard on such thoughts … so what we did today was compartmentalize more and allow the “AutoHotKey Surfing” be handled by Windows desktop techniques and has as the “interface method” the existance, or not, of files … a favourite technique for us, as much as anything because “methodologies” containing “file_exists” (or its like) are common in so many “server” programming languages … “server” not “client” … so not Javascript.

So we have …

  1. ASP.Net (VB.Net codebehind) code you could call AutoHotKey_Test.aspx (or call it something better?!) … and its helper Windows (DOS) Command Line …
  2. Windows (DOS) Command Line batch file you could call autohk.bat (which is designed to keep running, and we show with today’s slideshow which, today, doesn’t show the Task Schedular idea you might like that we showed with C Sorting ASP.Net Primer Tutorial)

As far as the code goes it assumes either the ASP.Net project will be located where the AutoHotKey compiler Ahk2Exe.exe is located or you could make the code better or it can work with the AutoHotKey compiler Ahk2Exe.exe on the computer’s PATH. Anyway, try for yourself and if you settle on something there is the ASP.Net VB.Net Dim prefix as String = “” that would need amendment.

Of more than somewhat help today was ASP.NET 3.5 Unleashed by Stephen Walther … thanks.

So please compare and contrast the server giants and their software integration with some Windows operating system C.


Previous relevant AutoHotKey Surfing PHP exec Tutorial is shown below.

C Sorting PHP exec Tutorial

AutoHotKey Surfing PHP exec Tutorial

There’s another companion piece to our C “sorting” program tutorials finishing with C Sorting PHP exec Tutorial as of a couple of days ago. And it’s a pretty important chapter if you are interested in software integration, and “meeting points”. We talk about the “meeting point” of web and desktop applications through the use of mechanisms with the web application server language’s world … our web server language today is PHP and its exec method, but it could be ASP.Net and a new Process() scenario if that’s how you roll … but it has to be Windows web hosting … as we do with some local web serving utilizing the brilliant EasyPHP local web server … we can’t show you live on rjmprogramming.com.au domain because it is a Linux web server. The difference today is that instead of using some C code compiled using the Digital Mars C compiler, we dynamically create a Windows executable, on the fly, using the brilliant AutoHotKey (last talked about at this blog with AutoHotKey StayAwake Tutorial as shown below) and its *.ahk scripting language that can compile Windows executables for the Windows environment you find yourself in.

The AutoHotKey script created on the fly has behind its logic the brilliance of the code suggested at this very useful link … so, thanks.

What happens on EasyPHP local (WAMP) Apache/PHP/MySql web server, under Windows, is that …

  1. we have our idea.php (and you are welcome to make a better name) … in the Document Root of EasyPHP (in our case at c:\progra~1\EasyPHP-12.1\www\idea.php … or http://127.0.0.1:8887/idea.php) … and in the same place have …
  2. a subdirectory called AutoHotKey containing the AutoHotKey scripting software … so that on typing http://127.0.0.1:8887/idea.php into the Internet Explorer address bar …
  3. an HTML form asks about a good Tag to look for at the blog here and, optionally, within the blog posting titles that result, a search string to narrow down the scope … and then …
  4. we have the information for PHP to write out an AutoHotKey script for the purpose which PHP exec() arranges to dynamically create a Windows executable that …
  5. runs to open an Internet Explorer webpage for the Tag search and any accompanying offshoot webpages for matching title search blog postings of interest … cute, huh?

“Who” (but they’re on “second”) says desktop work is irrelevant to web applications? After all, the server side languages interface to what the desktop world looks like … a web server operating system. It is worth remembering that no matter how “cloudy” things get there are still web servers at the end of all these trails.


Previous relevant AutoHotKey Record and Compile Primer Tutorial is shown below.

AutoHotKey Record and Compile Primer Tutorial ... http://www.autohotkey.com

AutoHotKey Record and Compile Primer Tutorial ... http://www.autohotkey.com

Have you heard of AutoHotKey?
It is a Windows (desktop) application (that is quite brilliant) which can record and replay mouse and keystrokes, or assign a group of actions to a HotKey. Anybody into procedures and the operations side of I.T. will want to know about it, am sure.

Our unusual* video of a tutorial (which aims to start up the Windows Task Manager process and place an AutoHotKey MsgBox along with it, to allow the user to possibly close the Windows Task Manager process using the AutoHotKey executable) today uses the Mac application PhotoBooth with the (video) effect called “Rollercoaster” (and set Edit->Auto Flip New Items to on (otherwise it will all be back to front!)) … am not sure of its relevance and whether you can see enough … so, if that is the case, we basically (on a Windows laptop) (* dedicated to Sydney Royal Easter Show):

  1. As a side issue, opened up a previous script (you can use Notepad) from the Compiler folder off the root AutoHotKey folder and copied some MsgBox code of interest.
  2. Used Windows Explorer to double click the AutoScriptWriter folder off the root AutoHotKey folder.
  3. Double clicked AutoScriptWriter.exe.
  4. At the “Initiate the following ‘Run’ line upon Record” put taskmgr
  5. Within the main body went Ctrl-V to paste in that code regarding MsgBox
  6. Clicked Record button.
  7. Clicked anywhere in space on the Desktop.
  8. Clicked Stop button.
  9. Rearranged the lines of code such that Run, taskmgr sat up the top.
  10. Hit the Save button.
  11. Saved to the Compiler folder off the root AutoHotKey folder with the name TaskMgr_MsgBox (and it will give the default AutoHotKey extension of .ahk (for a script)).
  12. Used Windows Explorer to double click the Compiler folder off the root AutoHotKey folder.
  13. Right-clicked TaskMgr_MsgBox.ahk and chose Run Script … it worked .. great.
  14. Right-clicked TaskMgr_MsgBox.ahk and chose Compile Script.
  15. Double clicked resultant TaskMgr_MsgBox.exe (with the AutoHotKey “H” icon … cute, huh?) … it worked .. great.
  16. That resultant TaskMgr_MsgBox.exe is like any other Windows (desktop) executable that can be mapped to a shortcut or added to a taskbar or menu or be mapped to a keyboard shortcut, or be called by a .bat script, or be placed in a user Startup Programs directory, or be the activated program of a Windows Task Schedular task, or be forked by another Windows executable, for any future use.

Here is a link for some downloadable programming AutoHotKey script source code you could rename to TaskMgr_MsgBox.ahk

Here is a link for more information regarding AutoHotKey’s MsgBox functionality … and a lead in for a lot of other AutoHotKey functionality documentation … a feast of brilliant Windows application information.

Here is a link to the home of AutoHotKey.


Previous relevant AutoHotKey StayAwake Tutorial is shown below.

AutoHotKey StayAwake Tutorial ... http://www.autohotkey.com

AutoHotKey StayAwake Tutorial ... http://www.autohotkey.com

Have you heard of AutoHotKey?
It is a Windows application (that is quite brilliant) which can record and replay mouse and keystrokes, or assign a group of actions to a HotKey. Anybody into procedures and the operations side of I.T. will want to know about it, am sure.

We have introduced you to AutoHotKey with this previous AutoHotKey Primer Tutorial here.

Then we went a bit further with AutoHotKey with this previous More AutoHotKey Primer Tutorial here.

We talked about stay-resident programs earlier with Menu for Windows Command Prompt Via Batch File Tutorial. Our tutorial today uses AutoHotKey to create one. It uses the ToolTip functionality of Windows to keep the cursor busy. In the tutorial we show it being run:

  • right-click on AutoHotKey script file
  • compile script into StayAwake.exe and Run As Administrator (but you could also run it as a mere mortal!)
  • copy StayAwake.exe into All Users startup programs directory, logout and login for it to stay resident

Please enjoy our tutorial with some stay-resident approaches shown here.

Link to downloadable AutoHotKey programming script file StayAwake.ahk


Previous More AutoHotKey Tutorial is shown below.

More AutoHotKey Tutorial ... http://www.autohotkey.com

More AutoHotKey Tutorial ... http://www.autohotkey.com

Have you heard of AutoHotKey?
It is a Windows application (that is quite brilliant) which can record and replay mouse and keystrokes, or assign a group of actions to a HotKey. Anybody into procedures and the operations side of I.T. will want to know about it, am sure.

We have introduced you to AutoHotKey with this previous AutoHotKey Primer Tutorial here.

On a previous tutorial Windows Command Prompt Via Batch File we introduced you to some Windows Command Prompt commands and you can see that tutorial here. Our tutorial here builds on this in that the Windows Command Prompt batch file used for making that tutorial and downloadable here with rename to xxx.bat created/copied into c:\Users\user\ please (if no good you will have to dive in and adjust redo351.ahk yourself now, and learn about the wonders of AutoHotKey!), was deliberately made so that it can be stepped through slowly by entering {ENTER} key a lot (in xxx.bat this is done by set /p commands), and we have here the pressing of those {ENTER}s (ie. simulating answer to set /p sleeping for 2 seconds between each one … here is your homework … make it wait for 3 seconds between each {ENTER} then compile it then rerun it) with an AutoHotKey script largely created by hand (or via leads from recordings (do you remember Microsoft Excel VBA for CSV Primer Tutorial where similar thoughts were discussed as ideas for how to “get into programming”?)) and you can also download this here and rename to redo351.ahk and compile to redo351.exe using AutoHotKey’s compiler. If, when you do all that you run it and it stands there looking at you like a dead mullet it will be because your Command Prompt window for such a scenario does not end up being called “C:\Windows\system32\cmd.exe” and you will need to change this throughout redo351.ahk and then recompile (after stopping previous go (with Windows Task Manager maybe)) and test again. An AutoHotKey program called AU3_Spy.exe can help identify the names (or titles) of Windows, as required.

Please enjoy our tutorial with some recording functionality shown as well as the little “subplot” above (where the butler actually “did it”) here. The subplot is represented by the last 6 slides of the tutorial.


Previous tutorial AutoHotKey Primer Tutorial below …

AutoHotKey Primer Tutorial ... http://www.autohotkey.com

AutoHotKey Primer Tutorial ... http://www.autohotkey.com

Have you heard of AutoHotKey?

It is a Windows application (that is quite brilliant) which can record and replay mouse and keystrokes, or assign a group of actions to a HotKey. Anybody into procedures and the operations side of I.T. will want to know about it, am sure.

Don’t want to show my age, but first got keen about AutoHotKey because I couldn’t believe the day (was it when Windows 5 came out?) that Microsoft abandoned the cute program called Recorder, that came with Windows. For myself, this was a moment of deep mourning, like when Collingwood lost to Carlton in the 1970 Grand Final.

In this primer tutorial see a brief install then a record-compile-replay cycle.
In this link you can look at some of the personal usage of AutoHotKey.

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.


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.

This entry was posted in eLearning, Event-Driven Programming, Tutorials and tagged , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

8 Responses to WordPress Blog Search Within Search Preview Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *