|
22 | 22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
23 | 23 | # SOFTWARE. |
24 | 24 |
|
25 | | -set n to 330 -- 308 /tmp/bibunsho7-patch.log |
26 | | -set progress total steps to n |
| 25 | +-- 700 lines /tmp/bibunsho7-patch.log => 3.5min |
| 26 | +set progressTimeout to 5 -- minutes |
| 27 | +set progressMaxN to (progressTimeout * 60 * 10) |
| 28 | +set progress total steps to progressMaxN |
27 | 29 | set progress description to "Patch.app: 実行中..." |
28 | 30 | set progress additional description to "待機中..." |
29 | 31 |
|
|
37 | 39 | -- activate the progress bar intentionally |
38 | 40 | activate |
39 | 41 |
|
40 | | - repeat with i from 1 to n |
| 42 | + repeat with i from 1 to progressMaxN |
41 | 43 | delay 0.1 |
42 | | - |
43 | 44 | -- update progress description and completed steps |
44 | 45 | set progrMsg to do shell script "tail -n 1" & space & patchLog & space & "| fold" |
45 | 46 | set progress additional description to progrMsg |
46 | 47 | set i to do shell script "wc -l" & space & patchLog & space & "| sed \"s, *,,\" | cut -f1 -d \" \"" |
47 | 48 |
|
48 | | - set progress completed steps to i |
| 49 | + set progress completed steps to (i * progressTimeout) |
| 50 | + |
| 51 | + if progrMsg = "cjk-gs-integrate [DEBUG]: overwriting with the new one ..." |
| 52 | + set progress description to "Patch.app: 実行中... (この処理にしばらく時間がかかる場合があります)" |
| 53 | + else |
| 54 | + set progress description to "Patch.app: 実行中..." |
| 55 | + end if |
49 | 56 |
|
50 | 57 | -- |
51 | | - if progrMsg = "+ exit" then |
| 58 | + if progrMsg = "+ exit 0" then |
52 | 59 | exit repeat |
53 | 60 | else if progrMsg = "+ exit 1" then |
54 | 61 | error number -128 |
55 | 62 | end if |
56 | 63 | end repeat |
| 64 | + -- some exception handling |
| 65 | + if progrMsg = "+ exit 0" then |
| 66 | + else if progrMsg = "cp: /Volumes/Bibunsho7-patch/ptex-fontmaps/maps/hiragino*: No such file or directory" |
| 67 | + error number -2 |
| 68 | + else |
| 69 | + error number -128 |
| 70 | + end if |
| 71 | + |
57 | 72 | -- quit |
58 | | - set progress completed steps to n |
| 73 | + set progress completed steps to progressMaxN |
59 | 74 | set progress additional description to "完了" |
60 | 75 | activate |
61 | 76 | display alert "完了" |
62 | 77 | return |
63 | 78 |
|
64 | | -on error |
65 | | - set progrMsg to do shell script "tail -n 2" & space & patchLog & space & "| fold" |
| 79 | +on error message number errn |
66 | 80 | set progress additional description to progrMsg |
67 | | - |
68 | 81 | activate |
69 | | - display alert "失敗:ログファイル" & space & patchLog & space & "をご確認ください。" |
| 82 | + |
| 83 | + set plzChkLog to "失敗:ログファイル" & space & patchLog & space & "をご確認ください。" |
| 84 | + |
| 85 | + if errn = -2 then |
| 86 | + display alert plzChkLog & "複数個の Bibunsho7-patch-<バージョン>.dmg を開いています。" |
| 87 | + else |
| 88 | + set progrMsg to do shell script "tail -n 2" & space & patchLog & space & "| fold" |
| 89 | + set progress additional description to progrMsg |
| 90 | + display alert plzChkLog |
| 91 | + end if |
70 | 92 | end try |
0 commit comments