Re: Lua Extension Plugin
Posted by: bst82551
Date: November 29, 2005 06:18PM

I hope Hao sees this :-). I'm very interested in the possibilities of using this scripting language as well.

Brian

Re: Lua Extension Plugin
Posted by: alain aupeix chez wanadoo fr
Date: November 29, 2005 06:19PM

Is-it possible to check for files, or others goodies like rename a file, ...( See New tool for K-Meleon on General Forum)

Thanks

Re: Lua Extension Plugin
Posted by: Hao Jiang
Date: November 30, 2005 05:35AM

@307
Nice to see your new version and fix of memory leak. I will test it soon.

@ alain,
For safety/security issues, I don't think it's a good idea to rename file name by macros.

Hao

Re: Lua Extension Plugin
Posted by: rmn
Date: November 30, 2005 07:15AM

Is the "os" library not blocked?

I know that allowing file access can be very interesting, but as Hao mentioned, it may not be a good idea for security reasons.

Re: Lua Extension Plugin
Posted by: alain aupeix at wanadoo fr
Date: November 30, 2005 08:40AM

I don't really understand the security reason for not add these functionnalities in a kplugin.

Is there a way, from internet, to use kplugins ?

Re: Lua Extension Plugin
Posted by: 307
Date: November 30, 2005 09:00AM

"os" and "io" library is disabled on 0.1.0. They ware enabled until 0.0.4. I thought nobody would need them. But I can't decide it right now.

Thanks.

Re: Lua Extension Plugin
Posted by: alain aupeix at wanadoo fr
Date: November 30, 2005 09:45AM

Thanks for your answer.

As I now just have 0.0.4, I'll try to use it. I hope you integer these libraries. I'm always asking how it can make problem with security.

I think it's as dangerous as Explorer, where you can kill all the files...
As I know it's not possible to launch a kmeleon macro from internet.

Re: Lua Extension Plugin
Posted by: 307
Date: November 30, 2005 01:54PM

I'm sorry. "os" library is also disabled on 0.0.4. I forgot it.

I think, while someone has a fear about accessing files from this plugin, I should not enable it. Then I suggest you to make a plugin like I posted on general forum. Lua plugin can call the plugin too.

Thanks.

Re: Lua Extension Plugin
Posted by: alain aupeix at wanadoo fr
Date: November 30, 2005 04:47PM

I'm sorry. "os" library is also disabled on 0.0.4. I forgot it.

Then I suggest you to make a plugin like I posted on general forum. Lua plugin can call the plugin too.

I'm not able to do that sad smiley

I would ne nice to have a version with os() and io() : no more needed of external tools,

someone has a fear about accessing files from this plugin
I think it's stupid ... we are not with IE, Windows doesn't know how to handle it, and how can a program interpret a macro in lua file or macros.cfg.

Re: Lua Extension Plugin
Posted by: rmn
Date: December 01, 2005 01:11AM

I don't know.. I, for one, prefer more control. But that's because I don't have evil intents smiling smiley . (And because my computer has the power to run everything.)

> > someone has a fear about accessing files from this plugin
> I think it's stupid ... we are not with IE, Windows doesn't know how to handle it, and how can a program interpret a macro in lua file or macros.cfg.


But what if I decide to write a script that deletes C:\*.*, post it somewhere, and trick people into using it?
You see, many viruses act that way: you think it's a game or a useful program or whatever, but it's not.

Re: Lua Extension Plugin
Posted by: alain aupeix at wanadoo fr
Date: December 01, 2005 02:42PM

But what if I decide to write a script that deletes C:\*.*

Perhaps, but it's the same with wsh scripts we can embed in macros.cfg, and I never heard somebody talking about.

So, with Km macro system, we have no way to only test about a file presence (what I need now) . I think some improvements are necessary, and we are stupid to forbid ourselves to make it.

Re: Lua Extension Plugin
Posted by: rmn
Date: December 02, 2005 04:57AM

Yeah, I guess there are ways to do malicious things with macros.dll's exec() function and the javascript access, too.

Alright, at least for now I believe it's OK to enable the 'dangerous' libraries/functions. So I withdraw my objections :-) . Still there's the file size issue (I personally don't care, though), and that "macro extension plugin" is also a very good idea (we can add all the bloat there). Dunno, anything that works is fine for me....

Offtopic: This makes me think of the Macro Library; we don't (and can't and won't) have safety control over the macros there. Perhaps we should put up a big notice in the parent wikipage (MacroLibrary) stating out that fact, just for precaution.

Re: Lua Extension Plugin
Posted by: guenter
Date: December 06, 2005 05:48AM

maybe have a additional version that does not have the possible gaps activated,
but only if that extra option does not mean too much extra work.

p. s. We can always count on the obsurity of beeing such a small group and also
spoof the browser name. So i feel the possibly gaps are not dangerous now.

Re: Lua Extension Plugin
Posted by: Hao Jiang
Date: December 21, 2005 07:13PM

Some time the lua macros plugin can't be recognized by K-Meleon. Don't know why. Can't you build this plugin in VC7++? Maybe that's the problem.

Hao

Re: Lua Extension Plugin
Posted by: mark307
Date: December 22, 2005 10:08AM

I have not seen such problem.

I don't have VC7. So I checked export table of dll by tdump.exe.

macros.dll:
EXPORT ord:0001='GetKmeleonPlugin'
(official 0.9 and CCF0.04B2 are same)

luamacros.dll:
EXPORT ord:0002='DrawBitmap'
EXPORT ord:0001='GetKmeleonPlugin'

I saw there is not wrong thing.

If macros.lua has error, this plugin doesn't work. And 0.1.0 has a bug that an error message doesn't appear while evaluating macros.lua. But the plugin appears always on preferences dialog. Please check.

Thanks.

Re: Lua Extension Plugin
Posted by: Hao Jiang
Date: December 22, 2005 07:57PM

@MARK307,
Thanks for the reply. Actually this un-recognizing plugin problem is related with GRE, for some GRE, it could be recognized very well. And for some, it 's not. Don't know why. But anyway, I tried to figure it out which Gecko 1.8 GRE is working fine with this plugin. Thanks.

Hao

Re: Lua Extension Plugin
Posted by: Dorian
Date: December 23, 2005 06:18PM

Is there any reasons for the usage of lua_Number where you could have used lua_Integer ?

Re: Lua Extension Plugin
Posted by: mark307
Date: December 24, 2005 10:03AM

@Hao
I don't know why, sorry. I know nothing about GRE. If the cause of this problem is compiler, utils plugin is too.

@Dorian
Lua 5.0 doesn't have lua_Integer. Lua language doesn't have integer type still 5.1 beta. And I thought real number is needless for k-meleon's macro.

Thank you.

Re: Lua Extension Plugin
Posted by: Dorian
Date: December 24, 2005 07:31PM

But you're already using function which are available only in lua 5.1, so it shouldn't be a problem now. All those conversions from float to integer are really bad.

Re: Lua Extension Plugin
Posted by: mark307
Date: December 25, 2005 08:53AM

lua_Integer is just casted to lua_Number. I'm little nervous about casting. Maybe I'm too much.
Thanks.

Re: Lua Extension Plugin
Posted by: mark307
Date: February 05, 2006 07:46AM

I posted new version of luamacros.

luamacros-0.1.2.zip

Fix: Error message don't appear while evaluating macros.lua.
Change: Lua 5.1 RC
Change: Lua library is linked as dll.
Change: all standard library is enabled.
Change: number is double (Lua default).
Change: "choose" function returns two value.
Change: K-Meleon's API is in namespace "km" and global.
Add: sample scripts: javascript, viewlinks, privacy
Add: ClearCache, BroadcastMessage, ExitHook
Add: preference "kmeleon.plugins.luamacros.path"

Thank you.

Re: Lua Extension Plugin
Posted by: Dorian
Date: February 05, 2006 08:48AM

Why are you linking it to a dll ?I don't think it's a good idea.

Re: Lua Extension Plugin
Posted by: mark307
Date: February 05, 2006 02:11PM

@Dorian
Because Lua addon libraries also need Lua library. If plugin is linked staticaly, these library must be linked staticaly (or you have to put on lua dll). I think it's waste.

I want to know why you think so. I need your wisdom.

Thanks.

Re: Lua Extension Plugin
Posted by: Dorian
Date: February 05, 2006 07:56PM

Do you mean that, by linking the plugin to a dll, it's possible to use addon libraries and add new fuctions to the plugin ?

It's just that I prefer keeping things tight, and for a plugin, you need a good reason for splitting it like that since no other component will ever need the lua dll.

Re: Lua Extension Plugin
Posted by: mark307
Date: February 06, 2006 02:37PM

@Dorian
Yes, you're right. Already I'm writing common dialog addon for Lua. And I succeeded to use LuaFileSystem and LuaSocket with this plugin.

Because utils plugin was accepted, I thought K-Meleon's macro needs more function. Then I tried to give more power to this plugin on last version.

In the fact, I'm at a loss about a position of this plugin. I am almost satisfied, because I can write a macro comfortably, and I made sure that we had common awarenesses of the issues about macro language.

Thanks.

Re: Lua Extension Plugin
Posted by: ra
Date: February 06, 2006 09:22PM
Re: Lua Extension Plugin
Posted by: mark307
Date: February 07, 2006 01:50PM

@ra
I see it's range of JavaScript. Lua macro and normal macro can't access HTML.

However, If you can select urls to open from only urls (no text, no image), ListLinks (contained luamacros package) and below MultiPasteGo script are maybe useful.

function MultiPasteGo(hwnd)
local layer, f
layer = km.getpref(km.TYPE_BOOL, "kmeleon.plugins.layers.load")
if layer then
f = function (url)
km.pluginmsg("layers", "OpenURLBg", url)
end
else
f = function (url)
km.NavigateTo(url, km.OPEN_BACKGROUND, hwnd)
end
end
string.gsub(km.getclipboard(hwnd), "(+)",]http://[^%s]+)", f)
end

regards.

Re: Lua Extension Plugin
Posted by: Dorian
Date: February 07, 2006 05:50PM

I think it would be better, to put all needed features in the plugin, and not relying on addon, but well ...

I would have only one request for this plugin: getting rid of the hwnd. It should be possible using environment variables.

Now you could thing about a not really neeeded feature; the possiblity to sign macro to resolve the security problem yawning smiley)

@ra
Opening link in the background could be possible using the blur js feature maybe, but it was never implemented in mfcembed. My js knowledge is pretty limited.

Re: Lua Extension Plugin
Posted by: ra
Date: February 07, 2006 07:01PM

I see it's range of JavaScript. Lua macro and normal macro can't access HTML.

Too bad. ;-(

However, If you can select urls to open from only urls (no text, no image), ListLinks (contained luamacros package) and below MultiPasteGo script are maybe useful.

True, thank you. Sadly it won't help in most of the cases.

Opening link in the background could be possible using the blur js feature maybe, but it was never implemented in mfcembed. My js knowledge is pretty limited.

Okay, thanks for the info. Background is not that important, but a fix for the limitation to 20 windows is. I have no idea why the open all links macro opens only 20 windows. It's useless that way. ;-(

BTW: Is there a way to sort out duplicate stuff (array and remove duplicates)?

Re: Lua Extension Plugin
Posted by: mark307
Date: February 09, 2006 02:59PM

Oops, MultiPasteGo script is broken by BBS oTL
I'll publish it again with next release. Sorry...

@Dorian
If you look this plugin as alternative of macro plugin, I suggest you to take thought with other choices, e.g. refining macro, spidermonkey. And I see addon topic needs interval to make sure both pluses and minuses.

BTW. I'll challenge to solve hwnd problem. But I see it's difficult... I understand that environment can associate with function not evaluation context.

@ra
BTW: Is there a way to sort out duplicate stuff (array and remove duplicates)?
This is change for ListLinks script.

LstL={};
with(LnkW.document){
...
if (! LstL[DlnK[lNK].href]) {
write(DlnK[lNK].href.link(DlnK[lNK])+'<br>');
LstL[DlnK[lNK].href]=1;
}

You can also use JavaScript part of ListLinks with normal macro, but all tabs and newlines have to be removed.

Thanks.

K-Meleon forum is powered by Phorum.