"active" search words
Posted by: Tomas Herrmann
Date: October 16, 2016 10:44AM

I´m missing a feature concerning web searches -
it´s a part of the functionality of googles searchbar:
- the search items are copied on a menu-bar
- a click on one of these copies of the search words makes the cursor jump to the first occurance of the search expression
- further clicking leads to the next.

So , it´s not nessecary to make the web search and then search the "founds" using ctrl+f and retype the very search words.

Or is there a plugin which does the job?

Tomas

Re: "active" search words
Posted by: siria
Date: October 16, 2016 01:55PM

Perhaps there are extensions or such, don't know.
As far as macros, tried to come up with ideas, but so far only find rudimentary workarounds via clipboard, for the complete search term not single words :-/ Can only make things easier a step or so.

Question to fellow macrowriters with newer machines:
What does that little function test below do in newer KM versions??
Can remember that clipboard was broken since KM7x-betas, but perhaps Dorian fixed it again? Would also be interesting to know for other macros in general.

This macro gets started from the Edit-menu, near the top:

======= testclip.kmm =====

# http://kmeleonbrowser.org/forum/read.php?4,139963

testclip{
alert("test filling search field via clipboard: \n1) OK? \n2) empty? \n3) previous cliptext?", "TEST: text in search field at BOTTOM");
$_x="OK!";
setclipboard($_x);
id(ID_EDIT_FIND);
id(ID_EDIT_PASTE);
}

_testclip_BuildMenu{
setmenu("&Edit",macro,"TEST macro testclip TEST","testclip",0);
}
$OnInit=$OnInit."_testclip_BuildMenu;";



Edited 1 time(s). Last edit at 10/16/2016 02:11PM by siria.

Re: "active" search words
Posted by: JamesD
Date: October 16, 2016 11:38PM

siria

As written, testclip, does not run on KM76.

Have an idea that the new "popupmenu" macro statement with prompts can be used. I will try to make something, but can promis no timeframe. Age, bad eyes, and disabilities are slowing me down.

Re: "active" search words
Posted by: siria
Date: October 17, 2016 12:50AM

Thank you for testing James!
Too bad it doesn't work sad smiley

Have a basic macro 80% finished already, which does an automatic search if the searchtext was only 1 word or used quotes ("x y z"), otherwise it shows a prompt for editing.
Creating a menu for each word would be an option too, but didn't try it yet.

Because the biggest prob is still:
how get the text into that Find-in-page field at the bottom??
There is no native variable available, and nothing that involves the clipboard seems to work. The crazy thing is: even in KM1.6 which CAN use set/getclipboard, it pastes only "empty", probably because of some ansi/utf8 difference between macro command and input field. Even when pasting only ascii signs anyway. Tried to find workarounds, via urlbar and ID_EDIT_COPY etc, but doesn't help either. Sigh. Funnily copy-pasting works if the text is taken from a web page. Just not from a macro code.

At the moment am afraid only some normal macro-bookmarklet would be usable, doing everything on its own.
Would have preferred the search bar with the handy options at the bottom, pity.

Re: "active" search words
Posted by: rodocop
Date: October 17, 2016 01:15AM

cannot help more, but could the next bookmarklet help in doing further steps towards the target?
javascript:void((function(){var d=document;var head=d.getElementsByTagName('head')[0];if(typeof head=='undefined'){alert('Hey, wait coupla seconds while the page loads..');return;}(_s=d.createElement('script')).setAttribute('src','https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/means/sitehilite.0.1.js');head.appendChild(_s);return false;}))();  


Re: "active" search words
Posted by: JamesD
Date: October 17, 2016 01:20PM

siria

I was wrong. Your testclip does work. I copied the name line but did not put an * to make it a comment.

Re: "active" search words
Posted by: JamesD
Date: October 17, 2016 04:11PM

siria

This is another way the user might try to put a value into the field.

findtry.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#  
# ---------- findtry.kmm    K-Meleon Macro Language   ---------------
# ---------- verify that selected text can be put into "find" field
#
# Dependencies        : - main.kmm 
# Reference           : -  http://kmeleonbrowser.org/forum/read.php?4,139963
# Version             : - 1.0   2016_10_17  JamesD
# --------------------------------------------------------------------------------

_findtry_oper1 {
macroinfo = "Run the findtry test." ;
id(ID_EDIT_COPY);
id(ID_EDIT_FIND);
id(ID_EDIT_PASTE);
id(ID_EDIT_FINDNEXT);
}

_findtry_BuildMenu {
setmenu("SelectedText",macro,"findtry TEST","_findtry_oper1",-1);
}
# - - - - - - - - - - - - - - - - - - - - - - 
$OnInit=$OnInit."_findtry_BuildMenu;";
$macroModules=$macroModules."findtry;";


Re: "active" search words
Posted by: siria
Date: October 17, 2016 06:06PM

Quote
JamesD
I was wrong. Your testclip does work. I copied the name line but did not put an * to make it a comment.

Really? Ah that would be great! smiling smiley
So am going to finish my first beta macro now.

Re: "active" search words
Posted by: siria
Date: October 17, 2016 08:27PM

Okay, function-test-2 can now be downloaded here:

http://kmeleonbrowser.org/forum/read.php?9,139979

Would be nice if some people with various KM versions and OS could give it a try, to check if that clipboard pasting works again.

K-Meleon forum is powered by Phorum.