Development :  K-Meleon Web Browser Forum
K-Meleon development related discussions. 
Execute macro on click ?
Posted by: teK
Date: May 21, 2012 02:22PM

I'm looking for a way to execute external programs by clicking on a link so I wonder if there is a way to execute a macro ?

If not, is it possible to handle a protocol without registering it in the system registry ?

Or may a k/plugin exist, allowing this kind of stuff ?

Thanks.

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: JamesD
Date: May 21, 2012 07:21PM

I have an examples of macros which runs on a right-click/menu.
http://dl.dropbox.com/u/1522294/Note4me.7z and
http://dl.dropbox.com/u/1522294/QuickStore.7z

QuickStore will show you how to add to the link right-click menu and Note4me executes an external program.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: JujuLand
Date: May 21, 2012 08:43PM

Hum, I suppose he wants a macro executed on left-click.

It's possible, but very hard to do. I think you can find it in one I made for roboform, but it's a pain to do ...

And right-click is easier to do ...

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote
Re: Execute macro on click ?
Posted by: JamesD
Date: May 22, 2012 01:39AM

Is that like mimetype? I think that runs a program depending on the type of file to which the link points.

Hanlon’s razor is an eponymous adage named after Robert J. Hanlon that states: “Never attribute to malice that which is adequately explained by stupidity.”

JamesD

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: JujuLand
Date: May 22, 2012 07:07AM

The solution is to intercept events, but it's really hard to control. I had a lot of problems for roboform adaptation, it was depending of the Km version. If I remember well, I had no problem with 1.1.x, and a few problems with 1.5.x.

Never tried with 1.6 as roboform doesn't work under Linux.

I don't know what he wants to do. for file links, I think it ought to be possible to make an external program which run, but I'm not sure that the normal handling can be processed after the program execution.

For protocol links (html,...) I think the only way is to intercept a k-meleon event.

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 1 time(s). Last edit at 05/22/2012 07:14AM by JujuLand.

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: _Doon
Date: May 22, 2012 07:15AM

Quote
teK
I'm looking for a way to execute external programs by clicking on a link

I've done this for years with a program called run: Protocol handler. I've used it to create a program browser / launcher using basic html. It should allow you to launch a local executable in any browser via a URL without any 'open' prompts.

The author's site is down at the moment but the archived page for the program is here:

http://web.archive.org/web/20081220233559/http://www.blackbit.net/node/6

The download link from there does not work but the "manual link" does (note the security code section, and contrary to what the page says it didn't require any .net framework on my Win98 PC).

It doesn't seem to be available online anywhere so I've uploaded my copy of the program if you're interested, I guarantee it's integrity, for whatever that's worth (solid gold, btw).

http://www.datafilehost.com/download-c2c3df25.html
(cookies required)

Quote
teK
If not, is it possible to handle a protocol without registering it in the system registry ?

My guess: not unless a macro could do it. The run protocol handler sets up a protocol in the registry.

Quote
teK
Or may a k/plugin exist, allowing this kind of stuff ?

It's easy to launch an executable with a simple macro, but that requires a button, menu item, or hotkey as far as I know. I've explained how to do so in the following thread:

http://kmeleonbrowser.org/forum/read.php?1,96463,97725#msg-97725
(with all due respect to JamesD an his examples :)

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: teK
Date: May 22, 2012 08:38AM

Thanks for your replies and sorry for my lack of details.

Indeed, I want to execute a macro/program on left-click in a html page. And I'd like it portable so nothing should be installed in the system.

The run: Protocol handler is exactly what I thought when I wrote about "handling protocol", but portable winking smiley

Juju, where can I find your stuff about roboform ?

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: JujuLand
Date: May 22, 2012 03:46PM

The link is broken, but I'll correct it

http://extensions.geckozone.org/KMES-RoboformEn

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote
Re: Execute macro on click ?
Posted by: teK
Date: May 23, 2012 09:26AM

I'm trying to code a kplugin to capture a mouse left-clic but I can't get anything from the GetInfoAtPoint() function (from kmeleon_plugin.h), it always return 0.

GetInfoAtClick() works but I'd like to cancel action when the mouse-left-button-up event occurs outside the link (whereas mouse-left-button-down event occurs inside)...

Any suggestions/advices ?
What kind of coordinates does GetInfoAtPoint() need : from screen, KM window, client area...?


Edit: I just read in the KM1.5 source that GetInfoAtPoint() just return a NULL value...
Nevermind, I will try another thing.



Edited 1 time(s). Last edit at 05/23/2012 10:36AM by teK.

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: JujuLand
Date: May 23, 2012 12:32PM

Bon, j'ai retrouvé le source.

Je pense que le moyen à utiliser est l'interception de l'évènement OnLoad()

Si mes souvenirs sont exacts, j'avais une variable qui évoluait pour donner l'état dans lequel elle était, afin de progresser.

Toute la difficulté étant après exécution de ton programme externe, de relancer l'évènement. en effet, il me semble me rappeler que l'on ne pouvait pas rappeler l'évènement, alors qu'on était encore dedans ... (réentrance) d'où le passage obligé par une page html de transition (pour la version 1.5.x)

Bref, je ne suis pas sûr que tu puisses t'en sortir avec çà, mais bon qui ne tente rien n'a rien ...

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 1 time(s). Last edit at 05/23/2012 12:33PM by JujuLand.

Attachments: roboform.7z (2.5 KB)  
Options: ReplyQuote
Re: Execute macro on click ?
Posted by: teK
Date: May 24, 2012 12:33PM

Merci pour le source, Juju.

Finally, I've coded a little kplugin to do what i needed... a left-click on a link where URL starts with "run:" execute the following string.

A KMRUNCWD environment path variable can be set prior to application launch, so relative path, from this variable value, can be launched.

I've only tested it with KM1.6 and KM1.5.x on XP32-SP3, I don't know if it works on other systems.

Edit:

Is there any way to attach a small file to this message ?

meanwhile, for those who are interested, it can be download here (but can be deleted anytime)



Edited 1 time(s). Last edit at 05/24/2012 12:53PM by teK.

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: rodocop
Date: May 25, 2012 07:39AM

Quote
teK
Merci pour le source, Juju.

Finally, I've coded a little kplugin to do what i needed... a left-click on a link where URL starts with "run:" execute the following string.

A KMRUNCWD environment path variable can be set prior to application launch, so relative path, from this variable value, can be launched.

I've only tested it with KM1.6 and KM1.5.x on XP32-SP3, I don't know if it works on other systems.

Couldn't you give a link on a page where your kplugin could be tested?

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: teK
Date: May 25, 2012 02:28PM

Quote
rodocop
Couldn't you give a link on a page where your kplugin could be tested?

test page

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: rodocop
Date: May 25, 2012 03:24PM

doesn't work on my Win7 - CommMeleon 1.6



Edited 1 time(s). Last edit at 05/25/2012 03:25PM by rodocop.

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: JujuLand
Date: May 25, 2012 05:31PM

Doesn't work under wine (XP fake)

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote
Re: Execute macro on click ?
Posted by: teK
Date: May 28, 2012 04:22PM

I've updated the dll here... i've tested it with CommMeleon 1.6 on xp32, it works.
When loading KMeleon a debug window should appears to display URI starting with run: when clicking on links. Don't close this window or KMleon will crash, just close KMeleon as usual.

Note that I use the win32 ShellExecute function to launch a file/open a link... it could be the reason that doesn't work on vista / win7 / wine ?

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: teK
Date: June 04, 2012 10:22AM

I coded a new dll that can handle a RUN protocol.

You can download it here (32bits only)

I've tested it with KM1.5 and KM1.6 on WinXP32 (sp2 & sp3) connected with a guest account.

You can test by typing in the adress bar, for example:
run:notepad
run:http://kmeleon.sourceforge.net

Options: ReplyQuote
Re: Execute macro on click ?
Posted by: JujuLand
Date: June 04, 2012 11:49AM

Doesn' work under wine 'Run is not a registred protocol'. Same as mailto.

I don't think it will be possible ...

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote


K-Meleon forum is powered by Phorum.