Extensions :
K-Meleon Web Browser Forum
All about K-Meleon extensions.
Selected text
Date: December 21, 2009 02:18PM
Hello, colleagues! It is necessary for me, that in a K-Meleon at text selection there was an automatic copying of the selected text in the exchange buffer. Prompt, how it to realise in a macro?
My blog about K-Meleon
http://kmeleon-ru.blogspot.com/
Re: Selected text
Date: December 21, 2009 02:57PM
Re: Selected text
Date: December 22, 2009 01:24AM
@ Alex
Can you be more specific about "automatic" copying? Macros require some event or user action to run.
Re: Selected text
Date: December 22, 2009 08:10AM
@JamesD
It is necessary for me that text copying in the buffer occurred automatically when I allocate the text. Now for copying in the buffer it is necessary to choose corresponding point of the contextual menu. I wish to do without it. Action on which it is possible to copy the allocated text - when I release the button of the mouse after text selection.
Re: Selected text
Date: December 22, 2009 12:03PM
The macro language has events
http://kmeleon.sourceforge.net/wiki/MacroLanguage2#events, but button release
is not included.
A specific "copy" function could be added to the context, right click, menu for selected text. A generic copy function is already there, as you noted. It would still require the user to preform the right click and choose an option.
Perhaps Autoit has a "button up" event, but I am not a expert in that system.
Re: Selected text
Date: December 22, 2009 01:03PM
There must be ways that work without right-click menu, since the search-button works also for selected text without clicking anything more. Why not just use the global variable for selected text??
Re: Selected text
Date: December 22, 2009 02:09PM
@ siria
I did not mean that using the right click menu was required. That was just an example. It is just that some action is required to make the macro run. Either an event or some user action such as using the search button. I do not know of a way in the macro language to make the macro run just by selecting some text. However, just because I don't know of a way does not mean there is no possible way.
Edited 1 time(s). Last edit at 12/22/2009 02:10PM by JamesD.
Re: Selected text
Date: December 23, 2009 07:47AM
May be it is possible with some java script or something else?
Re: Selected text
Date: December 23, 2009 10:31AM
hi alex
download this:
http://kmext.sourceforge.net/files/autoclipcopy.7z
special thanks to pwy@ ahk forums for the original source
http://www.autohotkey.com/forum/topic5439.html
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
# ---------auto copy selected text-------
$_tool_path=getfolder(RootFolder)."\\Tools";
autoclipcopy{
exec($_tool_path."\\autoclipcopy\\autoclipcopy.exe start");
}
autoclipexit{
exec($_tool_path."\\autoclipcopy\\autoclipcopy.exe ");
}
# --------------------------------------------
$OnInit=$OnInit."autoclipcopy;";
$OnQuit=$OnQuit."autoclipexit;";
$macroModules=$macroModules."autoclipcopy;";
;Auto copy clipboard
;thanks to pwy from autoitforums
; slightly modified for km by disrupted
;original code can be found there:http://www.autohotkey.com/forum/topic5439.html
#notrayicon
#SingleInstance force
if 0 < 1 ; The left side of a non-expression if-statement is always the name of a variable.
{
ExitApp
}
~Lshift::
TimeButtonDown = %A_TickCount%
; Wait for it to be released
Loop
{
Sleep 10
GetKeyState, LshiftState, Lshift, P
if LshiftState = U ; Button has been released.
break
elapsed = %A_TickCount%
elapsed -= %TimeButtonDown%
if elapsed > 200 ; Button was held down long enough
{
x0 = A_CaretX
y0 = A_CaretY
Loop
{
Sleep 20 ; yield time to others
GetKeyState keystate, Lshift
IfEqual keystate, U, {
x0 = A_CaretX
y0 = A_CaretY
break
}
}
if (x-x0 > 5 or x-x0 < -5 or y-y0 > 5 or y-y0 < -5)
{ ; Caret has moved
clip0 := ClipBoardAll ; save old clipboard
;ClipBoard =
Send ^c ; selection -> clipboard
ClipWait 1, 1 ; restore clipboard if no data
IfEqual ClipBoard,, SetEnv ClipBoard, %clip0%
}
return
}
}
~LButton::
TimeButtonDown = %A_TickCount%
; Wait for it to be released
Loop
{
Sleep 10
GetKeyState, LButtonState, LButton, P
if LButtonState = U ; Button has been released.
break
elapsed = %A_TickCount%
elapsed -= %TimeButtonDown%
if elapsed > 200 ; Button was held down too long, so assume it's not a double-click.
{
MouseGetPos x0, y0 ; save start mouse position
Loop
{
Sleep 20 ; yield time to others
GetKeyState keystate, LButton
IfEqual keystate, U, {
MouseGetPos x, y ; position when button released
break
}
}
if (x-x0 > 5 or x-x0 < -5 or y-y0 > 5 or y-y0 < -5)
{ ; mouse has moved
clip0 := ClipBoardAll ; save old clipboard
;ClipBoard =
Send ^c ; selection -> clipboard
ClipWait 1, 1 ; restore clipboard if no data
IfEqual ClipBoard,, SetEnv ClipBoard, %clip0%
}
return
}
}
; Otherwise, button was released quickly enough. Wait to see if it's a double-click:
TimeButtonUp = %A_TickCount%
Loop
{
Sleep 10
GetKeyState, LButtonState, LButton, P
if LButtonState = D ; Button has been pressed down again.
break
elapsed = %A_TickCount%
elapsed -= %TimeButtonUp%
if elapsed > 350 ; No click has occurred within the allowed time, so assume it's not a double-click.
{
;MouseClick, Left
return
}
}
; Since above didn't return, it's a double-click:
Sleep, 100
Send, ^c
return
Re: Selected text
Date: December 23, 2009 05:53PM
@disrupted
Thanks! I will try it now
Re: Selected text
Date: December 23, 2009 06:20PM
So, on my system that macro works like strange search engine on open pages... I dont know wthat does it matter...
And it dont copy text what I need, but it copy letter "c" and highlight it and search it on page...
Edited 1 time(s). Last edit at 12/23/2009 06:21PM by Alex.Tarantul.
Re: Selected text
Date: December 23, 2009 06:34PM
It would certainly be very helpful, if you would tell what you really want to do? You select some text with the mouse and want it to be copied into the clipboard - and then? What do you do with that text in the clipboard??
Re: Selected text
Date: December 23, 2009 06:42PM
I already explained: it is necessary for me that the text was copied WITHOUT click by the right button of the mouse under the contextual menu. Further it is necessary to take already copied text from the buffer (I will make it by an elementary macro) and to transfer in URL as one of parametres
Re: Selected text
Date: December 23, 2009 08:03PM
yes, that is how it works.. selecting a text gets automtically copied in the clipboard but you won't know until you go somewhere and right click and paste the clipboard contents.
please see this video:
http://www.youtube.com/watch?v=tNG3n2X72qg
i think that's what you want or you want an extra command to be executed after auto-copying
also make sure the extension was installed properly in kmeleon folder and to make sure, check in the taskmanager you should have an "autoclipcopy.exe" process running with k-meleon
Re: Selected text
Date: December 23, 2009 08:25PM
Quote
Alex.Tarantul
I already explained: it is necessary for me that the text was copied WITHOUT click by the right button of the mouse under the contextual menu. Further it is necessary to take already copied text from the buffer (I will make it by an elementary macro) and to transfer in URL as one of parametres
So you want to create a new URL in the adress bar and the selected text shall be a part of it, perhaps somewhere in the middle or the end? But what do you want to do with it then, nothing? Or do you want to open the new URL? But how do you want to open it without clicking anything, no context menu, and no button?? You need a macro command, and this needs a way to be called!
Re: Selected text
Date: December 24, 2009 08:03AM
ОБъÑÑню по-руÑÑки. Переводчик гугл переведёт Ð´Ð»Ñ Ð²Ð°Ñ
Мне нужно, чтобы БЕЗ Ð½Ð°Ð¶Ð°Ñ‚Ð¸Ñ Ð¿Ñ€Ð°Ð²Ð¾Ð¹ кнопки мыши произошло только копирование выделенного текÑта в буфер. Ðто первое. ПоÑле Ñтого - да, нажатие БУДЕТ. Ðто будет нажатие в контекÑтном меню. Ðто будет второе дейÑтвие. Я Ñ Ñтим ÑоглаÑен. Как Ñто Ñделать Ñ Ð·Ð½Ð°ÑŽ, мне в ÐТОМ помощь не нужна. Я прошу помощи в выÑÑнении первого - вопроÑа об автоматичеÑком копировании выделенного текÑта в буфер.
КÑтати, возник ещё Ð²Ð¾Ð¿Ñ€Ð¾Ñ - возможно ли открытие контекÑтного меню не по нажатию правой кнопки мыши, а автоматичеÑки поÑле Ð²Ñ‹Ð´ÐµÐ»ÐµÐ½Ð¸Ñ Ñ‚ÐµÐºÑта?
Edited 1 time(s). Last edit at 12/24/2009 08:05AM by Alex.Tarantul.
Re: Selected text
Date: December 24, 2009 09:08AM
are you using a laptop? cause i can understand with a touchpad it can be tiring to select and rightclick
i now have it working as you want but will need to do some tests to ensure no glitches and the macro has to be modified. your extension should be ready in about 1 hour
thanks for explaining in russian
Re: Selected text
Date: December 24, 2009 10:57AM
please test this:
http://kmext.sourceforge.net/files/autoclipcopy-plus.7z
doubleclicking text will copy+context menu
moving the caret> selecting multiple words will copy+ context menu
one click>copy but will not pop the context menu to avoid bringing up the context menu in urlbar or inside the page when not needed
there's a slight delay in opening the contextmenu after selecting to avoid a glitch
access menu: edit>configuration>activate autoclip to easily turn off or on (default installation setting is on)
Re: Selected text
Date: December 24, 2009 11:04AM
Quote
After that - yes, press will. It will be pressing the shortcut menu.
Okay, so you do press something! Is that shortcut menu created by the new macro??
Sorry that I keep asking, I do so because I strongly suspect that you're confusing something: To use a selected text in a macro, it is NOT necessary to right-click or to put it into clipboard. It is automatically in a variable, and can be used without such complicated tricks.
Re: Selected text
Date: December 24, 2009 02:46PM
Quote
disrupted
are you using a laptop? cause i can understand with a touchpad it can be tiring to select and rightclick
Personally I do not use a laptop, but those colleagues who has a laptop, asked to help them with this question
Re: Selected text
Date: December 24, 2009 02:57PM
Quote
siria
To use a selected text in a macro, it is NOT necessary to right-click or to put it into clipboard. It is automatically in a variable, and can be used without such complicated tricks.
OK. One problem it is solved. But that will tell on the mentioned question: whether occurrence of the contextual menu without pressing of the right button of the mouse is possible? For example, right after text selection?
Re: Selected text
Date: December 24, 2009 03:18PM
Just call your new macro!
Instead of programming it to insert the clipboard, tell it to use the selected text variable.
Re: Selected text
Date: December 24, 2009 04:13PM
I only found one problem to do the Alex's macro want, how to call the macro? you need an event, an accelerate, a menu, a toolbar button or a mouse gesture to call the macro.
(In pseudocode)
# You have the URL of the web page:
$URL;
# You have selected text:
$SelectedText;
open($URL.$SelectedText);
Really you don't need copy it to the clipboard. But if this is a requisite you can use:
$_aux = getclipboard();
setclipboard($SelectedText);
open($URL.getclipboard());
setclipboard($_aux);
# To open a contextmenu "SelectedText" is an example menu name you can change it to some other menu name defined:
plugin(rebarmenu, "SelectedText");
I was thinking to do in JavaScript, but onselect event is only for text objects, and for Mozilla browsers you need a lot of JS code for copy to clipboard because this is considered a dangerous action.
K-Meleon in Spanish
Edited 2 time(s). Last edit at 12/24/2009 04:20PM by desga2.
Re: Selected text
Date: December 24, 2009 06:21PM
@desga2
Thanks! I will try it tonight...
Re: Selected text
Date: December 24, 2009 07:06PM
Good Luck! Is it your first macro?
Re: Selected text
Date: December 28, 2009 07:34AM
I will tell so: it will be my first
public macro. I generally like to create themes (skins) more and to do Russian locales for extensions and macroes