home *** CD-ROM | disk | FTP | other *** search
/ Stickerpedia Stickerbook / Stickerbook.iso / pc / DATA / shared.cxt / 00001_Script_1 next >
Text File  |  2003-03-24  |  3KB  |  191 lines

  1. --¨
  2. main
  3.  
  4.  
  5.  
  6.  
  7. --¨
  8. main
  9.  
  10.  
  11. global  oHQ
  12. global  oSpr
  13. global  oMarvin
  14.  
  15. global  oFileIO
  16.  
  17.  
  18.  
  19. global  gDataScreenMode
  20. global  gPlatForm
  21. global  gCDPath
  22. global  gPathDelim
  23.  
  24.  
  25.  
  26. global gPasswordDinos
  27. global gPasswordAnimals
  28. global gPasswordOceans
  29. global gCastLibs
  30. global gWhichCD
  31.  
  32.  
  33. global  gDontReact
  34. global  gImageList
  35. global  gImageMode
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. on initApp
  43.   
  44.   cursor 4
  45.   
  46.   register xtra "PrintOMatic", "PMAT156-312-16871"
  47.   
  48.   if the runmode = "author" then 
  49.     the windowlist    = []
  50.     the actorlist     = []
  51.     the searchPath    = []
  52.     the itemdelimiter = ","
  53.   end if
  54.   
  55.   if the platform starts "Win" then
  56.     gPathDelim = "\"
  57.   else
  58.     gPathDelim = ":"
  59.   end if
  60.   
  61.   oMarvin                = new(script "oMarvin")  
  62.   oFileIO                = new(script "oFileIO")  
  63.   --oHQ                    = new(script "oHQ")  
  64.   oSpr                   = new(script "oSpr")  
  65.   
  66.   (the searchPath).add(the pathname)
  67.   
  68.   gPasswordDinos     = "reptile"
  69.   gPasswordAnimals   = "tiger"
  70.   gPasswordOceans    = "shark"  
  71.   
  72.   gDontReact = 0
  73.   -- doImagemanagement
  74.   
  75.   setImageList
  76.   
  77.   gImageMode = #inCast -- other option is #looseOnCD
  78.   
  79.   gWhichCD = getPreferences()
  80.   --put "gWhichCD" && gWhichCD
  81.   cursor -1
  82.   
  83. end
  84.  
  85.  
  86.  
  87. on setPreferences
  88.    
  89. --  prefString = baencryptText(gWhichCD, "goilheimer")
  90. --  
  91. --  if gPathDelim = "\" then
  92. --    baWriteRegString( "stickerbook", "stickerbook", prefString , "HKEY_CLASSES_ROOT" )
  93. --  else
  94. --    sysFolder = basysfolder("prefs")
  95. --    writeFile oFileIO, sysFolder, "stickerbook", prefString   
  96. --  end if
  97.   
  98. end
  99.  
  100.  
  101.  
  102. on getPreferences
  103.   
  104.   if gPathDelim = "\" then
  105.     prefString = baReadRegString( "stickerbook", "stickerbook", "error","HKEY_CLASSES_ROOT" )
  106.   else
  107.     sysFolder = basysfolder("prefs")
  108.     prefString = getFile (oFileIO, sysFolder, "stickerbook")
  109.   end if
  110.   
  111.   if stringP(prefString) then retVal = badecryptText(prefString, "goilheimer")  
  112.   
  113.   if not (   (retVal = "oceans") or (retVal = "dinos")  or (retVal = "animals")    )  then   
  114.     retVal = "error"  
  115.   end if
  116.   
  117.   return retVal
  118.   
  119. end
  120.  
  121.  
  122.  
  123.  
  124. on doImagemanagement
  125.   
  126.   gImageList = []
  127.   
  128.   if gPathDelim = "\" then
  129.     -- create lists for the separate directories:    
  130.     oceanlist    = baFileList( the pathname & "images" & gPathDelim & "animals", "*.jpg" )
  131.     animalList   = baFileList( the pathname & "images" & gPathDelim & "oceans", "*.jpg" )
  132.     dinoList     = baFileList( the pathname & "images" & gPathDelim & "dinos", "*.jpg" )
  133.     
  134.   end if
  135.   
  136.   -- put the first list into the global container  
  137.   gImageList = duplicate(oceanlist)
  138.   
  139.   -- add the other two lists to it:
  140.   repeat with n in animalList
  141.     append gImageList, n
  142.   end repeat
  143.   
  144.   repeat with n in dinoList
  145.     append gImageList, n
  146.   end repeat
  147.   
  148.   sort gImageList
  149.   
  150.   
  151.   -- create imagelist without jpg extensions
  152.   
  153.   newImageList = []
  154.   repeat with n in gImageList
  155.     repeat with i = 1 to 4
  156.       delete n.char[(n.length)]
  157.     end repeat
  158.     newImageList.add(n)  
  159.   end repeat
  160.   
  161.   
  162.   put newImageList
  163.   put newImageList.count
  164.   
  165.   -- check they are all jpegs:
  166.   
  167.   --    repeat with n in gImageList
  168.   --      if n contains "jpg" then
  169.   --        next repeat  
  170.   --      else
  171.   --        alert "Whoops" && n
  172.   --        exit
  173.   --      end if
  174.   --    end repeat
  175.   
  176. end
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.