Skins Macro
Posted by: Rick Diaz
Date: April 02, 2003 02:50AM

I was trying to add to the skin macro to also change the directory that kmeleon looks for the background image:



change_skin {
menu = "Change Skin...";
$skin = getpref(STRING, "kmeleon.general.skinsCurrent");
$skin = prompt("Name of new skin:", "Change Skin...", $skin);
setpref(STRING, "kmeleon.general.skinsCurrent", $skin);

$skinDir = getpref(STRING,"kmeleon.general.skinsDir");
$background = $skinDir . $skin . "/back.bmp";
setpref(STRING,"kmeleon.display.backgroundImage",$background);
alert("Background Set " . $background);
}




but for some reason the backgroundImage Pref never changes.
Any Ideas?

Rick

Re: Skins Macro
Posted by: MonkeeSage
Date: April 02, 2003 03:05AM

Rick:

In this line,

$background = $skinDir . $skin . "/back.bmp";

Try making it:

$background = $skinDir . $skin . "//back.bmp";

K-M uses a single '/' as an escape sequence, so you need two for paths.


Shelumi`El
Jordan

S.D.G

Re: Skins Macro
Posted by: rmn
Date: April 02, 2003 03:16AM

Do you escape using the slash character? I thought it was backslash.... ;-)

Try using this:
$background = $skinDir . $skin . "back.bmp";
because, if I remember correctly, the $skin must have a backslash anyway.

Re: Skins Macro
Posted by: MonkeeSage
Date: April 02, 2003 03:34AM

Oh yeah, hehe it is backslash that escapes, not slash. narded lysdexia! smiling smiley


Shelumi`El
Jordan

S.D.G

Re: Skins Macro
Posted by: Rick Diaz
Date: April 02, 2003 11:07PM

just tried the
$background = $skinDir . $skin . "back.bmp";
and it looks fine in the message box that i have poping up.
but the pref never changes. it just stays the same original value
which points to the profile directory for the back.bmp


Rick

Re: Skins Macro
Posted by: MonkeeSage
Date: April 02, 2003 11:22PM

Rick:

That's is probably because of the way K-M does preference handling, see bug 23. To confirm it is because of the same thing that causes bug 23, run the macro and then check the prefs.js file before you close K-M, and see if it is set to the right back.bmp file, and then close K-M and check it again after. If it was changed while K-M was open, but after K-M closed it went back to what it was before, then it is because of the pref handling that results in bug 23. If it is, there doesn't seem to be much you can do about it for now.


Shelumi`El
Jordan

S.D.G

Re: Skins Macro
Posted by: jsnj
Date: April 02, 2003 11:36PM

No, it never changes after the running the macro, before or after closing. I wrote about this in a thread awhile back and got the same results with the following attempt:

change_skin {
menu = "Change Skin";
$skin = getpref(STRING, "kmeleon.general.skinsCurrent");
$skin = prompt("Name of new skin:", "Change Skin...", $skin);
setpref(STRING, "kmeleon.general.skinsCurrent", $skin);
$back = getpref(STRING, "kmeleon.display.backgroundImage");
$back = prompt("New background image:", "Change background Image...", $back);
setpref(STRING, "kmeleon.display.backgroundImage", $back);
}

Re: Skins Macro
Posted by: MonkeeSage
Date: April 03, 2003 05:45AM

Interesting, I get the same thing. I think that is a new bug. A report should prolly be filled out.


Shelumi`El
Jordan

S.D.G

Re: Skins Macro
Posted by: Rick Diaz
Date: April 14, 2003 06:25PM

Just did
Thanks

K-Meleon forum is powered by Phorum.