home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2002 July / VPR0207A.ISO / OLS / IRVINE0_4_1A / irvine0_4_1a.lzh / scripts / listreplaceurl.dms < prev    next >
Text File  |  2002-03-10  |  1KB  |  47 lines

  1. /*スクリプト初期化イベント
  2. guid={92f02e38-a11a-466e-b8c6-af8d86eeea74}
  3. caption=URLの置換
  4. version=2
  5. hint=選択アイテムのURLを置換します
  6. event=OnListMenuClick
  7. match=
  8. author=名無しさん@お腹いっぱい
  9. */
  10.  
  11. function OnListMenuClick(irvine,action){
  12.   item = new IrvineItem;
  13.   reg = new RegExp;
  14.   reg.source = prompt('置換前(正規表現で指定できます)', '');
  15.   if(!reg.source) 
  16.     return;
  17.   
  18.   after = prompt('置換後', '');  
  19.   if(after == null) 
  20.     return;   
  21.     
  22.   irvine.BeginProgressBar(irvine.SelectedItemCount);
  23.   try{
  24.     for(i = 0; i < irvine.ItemCount; i++){
  25.       if (irvine.GetItemSelected(i)){
  26.         item.data = irvine.GetItemData(i);
  27.  
  28.         item.url = reg.replace(item.url, after); 
  29.  
  30.         irvine.SetItemData(i, item.data);
  31.         irvine.ProgressBarStepBy(1);
  32.       } 
  33.     }  
  34.   }  
  35.   
  36.   finally{    
  37.     irvine.EndProgressBar(); 
  38.     irvine.Invalidate();
  39.   }
  40. }
  41.  
  42. function OnMenuUpdate(irvine,action){
  43.   action.enabled = (irvine.SelectedItemCount > 0);
  44. }
  45.  
  46.  
  47.