K-Meleon

KMeleonWiki > Resources > MacroLibrary > MacroLibrary2 > Session Macro

Submitted by: MonkeeSage - MonkeeSage@ToughGuy.net - http://gratisDei.com/KM.htm



Notes: For version 0.8 beta & above


In Macros:

#
# Session stuff...
#

$islayer = getpref(BOOL,"kmeleon.plugins.layers.load");

$sess1 = "";
$sess2 = "";
$sess3 = "";
$sess4 = "";
$sess5 = "";
$sess6 = "";
$sess7 = "";
$sess8 = "";

session_set_up {
  $sess = getpref(STRING, "kmeleon.session.entire");
  $len = length($sess);
  $index = index($sess, "\t");
  $sess1 = substr($sess, 0, $index);

  $sess = substr($sess, $index+1, $len);
  $len = length($sess);
  $index = index($sess, "\t");
  $sess2 = substr($sess, 0, $index);

  $sess = substr($sess, $index+1, $len);
  $len = length($sess);
  $index = index($sess, "\t");
  $sess3 = substr($sess, 0, $index);

  $sess = substr($sess, $index+1, $len);
  $len = length($sess);
  $index = index($sess, "\t");
  $sess4 = substr($sess, 0, $index);

  $sess = substr($sess, $index+1, $len);
  $len = length($sess);
  $index = index($sess, "\t");
  $sess5 = substr($sess, 0, $index);

  $sess = substr($sess, $index+1, $len);
  $len = length($sess);
  $index = index($sess, "\t");
  $sess6 = substr($sess, 0, $index);

  $sess = substr($sess, $index+1, $len);
  $len = length($sess);
  $index = index($sess, "\t");
  $sess7 = substr($sess, 0, $index);

  $sess = substr($sess, $index+1, $len);
  $index = index($sess, "\t");
  $sess8 = substr($sess, 0, $index);
}

session_save_url {
  menu = "Save to session..."
  macros(session_set_up);
  $save = prompt("Session prompt:", "Save to Session", "");
  $save == "" ? $save = "1" : $save = $save;
  $save == "1" ? $save_out = $URL."\t".$sess2."\t".$sess3."\t".$sess4."\t".$sess5."\t".$sess6."\t".$sess7."\t".$sess8."\t" : "";
  $save == "2" ? $save_out = $sess1."\t".$URL."\t".$sess3."\t".$sess4."\t".$sess5."\t".$sess6."\t".$sess7."\t".$sess8."\t": "";
  $save == "3" ? $save_out = $sess1."\t".$sess2."\t".$URL."\t".$sess4."\t".$sess5."\t".$sess6."\t".$sess7."\t".$sess8."\t" : "";  
  $save == "4" ? $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$URL."\t".$sess5."\t".$sess6."\t".$sess7."\t".$sess8."\t" : "";
  $save == "5" ? $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$sess4."\t".$URL."\t".$sess6."\t".$sess7."\t".$sess8."\t" : "";
  $save == "6" ? $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$sess4."\t".$sess5."\t".$URL."\t".$sess7."\t".$sess8."\t" : "";
  $save == "7" ? $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$sess4."\t".$sess5."\t".$sess6."\t".$URL."\t".$sess8."\t" : "";
  $save == "8" ? $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$sess4."\t".$sess5."\t".$sess6."\t".$sess7."\t".$URL."\t" : "";
  setpref(STRING, "kmeleon.session.entire", $save_out); 
  statusbar("Url saved to session, use Session menu to restore.");
}

session_load_url {
  menu = "Load from session..."
  $load = prompt("Session prompt:", "Load from Session", "");
  $load == "" ? $load = "1" : $load = $load;
  macros(session_load_url_.$load);
}

session_load_url_1 {
  macros(session_set_up);
  $sess1 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess1) : openbg($sess1)) : "";
  statusbar("Url loaded from session.");
}

session_load_url_2 {
  macros(session_set_up);
  $sess2 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess2) : openbg($sess2)) : "";
  statusbar("Url loaded from session.");
}

session_load_url_3 {
  macros(session_set_up);
  $sess3 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess3) : openbg($sess3)) : "";
  statusbar("Url loaded from session.");
}

session_load_url_4 {
  macros(session_set_up);
  $sess4 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess4) : openbg($sess4)) : "";
  statusbar("Url loaded from session.");
}

session_load_url_5 {
  macros(session_set_up);
  $sess5 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess5) : openbg($sess5)) : "";
  statusbar("Url loaded from session.");
}

session_load_url_6 {
  macros(session_set_up);
  $sess6 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess6) : openbg($sess6)) : "";
  statusbar("Url loaded from session.");
}

session_load_url_7 {
  macros(session_set_up);
  $sess7 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess7) : openbg($sess7)) : "";
  statusbar("Url loaded from session.");
}

session_load_url_8 {
  macros(session_set_up);
  $sess8 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess8) : openbg($sess8)) : "";
  statusbar("Url loaded from session.");
}

session_save_url_1 {
  macros(session_set_up);
  $save_out = $URL."\t".$sess2."\t".$sess3."\t".$sess4."\t".$sess5."\t".$sess6."\t".$sess7."\t".$sess8."\t";
  setpref(STRING, "kmeleon.session.entire", $save_out); 
  statusbar("Url saved to session.");
}

session_save_url_2 {
  macros(session_set_up);
  $save_out = $sess1."\t".$URL."\t".$sess3."\t".$sess4."\t".$sess5."\t".$sess6."\t".$sess7."\t".$sess8."\t";
  setpref(STRING, "kmeleon.session.entire", $save_out); 
  statusbar("Url saved to session.");
}

session_save_url_3 {
  macros(session_set_up);
  $save_out = $sess1."\t".$sess2."\t".$URL."\t".$sess4."\t".$sess5."\t".$sess6."\t".$sess7."\t".$sess8."\t";  
  setpref(STRING, "kmeleon.session.entire", $save_out); 
  statusbar("Url saved to session.");
}

session_save_url_4 {
  macros(session_set_up);
  $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$URL."\t".$sess5."\t".$sess6."\t".$sess7."\t".$sess8."\t";
  setpref(STRING, "kmeleon.session.entire", $save_out); 
  statusbar("Url saved to session.");
}

session_save_url_5 {
  macros(session_set_up);
  $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$sess4."\t".$URL."\t".$sess6."\t".$sess7."\t".$sess8."\t";
  setpref(STRING, "kmeleon.session.entire", $save_out); 
  statusbar("Url saved to session.");
}

session_save_url_6 {
  macros(session_set_up);
  $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$sess4."\t".$sess5."\t".$URL."\t".$sess7."\t".$sess8."\t";
  setpref(STRING, "kmeleon.session.entire", $save_out); 
  statusbar("Url saved to session.");
}

session_save_url_7 {
  macros(session_set_up);
  $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$sess4."\t".$sess5."\t".$sess6."\t".$URL."\t".$sess8."\t";
  setpref(STRING, "kmeleon.session.entire", $save_out); 
  statusbar("Url saved to session.");
}

session_save_url_8 {
  macros(session_set_up);
  $save_out = $sess1."\t".$sess2."\t".$sess3."\t".$sess4."\t".$sess5."\t".$sess6."\t".$sess7."\t".$URL."\t";
  setpref(STRING, "kmeleon.session.entire", $save_out); 
  statusbar("Url saved to session.");
}

session_save_all {
  $sess = pluginmsgex(layers,"GetLayersInWindow","",STRING);
  setpref(STRING, "kmeleon.session.entire", $sess);
  statusbar("Saving entire session...");
}

session_open_if_more {
  $sess = getpref(STRING, "kmeleon.session.entire");
  $index = index($sess, "\t\t");
  $index == -1 ? pluginmsg(layers, "ReplaceLayersInWindow", $sess) : pluginmsg(layers, "ReplaceLayersInWindow", substr($sess, 0, $index));
  statusbar("Loading entire session...");
}

session_open_if_more_bg {
  macros(session_set_up);
  $sess1 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess1) : openbg($sess1)) : "";
  $sess2 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess2) : openbg($sess2)) : "";
  $sess3 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess3) : openbg($sess3)) : "";
  $sess4 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess4) : openbg($sess4)) : "";
  $sess5 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess5) : openbg($sess5)) : "";
  $sess6 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess6) : openbg($sess6)) : "";
  $sess7 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess7) : openbg($sess7)) : "";
  $sess8 != "" ? ($islayer ? pluginmsg(layers, "OpenURLBg", $sess8) : openbg($sess8)) : "";
  statusbar("Loading entire session...");
}

session_reset {
  setpref(STRING, "kmeleon.session.entire", ""); 
  statusbar("Session has been reset");
}

session_do_set_startup {
menu = "Autoload Session";
getpref(BOOL, "kmeleon.session.do_start") == "true" ? macros(session_unset_startup) : macros(session_set_startup);
}

session_set_startup {
setpref(BOOL, "kmeleon.session.do_start", "true");
alert("Session autoloading is now enabled", "Session Info", INFO);
statusbar("Session autoloading is now enabled...");
}

session_unset_startup {
setpref(BOOL, "kmeleon.session.do_start", "false");
alert("Session autoloading is now disabled", "Session Info", INFO);
statusbar("Session autoloading is now disabled...");
}


#
# Startup stuff...
#

OnStartup {
  getpref(BOOL, "kmeleon.session.do_start") == "true" ? macros(session_open_if_more) : "";
}


In Menus:

Save... {
  macros(session_save_url_1, Save 1)
  macros(session_save_url_2, Save 2)
  macros(session_save_url_3, Save 3)
  macros(session_save_url_4, Save 4)
  macros(session_save_url_5, Save 5)
  macros(session_save_url_6, Save 6)
  macros(session_save_url_7, Save 7)
  macros(session_save_url_8, Save 8)
}

Load... {
  macros(session_load_url_1, Load 1)
  macros(session_load_url_2, Load 2)
  macros(session_load_url_3, Load 3)
  macros(session_load_url_4, Load 4)
  macros(session_load_url_5, Load 5)
  macros(session_load_url_6, Load 6)
  macros(session_load_url_7, Load 7)
  macros(session_load_url_8, Load 8)
}

&Session {
  :Save...
  macros(session_save_url, Save to session...)
  -
  :Load...
  macros(session_load_url, Load from session...)
  -
  macros(session_open_if_more, Load entire session)
  macros(session_open_if_more_bg, Entire session bg)
  macros(session_save_all, Save entire session)
  macros(session_reset, Reset entire session)
  -
  macros(session_do_set_startup)
}

&Main{
...
:&Session
bmpmenu()
}


In Accelerators:

CTRL 1 =  macros(session_load_url_1) 
CTRL 2 =  macros(session_load_url_2)
CTRL 3 =  macros(session_load_url_3)
CTRL 4 =  macros(session_load_url_4)
CTRL 5 =  macros(session_load_url_5)
CTRL 6 =  macros(session_load_url_6)
CTRL 7 =  macros(session_load_url_7)
CTRL 8 =  macros(session_load_url_8)
CTRL 9 =  macros(session_open_if_more)
CTRL 0 =  macros(session_open_if_more_bg)

ALT 1 =  macros(session_save_url_1) 
ALT 2 =  macros(session_save_url_2) 
ALT 3 =  macros(session_save_url_3) 
ALT 4 =  macros(session_save_url_4) 
ALT 5 =  macros(session_save_url_5) 
ALT 6 =  macros(session_save_url_6) 
ALT 7 =  macros(session_save_url_7) 
ALT 8 =  macros(session_save_url_8) 


User Comments:

K-Meleon

(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.