Hitachi

JP1 Version 12 JP1/IT Desktop Management 2 Distribution Function Administration Guide


17.6.6 Example of a completed AIT file

The following gives an example of a completed AIT file for remotely installing Acrobat Reader 6.0:

PACKAGE_INFO
{
  PackageID        = "ADOBEREADER";
  Product          = "Adobe Reader 6.0";
  Version          = "0600";
  InstallerName    = "AdbeRdr60_enu_full.exe";
  InstallDrive     = "C:";
  InstallDirectory = "'\Program Files'\Adobe'\Acrobat 6.0";
}
DEFINE
{
  integer iLoopCount = 0;
  integer iLoopMax = 60;
  integer DM_RTN;
  integer WINH;
  integer iCapsLockState;
  integer iNumLockState;
  integer iScrollLockState;
  bool bRtn;
  const integer OK_END = 0;
  const integer NG_END = -1;
  float SLEEP_TIME = 1.0;
  float SLEEP_TIME_RESTART = 10.0;
  float SLEEP_TIME_EVENTS = 0.5;
  integer DirectorySetFlag=0;
  integer InsufficientMemory=0;
  integer InvalidPath=0;
}
MAIN
{
  AIT_SetDefaultWaitTimeout(1.0);
  AIT_DMPSTRC();
  DM_RTN = NG_END;
  iCapsLockState = AIT_GetKeyState(CAPSLOCK);
  iNumLockState = AIT_GetKeyState(NUMLOCK);
  iScrollLockState = AIT_GetKeyState(SCROLLLOCK);
  bRtn= AIT_Exec(InstallerName,SW_SHOWNORMAL);
  if(bRtn == false)
      iLoopCount = iLoopMax;
  Endif;
  while(iLoopCount < iLoopMax)
      if(AIT_FocusWindow("Netopsystems FEAD Optimizer", "#32770") != 0)
          AIT_Sleep(SLEEP_TIME);
          iLoopCount=0;
      Endif;
      if(AIT_FocusWindow("InstallShield Wizard", "#32770") != 0)
          AIT_Sleep(SLEEP_TIME);
          iLoopCount=0;
      Endif;
      if(AIT_FocusWindow("Windows Installer", "#32770") != 0)
          AIT_Sleep(SLEEP_TIME);
          iLoopCount=0;
      Endif;
      if(AIT_FocusWindow("Adobe Reader 6.0 - Setup", "MsiDialogCloseClass") != 0)
          if((AIT_VerifyExistence("&Next >",BUTTON_CTRL)==1)
          && (AIT_VerifyEnabled("&Next >",BUTTON_CTRL)==1))
              if (InvalidPath == 1 || InsufficientMemory == 1)
                  AIT_CtrlSetFocus("&Next >",BUTTON_CTRL);
                  AIT_Sleep(SLEEP_TIME_EVENTS);
                  AIT_PlayKey("{ESC}");
                  AIT_Sleep(SLEEP_TIME_EVENTS);
              else
                  if (DirectorySetFlag == 0)
                      if((AIT_VerifyExistence("Change &Destination Folder...",BUTTON_CTRL)==1)
                      && (AIT_VerifyEnabled("Change &Destination Folder...",BUTTON_CTRL)==1))
                          AIT_CtrlSetFocus("Change &Destination Folder...",BUTTON_CTRL);
                          AIT_Sleep(SLEEP_TIME_EVENTS);
                          AIT_PlayKey("%(d)");
                          AIT_Sleep(SLEEP_TIME_EVENTS);
                      else
                          if((AIT_VerifyExistence("Re&pair",OPTIONBUTTON_CTRL)==1)
                          && (AIT_VerifyEnabled("Re&pair",OPTIONBUTTON_CTRL)==1))
                              AIT_CtrlSetFocus("Re&pair",OPTIONBUTTON_CTRL);
                              AIT_Sleep(SLEEP_TIME_EVENTS);
                              AIT_PlayKey("{ENTER}");
                              AIT_Sleep(SLEEP_TIME_EVENTS);
                          else
                              AIT_CtrlSetFocus("&Next >",BUTTON_CTRL);
                              AIT_Sleep(SLEEP_TIME_EVENTS);
                              AIT_PlayKey("%(n)");
                              AIT_Sleep(SLEEP_TIME_EVENTS);
                          Endif;
                      Endif;
                  else
                      AIT_CtrlSetFocus("&Next >",BUTTON_CTRL);
                      AIT_Sleep(SLEEP_TIME_EVENTS);
                      AIT_PlayKey("%(n)");
                      AIT_Sleep(SLEEP_TIME_EVENTS);
                  Endif;
              Endif;
          Endif;
          if((AIT_VerifyExistence("&Install",BUTTON_CTRL)==1)
          && (AIT_VerifyEnabled("&Install",BUTTON_CTRL)==1))
              AIT_CtrlSetFocus("&Install",BUTTON_CTRL);
              AIT_Sleep(SLEEP_TIME_EVENTS);
              AIT_PlayKey("%(i)");
              AIT_Sleep(SLEEP_TIME_EVENTS);
          Endif;
          if((AIT_VerifyExistence("&Finish",BUTTON_CTRL)==1)
          && (AIT_VerifyEnabled("&Finish",BUTTON_CTRL)==1))
              AIT_CtrlSetFocus("&Finish",BUTTON_CTRL);
              AIT_Sleep(SLEEP_TIME_EVENTS);
              AIT_PlayKey("%(f)");
              AIT_Sleep(SLEEP_TIME_EVENTS);
              iLoopCount = iLoopMax;
              if (InvalidPath == 0 && InsufficientMemory == 0)
                  DM_RTN = OK_END;
              Endif;
              continue;
          Endif;
          if((AIT_VerifyExistence("&No",BUTTON_CTRL)==1)
          && (AIT_VerifyEnabled("&No",BUTTON_CTRL)==1)
          && (AIT_VerifyExistence("&Yes",BUTTON_CTRL)==1)
          && (AIT_VerifyEnabled("&Yes",BUTTON_CTRL)==1)
          && (AIT_VerifyExistence("Are you sure you want to cancel Adobe Reader 6.0 installation?",STATIC_CTRL)==1)
          && (AIT_VerifyEnabled("Are you sure you want to cancel Adobe Reader 6.0 installation?",STATIC_CTRL) == 1))
              if (InvalidPath == 1 || InsufficientMemory == 1)
                  AIT_CtrlSetFocus("&Yes",BUTTON_CTRL);
                  AIT_Sleep(SLEEP_TIME_EVENTS);
                  AIT_PlayKey("y");
                  AIT_Sleep(SLEEP_TIME_EVENTS);
              else
                  AIT_CtrlSetFocus("&No",BUTTON_CTRL);
                  AIT_Sleep(SLEEP_TIME_EVENTS);
                  AIT_PlayKey("n");
                  AIT_Sleep(SLEEP_TIME_EVENTS);
              Endif;
          Endif;
          if((AIT_VerifyExistence("OK",BUTTON_CTRL)==1)
          && (AIT_VerifyEnabled("OK",BUTTON_CTRL)==1)
          && (AIT_VerifyExistence("Out of Disk Space",STATIC_CTRL)==1)
          && (AIT_VerifyEnabled("Out of Disk Space",STATIC_CTRL)==1))
              AIT_CtrlSetFocus("OK",BUTTON_CTRL);
              AIT_Sleep(SLEEP_TIME_EVENTS);
              AIT_PlayKey("{ENTER}");
              AIT_Sleep(SLEEP_TIME_EVENTS);
              InsufficientMemory = 1;
          Endif;
          if((AIT_VerifyPos("&Change...",BUTTON_CTRL,1)==1)
          && (AIT_VerifyEnabled("&Change...",BUTTON_CTRL, 1) == 1)
          && (AIT_VerifyPos("&Help",BUTTON_CTRL,2)==1)
          && (AIT_VerifyEnabled("&Help",BUTTON_CTRL, 2) == 1)
          && (AIT_VerifyPos("&Space",BUTTON_CTRL,3)==1)
          && (AIT_VerifyEnabled("&Space",BUTTON_CTRL, 3) == 1)
          && (AIT_VerifyPos("< &Back",BUTTON_CTRL,4)==1)
          && (AIT_VerifyEnabled("< &Back",BUTTON_CTRL, 4) == 1)
          && (AIT_VerifyPos("&Next >",BUTTON_CTRL,5)==1)
          && (AIT_VerifyEnabled("&Next >",BUTTON_CTRL, 5) == 1)
          && (AIT_VerifyPos("Cancel",BUTTON_CTRL,6)==1)
          && (AIT_VerifyEnabled("Cancel",BUTTON_CTRL, 6) == 1)
          && (AIT_VerifyPos("Custom Setup",STATIC_CTRL,9)==1)
          && (AIT_VerifyEnabled("Custom Setup",STATIC_CTRL, 9) == 1)
          && (AIT_VerifyPos("Feature Description",BUTTON_CTRL,18)==1)
          && (AIT_VerifyEnabled("Feature Description",BUTTON_CTRL, 18) == 0))
              AIT_CtrlSetFocus(0);
              AIT_Sleep(SLEEP_TIME_EVENTS);
              AIT_IMESetOpenStatus(0, false);
              AIT_Sleep(SLEEP_TIME_EVENTS);
              AIT_PlayKey("{ESC}");
              AIT_Sleep(SLEEP_TIME_EVENTS);
          Endif;
          iLoopCount=0;
      Endif;
      if(AIT_FocusWindow("Adobe Reader 6.0 - Setup", "MsiDialogNoCloseClass") != 0)
          if((AIT_VerifyExistence("&Next >",BUTTON_CTRL)==1)
          && (AIT_VerifyEnabled("&Next >",BUTTON_CTRL)==1))
              AIT_CtrlSetFocus("&Next >",BUTTON_CTRL);
              AIT_Sleep(SLEEP_TIME_EVENTS);
              AIT_PlayKey("%(n)");
              AIT_Sleep(SLEEP_TIME_EVENTS);
          Endif;
          iLoopCount=0;
      Endif;
      if(AIT_FocusWindow("Adobe Reader 6.0 Setup", "MsiDialogCloseClass") != 0)
          if((AIT_VerifyPos("&OK",BUTTON_CTRL,1)==1)
          && (AIT_VerifyEnabled("&OK",BUTTON_CTRL, 1) == 1)
          && (AIT_VerifyPos("&Cancel",BUTTON_CTRL,2)==1)
          && (AIT_VerifyEnabled("&Cancel",BUTTON_CTRL, 2) == 1)
          && (AIT_VerifyPos("&Look in:",STATIC_CTRL,3)==1)
          && (AIT_VerifyEnabled("&Look in:",STATIC_CTRL, 3) == 1)
          && (AIT_VerifyPos("&Look in:",COMBO_CTRL,4)==1)
          && (AIT_VerifyEnabled("&Look in:",COMBO_CTRL, 4) == 1)
          && (AIT_VerifyPos("Up One Level",BUTTON_CTRL,5)==1)
          && (AIT_VerifyEnabled("Up One Level",BUTTON_CTRL, 5) == 1)
          && (AIT_VerifyPos("Create New Folder",BUTTON_CTRL,6)==1)
          && (AIT_VerifyEnabled("Create New Folder",BUTTON_CTRL, 6) == 1)
          && (AIT_VerifyPos("&Folder name:",STATIC_CTRL,8)==1)
          && (AIT_VerifyEnabled("&Folder name:",STATIC_CTRL, 8) == 1)
          && (AIT_VerifyPos("Browse to the destination folder.",STATIC_CTRL,9)==1)
          && (AIT_VerifyEnabled("Browse to the destination folder.",STATIC_CTRL, 9) == 1)
          && (AIT_VerifyPos("Change Current Destination Folder",STATIC_CTRL,10)==1)
          && (AIT_VerifyEnabled("Change Current Destination Folder",STATIC_CTRL, 10) == 1)
          && (AIT_VerifyPos("InstallShield",STATIC_CTRL,12)==1)
          && (AIT_VerifyEnabled("InstallShield",STATIC_CTRL, 12) == 1)
          && (AIT_VerifyPos("InstallShield",STATIC_CTRL,13)==1)
          && (AIT_VerifyEnabled("InstallShield",STATIC_CTRL, 13) == 0))
              if (InvalidPath == 0)
                  AIT_CtrlSetFocus(0);
                  AIT_Sleep(SLEEP_TIME_EVENTS);
                  AIT_IMESetOpenStatus(0, false);
                  AIT_PlayKey(InstallPoint);
                  AIT_PlayKey("{ENTER}");
                  AIT_Sleep(SLEEP_TIME_EVENTS);
                  DirectorySetFlag = 1;
              else
                  AIT_CtrlSetFocus("&Cancel", BUTTON_CTRL);
                  AIT_Sleep(SLEEP_TIME_EVENTS);
                  AIT_PlayKey("{ENTER}");
                  AIT_Sleep(SLEEP_TIME_EVENTS);
              Endif;
          Endif;
          iLoopCount=0;
      Endif;
      if(AIT_FocusWindow("Adobe Reader 6.0 Installer Information", "MsiDialogCloseClass") != 0)
          if(AIT_VerifyPos("~Error 1314.The specified path",STATIC_CTRL,1)==1)
              InvalidPath = 1;
              if((AIT_VerifyExistence("&OK",BUTTON_CTRL)==1)
              && (AIT_VerifyEnabled("&OK",BUTTON_CTRL)==1))
                  AIT_CtrlSetFocus("&OK",BUTTON_CTRL);
                  AIT_Sleep(SLEEP_TIME_EVENTS);
                  AIT_PlayKey("{ENTER}");
                  AIT_Sleep(SLEEP_TIME_EVENTS);
              Endif;
          Endif;
          if(AIT_VerifyExistence("~You must restart",STATIC_CTRL)==1)
              if((AIT_VerifyExistence("&No",BUTTON_CTRL)==1)
              && (AIT_VerifyEnabled("&No",BUTTON_CTRL)==1))
                  AIT_CtrlSetFocus("&No",BUTTON_CTRL);
                  AIT_Sleep(SLEEP_TIME_EVENTS);
                  AIT_PlayKey("n");
                  AIT_Sleep(SLEEP_TIME_EVENTS);
              Endif;
          Endif;
          iLoopCount=0;
      Endif;
      iLoopCount = iLoopCount + 1;
      AIT_Sleep(SLEEP_TIME);
  loop;
  WINH = AIT_RegisterWindowMessage("ITM_REC_QUIT");
  if(WINH != 0)
      AIT_PostMessage(HWND_BROADCAST,WINH,DM_RTN,0);
  Endif;
}
ERROR
{
  DM_RTN = NG_END;
  WINH = AIT_RegisterWindowMessage("ITM_REC_QUIT");
  if(WINH != 0)
      AIT_PostMessage(HWND_BROADCAST,WINH,DM_RTN,0);
  Endif;
}