/* ws_rcvry.cmd ... WSIEVER.INI ファイルの修復 */ call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs' call SysLoadFuncs say say 'これは、WSIEVERを使用していて、ある日いきなり全てのアイテムが' say '消滅してしまった場合に、INIファイルを修復するREXXスクリプトです。' say '1B'x || '[41m' say '注意:現在のディレクトリにある全てのINIファイルを修復対象にします。' say '   他のアプリケーションのINIファイルが同じディレクトリに存在しない事を' say '   確認して下さい。' || '1B'x || '[m' say call SysFileTree '*.INI' ,'Files' ,'FO' if Files.0=0 then do say 'ERROR:現在のディレクトリにINIファイルがありません。' exit 1 end drops = 0 do li = 1 to Files.0 cnt = SysIni( Files.li ,'JOB' ,'CNT' ) if cnt\='00000000'x then do drop Files.li drops = drops + 1 end else do chk = SysIni( Files.li ,'JOB_000' ,'TYPE' ) if chk='ERROR:' then do drop Files.li drops = drops + 1 end end end if drops = Files.0 then do say '修復が必要なINIファイルはありませんでした。' exit 0 end say '要修復INIファイル:' do li = 1 to Files.0 if symbol( 'Files.' || li )='VAR' then do say '09'x || Files.li end end say say '以上' Files.0 - drops '個のINIファイルを修復します。' say 'Enterキーを押すと修復を開始します(Ctrl+Cで中断)・・・' call linein 'stdin:' say do li = 1 to Files.0 if symbol( 'Files.' || li )\='VAR' then iterate say Files.li do lj = 0 to 999 chk = SysIni( Files.li ,'JOB_' || right('00'||lj,3) ,'TYPE' ) if chk='ERROR:' then leave end lj = right('0000000'||d2x(lj),8) newcnt = '' do while length(lj)>0 newcnt = newcnt || right(lj,2) lj = delstr(lj,length(lj)-1) end if SysIni( Files.li ,'JOB' ,'CNT' ,X2C(newcnt) )='ERROR:' then do say 'ERROR:' || Files.li || 'の更新に失敗しました。' end end say say '終了しました。' exit 0