Re: IDEA : a temporary bookmark holder
Posted by: siria
Date: August 04, 2011 09:39PM

Ah nice! Great James smiling smiley

You know what's confusing me again, something in main.kmm, is why it reads as if "&OpenURL_Typed" would use not the pref "...general.openurl" but "...searchtyped.openurl" - and yet, when typing something in URLBAR and hitting enter, what's in fact executed is still "...general.openurl"?! Oh well, good thing I need not understand all the mysteries, especially if they just work fine grinning smiley

----------------------------------------------
(slightly offtopic, for macro writers only)
@jsnj: That's cool with hiding a menu, have tried to understand your code, and it seems as if the menu is simply identified by it's line number?? Never realized this could work, being used that adding menus usually adds them above that number! Have now thrown together a few lines for experimenting, but somehow, no matter which number is given, that always hides just the current top entry, or perhaps there's a mistake somewhere?

test_modmenu_inline{
$_x=prompt("","Which menu position? (0,1,2,...)");
setmenu("&Tools",inline,"",$_x);
}

test_modmenu_popup{
$_x=prompt("","Which menu position? (0,1,2,...)");
setmenu("&Tools",popup,"",$_x);
}

test_modmenu_rebuild{
# does nothing??
rebuildmenu("&Tools");
}

test_modmenu_build{
setmenu("&Edit",macro,"test_modmenu_popup",test_modmenu_popup,0);
setmenu("&Edit",macro,"test_modmenu_inline",test_modmenu_inline,1);
setmenu("&Edit",macro,"test_modmenu_rebuild",test_modmenu_rebuild,2);
setmenu("&Edit",separator,3);
}
$OnSetup=$OnSetup."test_modmenu_build;";

Re: IDEA : a temporary bookmark holder
Posted by: jsnj
Date: August 04, 2011 11:53PM

Quote
siria
----------------------------------------------
(slightly offtopic, for macro writers only)
@jsnj: That's cool with hiding a menu, have tried to understand your code, and it seems as if the menu is simply identified by it's line number?? Never realized this could work, being used that adding menus usually adds them above that number! Have now thrown together a few lines for experimenting, but somehow, no matter which number is given, that always hides just the current top entry, or perhaps there's a mistake somewhere?

test_modmenu_inline{
$_x=prompt("","Which menu position? (0,1,2,...)");
setmenu("&Tools",inline,"",$_x);
}

test_modmenu_popup{
$_x=prompt("","Which menu position? (0,1,2,...)");
setmenu("&Tools",popup,"",$_x);
}

test_modmenu_rebuild{
# does nothing??
rebuildmenu("&Tools");
}

test_modmenu_build{
setmenu("&Edit",macro,"test_modmenu_popup",test_modmenu_popup,0);
setmenu("&Edit",macro,"test_modmenu_inline",test_modmenu_inline,1);
setmenu("&Edit",macro,"test_modmenu_rebuild",test_modmenu_rebuild,2);
setmenu("&Edit",separator,3);
}
$OnSetup=$OnSetup."test_modmenu_build;";

I never tested the in-session setmenu function thoroughly. Once I got it to serve my purpose I was satisfied and moved on smiling smiley For location identification, you can also use the STRING item name it preceeds instead of the integer. Try that and see if you get more accurate results. Keep in mind that setmenu wasn't necessarily designed to be used this way(within a session) according to documentation. Hiding an entire menu within a session is not a commonly needed or requested feature. But for my needs in the Search+ extension, it worked, caused no side effects and I left 'good enough' alone smiling smiley

http://home.arcor.de/cool.mckluus/software/kmeleon/project/reference/macrolanguage/ui.html#setmenu



Edited 2 time(s). Last edit at 08/04/2011 11:57PM by jsnj.

Re: IDEA : a temporary bookmark holder
Posted by: mhf
Date: August 05, 2011 10:37AM

Quote
siria
@mhf: just a wild guess, you didn't happen to copy the name of the macro ("QickStor.kmm") also inside the kmm-file, did you...?

@siria : late answer ! Yes I think I did copy the name of the macro inside the kmm file ...:s but of course I have overwritten it now so I can't check back.

Re: IDEA : a temporary bookmark holder
Posted by: siria
Date: August 06, 2011 12:38PM

Ah okay, then this most likely was the "copy-paste" error that caused the "vanishing menu" bug in the beginning. Macros are very touchy when non-command-lines are found without a # comment sign :cool: Often the error console (in Tools menu) can tell more, though not always.

Quote
jsnj
For location identification, you can also use the STRING item name it preceeds instead of the integer. Try that and see if you get more accurate results. Keep in mind that setmenu wasn't necessarily designed to be used this way(within a session) according to documentation.

Have now tested with various numbers and a few menu names, but makes no difference. Doesn't matter at all what's given as position, what vanishes when inserting a "nameless" menu is always the topmost entry in the parent menu. Never mind, at the moment I have no special need for it grinning smiley

It's still great that all 'regular' setmenu functions also work fine in-session, despite the description saying otherwise :cool: That came in handy quite often already smiling smiley smiling smiley

Re: IDEA : a temporary bookmark holder
Posted by: JamesD
Date: August 07, 2011 07:21PM

I have finally completed a full version of the macro. The name has been changed from QickStor to QuickStore. This means you will have to change the name in your prefs.js or you will orphan those prefs.

QuickStore now has an inline menu to speed the process of retrieving a stored URL. As per the original request there is also a 'Delete All' option.

The file is located at: http://dl.dropbox.com/u/1522294/QuickStore.7z

It is compressed to save space but it is not set up as an extension. Extract the file to you macro or user macro folder.

Re: IDEA : a temporary bookmark holder
Posted by: mhf
Date: August 08, 2011 09:39AM

Thanks James, that's really great, exactly what I wanted. I simply hope that others will find it useful too and that you haven't done all this just for me ... grinning smiley

One suggestion though : maybe a request for confirmation before Delete All ?

Martin.



Edited 1 time(s). Last edit at 08/08/2011 09:39AM by mhf.

Re: IDEA : a temporary bookmark holder
Posted by: JamesD
Date: August 08, 2011 11:42AM

Quote
mhf
One suggestion though : maybe a request for confirmation before Delete All ?

Look in same location for updated file. Should be version 1.1.
http://dl.dropbox.com/u/1522294/QuickStore.7z

Re: IDEA : a temporary bookmark holder
Posted by: mhf
Date: August 08, 2011 12:35PM

PERFECT.

Re: IDEA : a temporary bookmark holder
Posted by: siria
Date: August 08, 2011 04:18PM

Hmm... and perhaps a user wants more than only 6? *duckandrun* ;-)

Re: IDEA : a temporary bookmark holder
Posted by: mhf
Date: August 08, 2011 04:45PM

Quote
siria
Hmm... and perhaps a user wants more than only 6? *duckandrun* ;-)

Oouff ... was hoping another user would ask that ... *runninglikeaduck* grinning smiley

Re: IDEA : a temporary bookmark holder
Posted by: JamesD
Date: August 08, 2011 10:33PM

Edit the macro. Change the value that you find in lines 17 and 45.

Re: IDEA : a temporary bookmark holder
Posted by: ndebord
Date: August 09, 2011 04:00PM

Excellent little macro... put it in macros in profile. Easier to use than Hotlinks and just a very useful addition that I find addictive.

Thanks.

N

Re: IDEA : a temporary bookmark holder
Posted by: mhf
Date: August 09, 2011 04:55PM

Quote
ndebord
Excellent little macro... put it in macros in profile. Easier to use than Hotlinks and just a very useful addition that I find addictive.

Thanks.

Glad you like it ... tongue sticking out smiley

No seriously, all thanks to James.



Edited 1 time(s). Last edit at 08/09/2011 05:01PM by mhf.

Re: IDEA : a temporary bookmark holder
Posted by: ndebord
Date: August 09, 2011 05:38PM

Quote
mhf
Quote
ndebord
Excellent little macro... put it in macros in profile. Easier to use than Hotlinks and just a very useful addition that I find addictive.

Thanks.

Glad you like it ... tongue sticking out smiley

No seriously, all thanks to James.

mhf,

That is, to my mind, the key to K-Meleon. Somebody asks a question about a possible macro. Somebody else answers "sure." Others jump in and very quickly, you have your very own personalized macro ready to go that fits your tastes (and anybody else who is lurking, like me!)!

N

Re: IDEA : a temporary bookmark holder
Posted by: mhf
Date: August 10, 2011 04:08PM

Found a bug : I increased the number of placeholders to 10 (as per James' reply above) but now when I try to delete a link I get a message with Number entered is out of range - any ideas ?

Re: IDEA : a temporary bookmark holder
Posted by: JamesD
Date: August 10, 2011 06:42PM

It is possible that the selection coming from your choice is being treated as a string. Did you have ten items when this happened? If my idea is right then comparing 10 to any number 2-9 by string would be wrong. Current code may only be able to go to 9.

I will work on this and try to prove my idea and fix the situation if possible. Have guests today and no more time right now.

Re: IDEA : a temporary bookmark holder
Posted by: JamesD
Date: August 10, 2011 07:07PM

You are in luck. My friend wanted to see what I did when I coded macros. We have a fix. The problem was just as I suspected. Comparing string to integer does not always work.

I added the following code:
$_QuickStore_DelCount = $_QuickStore_DelCount * 2; $_QuickStore_DelCount = $_QuickStore_DelCount / 2;
This forces the macro to treat the value as an integer.

New version 1.2 at: http://dl.dropbox.com/u/1522294/QuickStore.7z

@ mhf

Don't forget to change your copy from 6 to 10 in two places.

Re: IDEA : a temporary bookmark holder
Posted by: siria
Date: August 10, 2011 07:24PM

Hmm, I'm not sure if that's it. IIRC the wiki says in formulas it doesn't matter whether it's a string or an integer, KM will always take the number in the string and work with that. So far that was always true in my macros too. There I rather suspect the prob lies here:
$_QuickStore_DelCount > $_QuickStore_CurrCount ?

You see, there's just no "MaxCount" defined yet...

Re: IDEA : a temporary bookmark holder
Posted by: mhf
Date: August 10, 2011 09:01PM

Quote
JamesD

@ mhf

Don't forget to change your copy from 6 to 10 in two places.

James : yes I did. Thanks again.
1.2 works - no more errors, and I'm beginning to understand a little ...
Martin.



Edited 1 time(s). Last edit at 08/10/2011 09:12PM by mhf.

Re: IDEA : a temporary bookmark holder
Posted by: JamesD
Date: August 10, 2011 09:21PM

Quote
siria
Hmm, I'm not sure if that's it. IIRC the wiki says in formulas it doesn't matter whether it's a string or an integer, KM will always take the number in the string and work with that. So far that was always true in my macros too. There I rather suspect the prob lies here:
$_QuickStore_DelCount > $_QuickStore_CurrCount ?

You see, there's just no "MaxCount" defined yet...

And yet adding the line with the math makes the macro work.

DelCount is the user's response in a prompt. CurrCount is the total existing items and comes from an 'INT' type pref. I suspect the default for the value returned by prompt is type 'STRING'.

There is no MaxCount variable in the macro.

Edit:

There is a second possible way to fix the code. It does not require the math code line. If we reverse the order of the variables in the comparison such that the integer variable is on the left, it seems to work. This is the original and revised comparisons:
$_QuickStore_DelCount > $_QuickStore_CurrCount
$_QuickStore_CurrCount < $_QuickStore_DelCount

Somehow this needs to make it into a FAQ or something. KM uses the variable type from the left hand side.



Edited 1 time(s). Last edit at 08/11/2011 12:06AM by JamesD.

Re: IDEA : a temporary bookmark holder
Posted by: siria
Date: August 11, 2011 03:52AM

Ah, so you mean, the type of the left side defines just the sort order, whether e.g. 10 is smaller or greater than 3? That might actually be...
Okay, in that case the shortest 'math-workaround' would perhaps be something like ($_counter+0)

K-Meleon forum is powered by Phorum.