home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1997 September / Personal_Computer_World_Sep_97.iso / DXRS / HANPCW09.Dxr / 00005_HANLaunchACRO.ls < prev    next >
Encoding:
Text File  |  1997-06-25  |  2.5 KB  |  79 lines

  1. on HANLaunchACRO
  2.   global HANAcroAlOption, HANACRORunning, DriveLtr
  3.   set theApp to getExtensionApp("PDF")
  4.   if word 1 of theApp = "Error:" then
  5.     set HANAcroAlOption to 1
  6.     put "do not have acrobat on your machine"
  7.     HANACROAlertUser()
  8.   else
  9.     put theApp into field "HANLocation"
  10.     set FirstSlash to 0
  11.     repeat with t = 1 to the number of chars in field "HANLocation"
  12.       if char t of field "HANLocation" = "\" then
  13.         if FirstSlash = 0 then
  14.           set FirstSlash to t
  15.           next repeat
  16.         end if
  17.         set LastSlash to t
  18.       end if
  19.     end repeat
  20.     set folderLoc to char FirstSlash + 1 to LastSlash - 1 of field "HANLocation"
  21.     set letterN to char FirstSlash - 2 of field "HANLocation"
  22.     set NumOf to the number of chars in field "HANLocation"
  23.     set Exename to char LastSlash + 1 to NumOf of field "HANLocation"
  24.     repeat with t = 1 to 200
  25.       set fname to getNthFileNameInFolder(letterN & ":\" & folderLoc, t)
  26.       if fname = EMPTY then
  27.         put "not found"
  28.         set fname to 0
  29.         exit repeat
  30.       end if
  31.       if fname = Exename then
  32.         put "executable found"
  33.         set fname to 1
  34.         exit repeat
  35.       end if
  36.     end repeat
  37.     case fname of
  38.       0:
  39.         set HANAcroAlOption to 2
  40.         put "acrobat not where it should be"
  41.         HANACROAlertUser()
  42.       1:
  43.         repeat with t = 1 to the number of chars in Exename
  44.           if char t of Exename = "." then
  45.             set HowMany to t
  46.             exit repeat
  47.           end if
  48.         end repeat
  49.         set shortexename to char 1 to HowMany - 1 of Exename
  50.         put "shortexename", shortexename
  51.         set tasklistStore to gMasterAppObject(mGetTaskList)
  52.         repeat with t = 1 to the number of lines in tasklistStore
  53.           set taskLinet to line t of tasklistStore
  54.           put "taskLinet", taskLinet
  55.           repeat with d = 1 to the number of chars in taskLinet
  56.             if char d of taskLinet = "," then
  57.               set HowMany to d
  58.               exit repeat
  59.             end if
  60.           end repeat
  61.           set tasknamet to char 1 to HowMany - 1 of taskLinet
  62.           if tasknamet = shortexename then
  63.             set HANACRORunning to 1
  64.             exit repeat
  65.           end if
  66.         end repeat
  67.         case HANACRORunning of
  68.           1:
  69.             set HANACRORunning to 0
  70.             put " acrobatrrunning"
  71.             HANLaunchAlert()
  72.           0:
  73.             put "acrobatnotrunning"
  74.             HANLaunchAlert()
  75.         end case
  76.     end case
  77.   end if
  78. end
  79.