Well I have updated code. It works as long as I do not reset the pref. The two "saves" take too much time and the pref is reset to false before all the action finished, I guess. Feel free to try out the code and make changes if needed. One other minor change was added at line 63.
Edit: This code updated to version = .6 because of a timing problem. I have fast processor but a standard speed drive. I had to put an alert to allow the file saves to finish before resetting the pref to false.
DLS.kmm
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#
# ---------- DLS.kmm
#
# Dependencies : main.kmm
# Resources : -
# Preferences : "k-meleon_DLS_use"
# Version : .6
# --------------------------------------------------------------------------------
_DLS_download {
$linkIdx = "http://kmeleon.sourceforge.net/gfx/shot";
$ext = ".png";
$i=3;
$c=1;
$_DLS_sc=0;
while($i<5) {
openbgtab( $linkIdx . $i . $ext );
macros("_DLS_assignurl");
setpref( INT , "k-meleon_DLS_use", $c );
$i = $i+1; $c = $c+1 ;
}
}
_DLS_assignurl {
$i==1 ? $DLS_url_1 = $linkIdx . $i . $ext : 0;
$i==2 ? $DLS_url_2 = $linkIdx . $i . $ext : 0;
$i==3 ? $DLS_url_3 = $linkIdx . $i . $ext : 0;
$i==4 ? $DLS_url_4 = $linkIdx . $i . $ext : 0;
$i==5 ? $DLS_url_5 = $linkIdx . $i . $ext : 0;
$i==6 ? $DLS_url_6 = $linkIdx . $i . $ext : 0;
$i==7 ? $DLS_url_7 = $linkIdx . $i . $ext : 0;
$i==8 ? $DLS_url_8 = $linkIdx . $i . $ext : 0;
$i==9 ? $DLS_url_9 = $linkIdx . $i . $ext : 0;
}
_DLS_status {
if (getpref(INT,"k-meleon_DLS_use") > 0 ) {
$_DLS_sc = $_DLS_sc + 1;
statusbar("pages loaded = " . $_DLS_sc);
}
}
_DLS_save {
$_DLS_cc = getpref(INT,"k-meleon_DLS_use");
setpref(BOOL, "kmeleon.download.useSaveDir", true) ;
while( $_DLS_cc > 0) {
id(ID_TAB_NEXT) ;
if ( $URL == $DLS_url_1 ) { id(ID_FILE_SAVE_AS); $DLS_url_1 = ""; $_DLS_cc = $_DLS_cc-1; }
if ( $URL == $DLS_url_2 ) { id(ID_FILE_SAVE_AS); $DLS_url_2 = ""; $_DLS_cc = $_DLS_cc-1; }
if ( $URL == $DLS_url_3 ) { id(ID_FILE_SAVE_AS); $DLS_url_3 = ""; $_DLS_cc = $_DLS_cc-1; }
if ( $URL == $DLS_url_4 ) { id(ID_FILE_SAVE_AS); $DLS_url_4 = ""; $_DLS_cc = $_DLS_cc-1; }
if ( $URL == $DLS_url_5 ) { id(ID_FILE_SAVE_AS); $DLS_url_5 = ""; $_DLS_cc = $_DLS_cc-1; }
if ( $URL == $DLS_url_6 ) { id(ID_FILE_SAVE_AS); $DLS_url_6 = ""; $_DLS_cc = $_DLS_cc-1; }
if ( $URL == $DLS_url_7 ) { id(ID_FILE_SAVE_AS); $DLS_url_7 = ""; $_DLS_cc = $_DLS_cc-1; }
if ( $URL == $DLS_url_8 ) { id(ID_FILE_SAVE_AS); $DLS_url_8 = ""; $_DLS_cc = $_DLS_cc-1; }
if ( $URL == $DLS_url_9 ) { id(ID_FILE_SAVE_AS); $DLS_url_9 = ""; $_DLS_cc = $_DLS_cc-1; }
}
setpref(INT,"k-meleon_DLS_use",0);
alert( "save to drive completion","Planned wait for",INFO);
setpref(BOOL, "kmeleon.download.useSaveDir", false) ;
$_DLS_sc = 0 ;
}
_DLS_BuildMenu{
setmenu("&Tools",macro,"DLS-Get",_DLS_download,Misc);
setmenu("&Tools",macro,"DLS-Save",_DLS_save,Misc);
$_DLS_sc=0;
}
$OnLoad=$OnLoad."_DLS_status;";
$OnInit=$OnInit."_DLS_BuildMenu;";
Edited 1 time(s). Last edit at 03/14/2011 12:56PM by JamesD.