auto skin switcher
Posted by: disrupted
Date: September 11, 2009 08:39PM

download from kmext

enables changing your default skin at k-meleon startup. you can select between 2 skins.. the 2 skins will be alternated every time kmeleon is started.
this extension is useful when you get bored with having a constant one skin and want to change it automatically or even for testers who want to compare a skin's toolbars against another skin.

how to use:

the skin switcher menu is located at edit>configuration>skin switcher

to enable switching, select 'enable skin switcher'


the first time you select enable skin switch, you will be prompted for the secondary skin name (your primary skin is the one currently active).. enter the skin name and make sure it's a valid skin (skin name should be the same as in km prefs. skins>dropdown men)


now kmeleon will toggle between your secondary and primary skin every time you open kmeleon


don't worry if you enter a wrong skin name,

it won't be set as your secondary skin avoiding causing problems with 'skin not found and removing your bars'


if you want to disable auto skin switcher, simply go to the skin switcher menu and unselect enable skin switcher. if you reenable your skin switcher you will not be prompted to enter your secondary skin name(this only happens on first run when no secondary skin has been found)

if you do want to change your secondary skin, you can go to skin switch menu and select config skinswitcher


if your primary skin is the one active, you can change your secondary skin.. if your secondary skin is the one that's active; it will then be set as your primary skin and a new secondary skin will be set

on next run:


for convenience, setting a new secondary skin from 'config skinswitcher' will automatically enable the skin switcher even if you had deselected it earlier.

# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# --------toggles between 2 skins after every run

skinswitch{
menuchecked=getpref(BOOL,"kmeleon.ext.skinswitch");
$sknstate=getpref(BOOL,"kmeleon.ext.skinswitch");
$active=("true");
$sknstate==$active?&sknswitchoff:&firstrunchk;
}

configsknsw{
#alert("went to the configure. ", "testfuck", EXCLAIM);
$nextskn=prompt("Enter the skin name to be alternated next time you open K-Meleon :", "Enter skin name", "Phoenity");
$nextskn== "" ? "" : &chknextskin;
}

chknextskin{
$skins=getfolder(RootFolder)."\\skins\\";
$pendcheck=($skins.$nextskn);
$foolproof=pluginmsgex(utils, "exist", $pendcheck, STRING);
$noshit=("true");
$foolproof==$noshit?&saferes:&alertfuck;
}

alertfuck{
$foolproof=pluginmsgex(utils, "exist", "c:\\winblows", STRING);
alert("The skin you have entered does not exist. Please check the skin's name and try again. ", "Error: Can't resume", EXCLAIM);
}

saferes{
$currentskn=getpref(STRING,"kmeleon.general.skinsCurrent");
setpref(STRING,"kmeleon.ext.skinswitch.defskin", $currentskn);
setpref(STRING,"kmeleon.ext.skinswitch.nextskin", $nextskn);
togglepref(BOOL,"kmeleon.ext.skinswitch");
statusbar("k-meleon will now toggle between your selected skin and the current skin");
}

sknswitchon{
#alert("went to the skinswitchon. ", "testfuck", EXCLAIM);
togglepref(BOOL,"kmeleon.ext.skinswitch");
statusbar("k-meleon will now toggle between your selected skin and the current skin");
}

sknswitcher{
$switchstate=getpref(BOOL,"kmeleon.ext.skinswitch");
$nonactive=("false");
$switchstate==$nonactive?0:&switchmode;
}

switchmode{
$findlast=getpref(STRING,"kmeleon.general.skinsCurrent");
$finddef=getpref(STRING,"kmeleon.ext.skinswitch.defskin");
$finddef== $findlast?&changealt:&changedef;
}

changealt{
$secondary=getpref(STRING,"kmeleon.ext.skinswitch.nextskin");
setpref(STRING,"kmeleon.general.skinsCurrent", $secondary);
}

changedef{
$primary=getpref(STRING,"kmeleon.ext.skinswitch.defskin");
setpref(STRING,"kmeleon.general.skinsCurrent", $primary);
}

firstrunchk{
$lastskin=getpref(STRING,"kmeleon.ext.skinswitch.nextskin");
$noset=("");
$lastskin==$noset?&configsknsw:&sknswitchon;
}

sknswitchoff{
#alert("went to the skinswitchoggff. ", "testfuck", EXCLAIM);
togglepref(BOOL,"kmeleon.ext.skinswitch");
statusbar("k-meleon will no longer toggle between 2 skins");
}

configsknset{
$nextskn=prompt("Enter the skin name to be alternated next time you open K-Meleon :", "Enter skin name", "Phoenity");
$nextskn== "" ? "" : &chknextset;
}

chknextset{
$skins=getfolder(RootFolder)."\\skins\\";
$pendcheck=($skins.$nextskn);
$foolproof=pluginmsgex(utils, "exist", $pendcheck, STRING);
$noshit=("true");
$foolproof==$noshit?&safeset:&alertfuck;
}

safeset{
$currentskn=getpref(STRING,"kmeleon.general.skinsCurrent");
setpref(STRING,"kmeleon.ext.skinswitch.defskin", $currentskn);
setpref(STRING,"kmeleon.ext.skinswitch.nextskin", $nextskn);
statusbar("k-meleon will now toggle between your selected skin and the current skin");
$sknstate=getpref(BOOL,"kmeleon.ext.skinswitch");
$disabled=("false");
$sknstate==$disabled?&sknswitchon:0;
}

sknswitch_BuildMenu{
setmenu("_Config_General",popup,"Skin Switcher",6);
setmenu("Skin Switcher",macro,"Enable Skinswitcher",skinswitch);
setmenu("Skin Switcher",macro,"Config Skinswitcher",configsknset);
}

$OnInit=$OnInit."sknswitch_BuildMenu;";
$OnQuit=$OnQuit."sknswitcher;";
# ----------------------------------------------
$macroModules=$macroModules."autoskn_switch;";




Edited 1 time(s). Last edit at 03/13/2010 04:48PM by disrupted.

Re: auto skin switcher
Posted by: jsnj
Date: September 21, 2009 11:29AM

Doesn't recognize any skin name placed in the prompt dialog. Not even the auto-placed Phoenity. I always get the "doesn't exist" message. I haven't looked at the macro close enough to determine what the problem is yet. Too tired at the moment tongue sticking out smiley

Re: auto skin switcher
Posted by: disrupted
Date: September 21, 2009 11:18PM

it seems the utils plugin cannot recognise your skins path, that's why it won't allow it.. i did test with long folder names and with spaces 'program files' and it worked fine and didn't seem to require additional coding like double quotes but maybe it differs from system to system..what is your kmeloen's install path?

try this macro:

# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# --------toggles between 2 skins after every run

skinswitch{
menuchecked=getpref(BOOL,"kmeleon.ext.skinswitch");
$sknstate=getpref(BOOL,"kmeleon.ext.skinswitch");
$active=("true");
$sknstate==$active?&sknswitchoff:&firstrunchk;
}

configsknsw{
#alert("went to the configure. ", "testfuck", EXCLAIM);
$nextskn=prompt("Enter the skin name to be alternated next time you open K-Meleon :", "Enter skin name", "Phoenity");
$nextskn== "" ? "" : &chknextskin;
}

chknextskin{
$skins=getfolder(RootFolder)."\\skins\\";
$pendcheck=($skins.$nextskn);
$foolproof=pluginmsgex(utils, "exist", $pendcheck, STRING);
$noshit=("true");
$foolproof==$noshit?&saferes:&alertfuck;
}

alertfuck{
$foolproof=pluginmsgex(utils, "exist", "c:\\winblows", STRING);
alert($pendcheck, "Error: Can't resume", EXCLAIM);
}

saferes{
$currentskn=getpref(STRING,"kmeleon.general.skinsCurrent");
setpref(STRING,"kmeleon.ext.skinswitch.defskin", $currentskn);
setpref(STRING,"kmeleon.ext.skinswitch.nextskin", $nextskn);
togglepref(BOOL,"kmeleon.ext.skinswitch");
statusbar("k-meleon will now toggle between your selected skin and the current skin");
}

sknswitchon{
#alert("went to the skinswitchon. ", "testfuck", EXCLAIM);
togglepref(BOOL,"kmeleon.ext.skinswitch");
statusbar("k-meleon will now toggle between your selected skin and the current skin");
}

sknswitcher{
$switchstate=getpref(BOOL,"kmeleon.ext.skinswitch");
$nonactive=("false");
$switchstate==$nonactive?0:&switchmode;
}

switchmode{
$findlast=getpref(STRING,"kmeleon.general.skinsCurrent");
$finddef=getpref(STRING,"kmeleon.ext.skinswitch.defskin");
$finddef== $findlast?&changealt:&changedef;
}

changealt{
$secondary=getpref(STRING,"kmeleon.ext.skinswitch.nextskin");
setpref(STRING,"kmeleon.general.skinsCurrent", $secondary);
}

changedef{
$primary=getpref(STRING,"kmeleon.ext.skinswitch.defskin");
setpref(STRING,"kmeleon.general.skinsCurrent", $primary);
}

firstrunchk{
$lastskin=getpref(STRING,"kmeleon.ext.skinswitch.nextskin");
$noset=("");
$lastskin==$noset?&configsknsw:&sknswitchon;
}

sknswitchoff{
#alert("went to the skinswitchoggff. ", "testfuck", EXCLAIM);
togglepref(BOOL,"kmeleon.ext.skinswitch");
statusbar("k-meleon will no longer toggle between 2 skins");
}

configsknset{
$nextskn=prompt("Enter the skin name to be alternated next time you open K-Meleon :", "Enter skin name", "Phoenity");
$nextskn== "" ? "" : &chknextset;
}

chknextset{
$skins=getfolder(RootFolder)."\\skins\\";
$pendcheck=($skins.$nextskn);
$foolproof=pluginmsgex(utils, "exist", $pendcheck, STRING);
$noshit=("true");
$foolproof==$noshit?&safeset:&alertfuck;
}

safeset{
$currentskn=getpref(STRING,"kmeleon.general.skinsCurrent");
setpref(STRING,"kmeleon.ext.skinswitch.defskin", $currentskn);
setpref(STRING,"kmeleon.ext.skinswitch.nextskin", $nextskn);
statusbar("k-meleon will now toggle between your selected skin and the current skin");
$sknstate=getpref(BOOL,"kmeleon.ext.skinswitch");
$disabled=("false");
$sknstate==$disabled?&sknswitchon:0;
}

sknswitch_BuildMenu{
setmenu("_Config_General",popup,"Skin Switcher",6);
setmenu("Skin Switcher",macro,"Enable Skinswitcher",skinswitch);
setmenu("Skin Switcher",macro,"Config Skinswitcher",configsknset);
}

$OnInit=$OnInit."sknswitch_BuildMenu;";
$OnQuit=$OnQuit."sknswitcher;";
# ----------------------------------------------
$macroModules=$macroModules."autoskn_switch;";


this will not fix the problem but in the error message will display the path where the skin should be and help understand why utils plugin isn't accepting it
does the path have any special unconventional characters?

you can also try this:

# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# --------toggles between 2 skins after every run

skinswitch{
menuchecked=getpref(BOOL,"kmeleon.ext.skinswitch");
$sknstate=getpref(BOOL,"kmeleon.ext.skinswitch");
$active=("true");
$sknstate==$active?&sknswitchoff:&firstrunchk;
}

configsknsw{
#alert("went to the configure. ", "testfuck", EXCLAIM);
$nextskn=prompt("Enter the skin name to be alternated next time you open K-Meleon :", "Enter skin name", "Phoenity");
$nextskn== "" ? "" : &chknextskin;
}

chknextskin{
$skins=getfolder(RootFolder)."\\skins\\";
$pendcheck=($skins.$nextskn);
$foolproof=pluginmsgex(utils, "exist", $pendcheck, STRING);
$noshit=("true");
$foolproof==$noshit?&saferes:&saferes;
}

alertfuck{
$foolproof=pluginmsgex(utils, "exist", "c:\\winblows", STRING);
alert("The skin you have entered does not exist. Please check the skin's name and try again. ", "Error: Can't resume", EXCLAIM);
}

saferes{
$currentskn=getpref(STRING,"kmeleon.general.skinsCurrent");
setpref(STRING,"kmeleon.ext.skinswitch.defskin", $currentskn);
setpref(STRING,"kmeleon.ext.skinswitch.nextskin", $nextskn);
togglepref(BOOL,"kmeleon.ext.skinswitch");
statusbar("k-meleon will now toggle between your selected skin and the current skin");
}

sknswitchon{
#alert("went to the skinswitchon. ", "testfuck", EXCLAIM);
togglepref(BOOL,"kmeleon.ext.skinswitch");
statusbar("k-meleon will now toggle between your selected skin and the current skin");
}

sknswitcher{
$switchstate=getpref(BOOL,"kmeleon.ext.skinswitch");
$nonactive=("false");
$switchstate==$nonactive?0:&switchmode;
}

switchmode{
$findlast=getpref(STRING,"kmeleon.general.skinsCurrent");
$finddef=getpref(STRING,"kmeleon.ext.skinswitch.defskin");
$finddef== $findlast?&changealt:&changedef;
}

changealt{
$secondary=getpref(STRING,"kmeleon.ext.skinswitch.nextskin");
setpref(STRING,"kmeleon.general.skinsCurrent", $secondary);
}

changedef{
$primary=getpref(STRING,"kmeleon.ext.skinswitch.defskin");
setpref(STRING,"kmeleon.general.skinsCurrent", $primary);
}

firstrunchk{
$lastskin=getpref(STRING,"kmeleon.ext.skinswitch.nextskin");
$noset=("");
$lastskin==$noset?&configsknsw:&sknswitchon;
}

sknswitchoff{
#alert("went to the skinswitchoggff. ", "testfuck", EXCLAIM);
togglepref(BOOL,"kmeleon.ext.skinswitch");
statusbar("k-meleon will no longer toggle between 2 skins");
}

configsknset{
$nextskn=prompt("Enter the skin name to be alternated next time you open K-Meleon :", "Enter skin name", "Phoenity");
$nextskn== "" ? "" : &chknextset;
}

chknextset{
$skins=getfolder(RootFolder)."\\skins\\";
$pendcheck=($skins.$nextskn);
$foolproof=pluginmsgex(utils, "exist", $pendcheck, STRING);
$noshit=("true");
$foolproof==$noshit?&safeset:&alertfuck;
}

safeset{
$currentskn=getpref(STRING,"kmeleon.general.skinsCurrent");
setpref(STRING,"kmeleon.ext.skinswitch.defskin", $currentskn);
setpref(STRING,"kmeleon.ext.skinswitch.nextskin", $nextskn);
statusbar("k-meleon will now toggle between your selected skin and the current skin");
$sknstate=getpref(BOOL,"kmeleon.ext.skinswitch");
$disabled=("false");
$sknstate==$disabled?&sknswitchon:0;
}

sknswitch_BuildMenu{
setmenu("_Config_General",popup,"Skin Switcher",6);
setmenu("Skin Switcher",macro,"Enable Skinswitcher",skinswitch);
setmenu("Skin Switcher",macro,"Config Skinswitcher",configsknset);
}

$OnInit=$OnInit."sknswitch_BuildMenu;";
$OnQuit=$OnQuit."sknswitcher;";
# ----------------------------------------------
$macroModules=$macroModules."autoskn_switch;";


this one will bypass the skin check..so any skin you enter will be accepted, just make sure to enter a valid skin.. but try the first modification first so we can know why utils doesn't like your skin path (modifications are in red)

Re: auto skin switcher
Posted by: jsnj
Date: September 22, 2009 02:03AM

LOL....my bad....I had installed the utils plugin ages ago but forgot that I disabled it

Re: auto skin switcher
Posted by: disrupted
Date: September 22, 2009 04:43AM

yeah..it's a terrible bug..i'll ty to work on it later to make it check if the utils plugin is enabled first..this should fix that problem. thanks j

K-Meleon forum is powered by Phorum.