General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
getfolder in macro: gives name only in uppercase?
Posted by: siria
Date: January 18, 2010 08:02PM

Little problem with macros here:
When using "promptforfile" for user-input, the resulting path will have mixed characters, upper- and lowercase, as it is in reality.
But when using "getfolder(rootfolder)", the result will only be in uppercase.
Now when comparing those two folders with the "index" function, it will say user-input and KM-folder are different, even if in reality they are the same :-(

Is that a bug, or win98, or anyone know a workaround??

Edit: Substituting doesn't work either, since it simply is considered DIFFERENT:
sub(getfolder(RootFolder),"",$_path);



Edited 2 time(s). Last edit at 01/18/2010 09:21PM by siria.

Options: ReplyQuote
Re: getfolder in macro: gives name only in uppercase?
Posted by: JujuLand
Date: January 18, 2010 09:19PM

I don't think that getfolder has this problem, else, K-Meleon under wine ought to have some problems ...

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: getfolder in macro: gives name only in uppercase?
Posted by: JamesD
Date: January 18, 2010 09:39PM

I just checked all 7 settings for getfolder() on my KM 1.5.3 XP-SP3. All were mixed case. Maybe I can try again to get the old win 98 box working. If I can I will let you know what I find.

Options: ReplyQuote
Re: getfolder in macro: gives name only in uppercase?
Posted by: siria
Date: January 18, 2010 09:54PM

Okay, thanks! smiling smiley
So it's just Win98, good to know. But no need to struggle with your old box because of this, uaah...

Options: ReplyQuote
Re: getfolder in macro: gives name only in uppercase?
Posted by: slayer
Date: January 19, 2010 02:08AM

I think Windows doesn't care about the folders being uppercase, lowercase or mixed. So, you will need to work with upper case letters in your macro.

Options: ReplyQuote
Re: getfolder in macro: gives name only in uppercase?
Posted by: siria
Date: January 19, 2010 08:45AM

Quote
slayer
I think Windows doesn't care about the folders being uppercase, lowercase or mixed. So, you will need to work with upper case letters in your macro.

Haha :cool: ;-)
That's exactly the problem, win98 doesn't care about the case, but the comparing functions in KM do very much. So if a user is asked by a macro to choose a folder, the result is mixed-case. Now if the macro compares that path with the KM folder it will ALWAYS declare the user-path were outside. How to "work with that"??

Perhaps there's some elegant function to convert cases, perhaps with js or whatever, but never mind. For now I'll use a (rather lousy) workaround, to check if a promptforfile path ($_xypath) is inside the KM root folder:
Count how many characters the rootfolder has, lets say it's 15, then take the first 15 characters of the promptforfile-path, cut the rest of its path, append \defaults\pref\kmeleon.js, and look if that exists...

readfile(substr($_xypath,0,length(getfolder(RootFolder)))."\\defaults\\pref\\kmeleon.js")==""?

Funnily, getfolder only gives the ROOT of the folders in uppercase! If there's more afterwards, like for "macrofolder" or "profilefolder", those parts will have normal cases. Example for "getfolder(macrofolder)":

in xp -> D:\testPaTh\K-Meleon\macros
in win9x -> D:\TESTPATH\K-MELEON\macros


BTW I'm also struggling with the readfile command, if used for checking if a file in a local path exists. Meaning in a local usb-stick compatible path "tools\..." instead of "c:\programs\k-meleon\tools\..."
Funnily local paths work fine for everything, calling programs and files from there, except for readfile. It either gets a full path or it finds nothing tongue sticking out smiley
Using a workaround for that too, but of course the macros look more and more confusing that way :-/



Edited 3 time(s). Last edit at 01/20/2010 02:18PM by siria.

Options: ReplyQuote
Re: getfolder in macro: gives name only in uppercase?
Posted by: slayer
Date: January 19, 2010 02:55PM

I thought that a upper( or ucase( function was available, but I can not find it.

Options: ReplyQuote
Re: getfolder in macro: gives name only in uppercase?
Posted by: JamesD
Date: January 19, 2010 03:21PM

Have you tried the "exist" function in Mark307\s utils.dll?

Options: ReplyQuote
Re: getfolder in macro: gives name only in uppercase?
Posted by: desga2
Date: January 19, 2010 09:40PM

I think this is a Win9x problem that show folder names in mixed case but write the names with DOS old system in UPPER case.
Open a command console and look for the folder name is really in low or in upper case.
I think there was some option to set this in Win9x to show all files and folder names with his really DOS names and not showed it converted in mixed case.
(Something as "Show capital letters in file and folder names" or similar)

K-Meleon in Spanish

Options: ReplyQuote
Re: getfolder in macro: gives name only in uppercase?
Posted by: siria
Date: January 19, 2010 11:04PM

Good idea, desga. But I checked, and the DOS-name is K-MELE~5 (shortened from K-Meleon153), so that can't really be the reason either. Yes in some file explorers is an option to show folders always uppercase, but my MS explorer is set to show the true cases, which is mixed. Still suspecting the reason is probably somewhere in the k-meleonW9x.exe...
And it's really funny that only the rootfolder and before is uppercase, not the stuff afterwards in the path!

No, the utils.dll I haven't tried. On one hand because I only see it mentioned occasionally in the forum, but know no documentation about it, but mostly because it's not included yet in the default KM. If possible I rather avoid additional files with the macros, at least with such small and trivial ones like the one at hand.
But I'd be very happy if there come more default macro functions in the future, that would really make things a lot easier!



Edited 3 time(s). Last edit at 01/20/2010 08:21AM by siria.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.