付録D.3 レコーダファイルの完成例

Acrobat Reader 5.05をリモートインストールする場合のレコーダファイルの例を示します。

'*****************************************************************
'レコーダファイル All Rights Reserved, Copyright (C) 2002,Hitachi,Ltd.
'*****************************************************************
'$INCLUDE 'WINAPI.INC'
'$INCLUDE 'DMPTEST.INC'
Dim WINH      As Long, _
 DM_RTN      As Short, _
 Rtn         As Short, _
 f_DM        As Short, _
 loop_cnt    As Short, _
 loop_max    As Short, _
 whnd      As Long
 const OK_END  =  0 'DM_RTN:正常終了
 SetDefaultWaitTimeout(1)
 ON ERROR GOTO ERROPROC
 '***************************************************************
 ' 初期化処理
 '***************************************************************
 DM_RTN   = 10
 f_DM     = 0
 loop_cnt = 0
 loop_max = 30
   DMPSTPRC()
 '***************************************************************
 ' インストーラ起動処理
 '***************************************************************
 if 0 = Exists( InstallerName ) then
   loop_max = 0
 end if
 Rtn = Run( InstallerName, SW_NORMAL) ' インストールプログラムの起動
 if Rtn <> 0 then
   loop_max = 0
 endif
 '***************************************************************
 'メイン処理ループ
 '***************************************************************
 do while (loop_cnt < loop_max)
   if WFndWndC ("Acrobat Reader 5.0.5 のセットアップ", "#32770", FW_EXIST or FW_FOCUS, 1) > 0 then
     Play "%(n)"
     loop_cnt = 0
     Sleep(1)
   endif
   if WFndWndC ("セットアップ", "#32770", FW_EXIST or FW_FOCUS, 1) > 0 then
     Play "%(Y)"
     Sleep(1)
   elseif WFndWndC ("ディレクトリの選択", "#32770", FW_EXIST or FW_FOCUS, 1) > 0 then
     Play "%(P)"
     Play "C:¥Program Files¥Adobe¥Acrobat5"
     WButtonSetFocus("OK")
     Play " "
     Sleep(1)
   elseif WFndWndC ("インストール先の選択", "#32770", FW_EXIST or FW_FOCUS, 1) > 0 then
     if f_DM = 9 then
       Play "%(n)"
     elseif f_DM = 0 then
       Play "%(R)"
       f_DM = 9
     endif
     loop_cnt = 0
     Sleep(1)
   endif
     if WFndWndC ("セットアップの完了", "#32770", FW_EXIST or FW_FOCUS, 1) > 0 then
     Play "{DOWN}"
     Play "{ENTER}"
     loop_cnt = loop_max
     DM_RTN   = OK_END  'インストール正常終了
     Sleep(1)
   endif
     if WFndWndC ("エラー", "#32770", FW_EXIST or FW_FOCUS, 1) > 0 then
     Play "%(A)"
     loop_cnt = loop_max
     DM_RTN   = 30      'HD容量不足
     Sleep(2)
   endif
   loop_cnt = loop_cnt + 1
   Sleep(1)
 loop
 '***************************************************************
 '終了処理
 '***************************************************************
 WINH = RegisterWindowMessage("DMP_REC_QUIT")
 if WINH <> 0 then
   PostMessage(HWND_BROADCAST, WINH, DM_RTN, 0)
 endif
End

ERROPROC:
 WINH = RegisterWindowMessage("DMP_REC_QUIT")
 if WINH <> 0 then
   PostMessage (HWND_BROADCAST,WINH,-1,0)
 endif
End