home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Netrunner 2004 October
/
NETRUNNER0410.ISO
/
regular
/
irvine1_0_9.lzh
/
scripts
/
listrenamefile.dms
< prev
next >
Wrap
Text File
|
2003-01-26
|
2KB
|
97 lines
/*
âXâNâèâvâgÅëè·ë╗âfü[â^
guid={E4D96FCE-D4D9-4FF2-A6D7-9D4BD27C9AE9}
caption=âtâ@âCâïû╝é≡ÿAö╘ò╧ìX
version=1
hint=æIæ≡âAâCâeâÇé╠âtâ@âCâïû╝é≡ÿAö╘é╓ò╧ìXé╡é▄é╖
event=OnListMenuClick
match=
author=Wolfy
*/
function formatDigit(num,digit){
var s = num.toString();
if(s.length < digit){
var temp = '';
for(var i = 0; i < digit - s.length;i++)
temp = temp + '0';
s = temp + s;
}
return s;
}
function extractExt(s){
var index = s.lastIndexOf('.');
if(index > -1){
return s.slice(index + 1,s.length - 1);
}
else
return '';
}
function OnListMenuClick(irvine,action){
//âLâàü[âèâXâgâüâjâàü[é╠âNâèâbâNâCâxâôâg
var item = new IrvineItem;
//ÅIéφéΦ
if(irvine.SelectedItemCount == 0)
return;
//âJâîâôâgâtâHâïâ_û╝
var folder = irvine.CurrentQueueFolder;
var index = folder.lastIndexOf('/');
folder = folder.slice(index + 1,folder.length - 1);
//É┌ô¬îΩé≡ô╛éΘ
var head = prompt('ò╧ìXîπé╠âtâ@âCâïû╝é╠ɵô¬é≡ôⁿù═é╡é─é¡é╛é│éóüBï≤öÆé≡ôⁿù═é╖éΘé╞âNâèâAé╡é▄é╖üB',folder);
//ÅIéφéΦ
if(head == null){
return;
}
else if(head == ''){
//ë╜éαé╡é╚éó
}
else{
var start = prompt('ì┼Åëé╠ÉöÄÜé≡ôⁿù═é╡é─é¡é╛é│éó','000');
//ÅIéφéΦ
if(!start || isNaN(start))
return;
//îà
var digit = start.length;
start = parseInt(start);
}
var flag = false;
irvine.BeginProgressBar(irvine.SelectedItemCount);
try{
var ext;
for(var i = 0; i < irvine.ItemCount; i++){
if (irvine.ItemSelected[i]){
item.data = irvine.Items[i];
if(head == ''){
item.filename = '';
}
else{
ext = extractExt(item.url);
item.filename = head + formatDigit(start++,digit) + '.' + ext;
}
irvine.Items[i] = item.data;
irvine.ProgressBarStepBy(1);
flag = true;
}
}
}
finally{
irvine.EndProgressBar();
if(flag)
irvine.Invalidate();
}
}
function OnMenuUpdate(irvine,action){
//âüâjâàü[é╠ìXÉVâCâxâôâg
action.enabled = (irvine.SelectedItemCount > 0);
}