home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / sharewar / winbatch / winbatch.exe / wsinit.dl_ < prev    next >
Encoding:
Text File  |  2000-04-13  |  13.5 KB  |  336 lines

  1. ;-------------------------------------------------------------------------
  2. ; wsinit.dll  - WinBatch version
  3. ;
  4. ; WinBatch Studio checks for the existence of this file at startup, looking
  5. ; in the WinBatch Studio directory. It allows you a chance to customize 
  6. ; every part of WinBatch Studio at startup without user intervention.
  7. ; If WinBatch Studio executes the script it saves the file date stamp.  Subsequently
  8. ; at startup, WinBatch Studio will compare the file date with the saved time and
  9. ; will only re-run the script if it's newer than the saved timestamp.
  10. ;
  11. ;
  12. if "%param1%"=="CLEARTOOLBAR"
  13.    GOTO CLEARTOOLBAR
  14. endif
  15.  
  16. regword="WinBatch Studio"
  17. ;gosub NukeSomeSettings
  18. gosub SetupPage
  19. gosub SetupFind
  20. gosub SetupGlobal
  21. ; Set up some file types.  Maybe should be first, as later items override earlier items...
  22. gosub SetupHTML     ; This one here primarily as an example.
  23. ;
  24. gosub ClearToolbarSetup
  25.  
  26. exit
  27.  
  28.  
  29. :SetupHTML
  30.         ;-------------------------------------------------------------------------
  31.         ; File specific settings
  32.         ;
  33.         ; This example sets up WinBatch Studio for HTML files. 
  34.         ;-------------------------------------------------------------------------
  35.  
  36.         ; First, verify these settings were not already installed so we don't
  37.         ; overwrite changes made by the user on a mere update.  If thiere is
  38.         ; a real update, then yes we do overwrite user customizations.
  39.         FileKind="HTML"         ; Name of manil file group for this type of files
  40.         ConfigVerWBT=7     ; Configuration version number,.  Update when changing this section
  41.  
  42.         if RegExistValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\File types\%FileKind% Files[ConfigVer]")
  43.              ConfigVerReg=RegQueryValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\File types\%FileKind% Files[ConfigVer]")
  44.              if ConfigVerReg >= ConfigVerWBT then return  ; if reg is newer, do not excecute
  45.         endif
  46.         RegSetValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\File types\%FileKind% Files[ConfigVer]",ConfigVerWBT)
  47.  
  48.  
  49.  
  50.         ; The File mapping key sets up the file extensions with a particular 
  51.         ; file group.  e.g.   HTML, HTM and ASP type files all belong to the
  52.         ; HTML file group 
  53.         
  54.         regkey = RegCreateKey(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\File mapping")
  55.         
  56.         RegSetValue(regkey, "[HTML]", FileKind)
  57.         RegSetValue(regkey, "[HTM]",  FileKind)
  58.         RegSetValue(regkey, "[ASP]",  FileKind)
  59.         RegSetValue(regkey, "[XML]",  FileKind)
  60.         RegCloseKey(regkey)
  61.         
  62.         
  63.         ;-------------------------------------------------------------------------
  64.         ; the File types key sets up the file extension - specific settings
  65.         
  66.         regkey = RegCreateKey(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\File types\%FileKind% Files")
  67.         
  68.         ; add this file type to the FileOpen dialog
  69.         RegSetDWord(regkey, "[AddToFileDialog]", 1)
  70.         
  71.         ; description and wild cards to use in FileOpen dialog
  72.         RegSetValue(regkey, "[FileOpenMask]", "%FileKind% Files|*.htm;*.html;*.asp;*.xml")
  73.         
  74.         ; case sensitivity
  75.         RegSetDWord(regkey, "[Case]", 0)
  76.         
  77.         ; show chroma coding
  78.         RegSetDWord(regkey, "[Chroma]", 1)
  79.         
  80.         ; comment definition - two available
  81.         RegSetValue(regkey, "[Comment Start 1]", "<!--")
  82.         RegSetValue(regkey, "[Comment End 1]", "-->")
  83.         
  84.         RegSetValue(regkey, "[Comment Start 2]", "")
  85.         RegSetValue(regkey, "[Comment End 2]", "")
  86.         
  87.         ; font information for this file type                                                      
  88.         RegSetValue(regkey, "[Font name]", "Courier New")
  89.         RegSetDWord(regkey, "[Font size]", 10)
  90.         
  91.         ; 400 = normal, 700 = bold
  92.         RegSetDWord(regkey, "[Font weight]", 400)
  93.         RegSetDWord(regkey, "[Font italic]", 0)
  94.         
  95.         ; 1 = insert mode; 0 = overtype
  96.         RegSetDWord(regkey, "[Insert]", 1)
  97.         
  98.         ; pathname of keyword listing file
  99.         RegSetValue(regkey, "[Keywords]", "%FileKind%.clr")
  100.         
  101.         ; 0 = CR/LF; 1 = LF; 2 = LF/CR; 3 = CR
  102.         RegSetDWord(regkey, "[Line end type]", 0)
  103.         
  104.         ; leave files locked when open
  105.         RegSetDWord(regkey, "[Lock files]", 0)
  106.         
  107.         ; 1 = use tabs; 0 = insert spaces
  108.         RegSetDWord(regkey, "[Keep tabs]", 1)
  109.         
  110.         ; show visible tab marks on screen
  111.         RegSetDWord(regkey, "[Show tabs]", 0)
  112.         
  113.         ; tab size in characters
  114.         RegSetDWord(regkey, "[Tab size]", "3")
  115.         
  116.         ; extra characters to be considered part of a word
  117.         RegSetValue(regkey, "[Extra word chars]", "!")
  118.         
  119.         ; extra characters that might start a word
  120.         RegSetValue(regkey, "[Start chars]", "")
  121.         
  122.         ; extra characters that might end a word
  123.         RegSetValue(regkey, "[Terminator chars]", "")
  124.         
  125.         ; colors.  R,G,B values as a string
  126.         RegSetValue(regkey, "[Background]", "255,255,255")
  127.         RegSetValue(regkey, "[Comment]", "0,128,0")
  128.         RegSetValue(regkey, "[Default Text]", "0,0,0")
  129.         RegSetValue(regkey, "[Keyword]", "0,0,255")
  130.         RegSetValue(regkey, "[Quote]", "255,0,0")
  131.         
  132.         ; character set 0 = ANSI, 1 = OEM
  133.         RegSetDWord(regkey, "[CharSet]", 0)
  134.         
  135.         ; compile command
  136.         RegSetValue(regkey, "[Compile command]", "")
  137.         
  138.         ; call a custom WIL error parsing script after compiling
  139.         RegSetDWord(regkey, "[UseWBT]", 0)
  140.         
  141.         ; if so, the name of the script
  142.         RegSetValue(regkey, "[WBTErrorFile]", "")
  143.         RegCloseKey(regkey)
  144.         return
  145.  
  146.         
  147. :SetupPage
  148.         ;-------------------------------------------------------------------------
  149.         ; the PageSetup key handles all the printing settings
  150.         
  151.         ;First check to try not to needlessly overwrite user settings
  152.  
  153.         ConfigVerWBT=5     ; Configuration version number,.  Update when changing this section
  154.  
  155.         if RegExistValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\PageSetup[ConfigVer]")
  156.              ConfigVerReg=RegQueryValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\PageSetup[ConfigVer]")
  157.              if ConfigVerReg >= ConfigVerWBT then return  ; if reg is newer, do not excecute
  158.         endif
  159.         RegSetValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\PageSetup[ConfigVer]",ConfigVerWBT)
  160.  
  161.         
  162.         regkey = RegCreateKey(@REGCURRENT, "Software\Wilson WindowWare\%regword%\PageSetup")
  163.         
  164.         ; 0 = ANSI, 1 = OEM
  165.         RegSetDWord(regkey,"[CharSet]", 0)
  166.         
  167.         ; 1 = print in color, 0 = OFF
  168.         RegSetDWord(regkey, "[Color syntax]", 1)
  169.         
  170.         ; 1 = print italics, 0 = regular
  171.         RegSetDWord(regkey, "[Font Italic]", 0)
  172.         
  173.         ; name of font 
  174.         RegSetValue(regkey, "[Font name]", "Courier New")
  175.         
  176.         ; size of font in points
  177.         RegSetDWord(regkey, "[Font size]", 12)
  178.         
  179.         ; 400 = normal, 700 = bold
  180.         RegSetDWord(regkey, "[Font weight]", 400)
  181.         
  182.         ; footer macro string
  183.         RegSetValue(regkey, "[Footer]", "Page $(PageNo)")
  184.         
  185.         ; print file time in footer, 1 = yes, 0 = no
  186.         RegSetDWord(regkey, "[FooterTime]", 0)
  187.         
  188.         ; header macro string
  189.         RegSetValue(regkey, "[Header]", "$(FilePath) - $(FileTime)")
  190.         
  191.         ; print file time in header, 1 = yes, 0 = no
  192.         RegSetDWord(regkey, "[HeaderTime]", 0)
  193.         
  194.         ; print line numbers, 1 = yes, 0 = no
  195.         RegSetDWord(regkey, "[Line numbers]", 0)
  196.         
  197.         ; print pages two up, 1 = yes, 0 = no
  198.         RegSetDWord(regkey, "[Twoup]", 0)
  199.         
  200.         ; 0 = use screen font, 1 = use printer font defined above
  201.         RegSetDWord(regkey, "[Use printer font]", 0)
  202.         
  203.         RegCloseKey(regkey)
  204.         return
  205.  
  206. :SetupFind
  207.         ;-------------------------------------------------------------------------
  208.         ; the Settings\Find key handles the find\replace settings
  209.  
  210.         ;First check to try not to needlessly overwrite user settings
  211.  
  212.         ConfigVerWBT=5     ; Configuration version number,.  Update when changing this section
  213.  
  214.         if RegExistValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Find[ConfigVer]")
  215.              ConfigVerReg=RegQueryValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Find[ConfigVer]")
  216.              if ConfigVerReg >= ConfigVerWBT then return  ; if reg is newer, do not excecute
  217.         endif
  218.         RegSetValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Find[ConfigVer]",ConfigVerWBT)
  219.  
  220.         regkey = RegCreateKey(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Find")
  221.         
  222.         ; these keys are all true/false, 1 = ON, 0 = OFF
  223.         RegSetDWord(regkey, "[Forward]", 1)
  224.         RegSetDWord(regkey, "[Match case]", 0)
  225.         RegSetDWord(regkey, "[Regular expressions]", 0)
  226.         RegSetDWord(regkey, "[Wrap search]", 0)
  227.         RegCloseKey(regkey)
  228.         return
  229.  
  230. :setupGlobal
  231.         ;-------------------------------------------------------------------------
  232.         ; the Settings\Main Window key handles the global editor settings
  233.  
  234.        ;First check to try not to needlessly overwrite user settings
  235.  
  236.         ConfigVerWBT=6     ; Configuration version number,.  Update when changing this section
  237.  
  238.         if RegExistValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window[ConfigVer]")
  239.              ConfigVerReg=RegQueryValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window[ConfigVer]")
  240.              if ConfigVerReg >= ConfigVerWBT then return  ; if reg is newer, do not excecute
  241.         endif
  242.         RegSetValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window[ConfigVer]",ConfigVerWBT)
  243.  
  244.         regkey = RegCreateKey(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window")
  245.         
  246.         ; backup location macro string
  247.         RegSetValue(regkey, "[Backup location]", "$(FilePath).backup")
  248.         RegSetValue(regkey, "[Autosave location]", "$(FilePath).autosave")
  249.         
  250.         ; the name of the active project
  251.         RegSetValue(regkey, "[Active Workspace]", "Default")
  252.         
  253.         ; the autosave interval, in minutes
  254.         RegSetDWord(regkey, "[Autosave interval]", 5)
  255.         
  256.         ; the rest are all true/false, on/off
  257.         RegSetDWord(regkey, "[AutoSave]", 1)
  258.         RegSetDWord(regkey, "[Horizontal Scrollbar]", 1)
  259.         RegSetDWord(regkey, "[Make Backups]", 1)
  260.         
  261.         ; leave the cursor at the end of pasted text
  262.         RegSetDWord(regkey, "[Paste After]", 1)
  263.         
  264.         ; automatically save files before running tools
  265.         RegSetDWord(regkey, "[Save Before]", 1)
  266.         
  267.         ; don't prompt before automatically saving files
  268.         RegSetDWord(regkey, "[Prompt Before]", 0)
  269.         
  270.         ; reload the open files from the last session
  271.         RegSetDWord(regkey, "[Restore Workspace]", 0)
  272.         
  273.         ; allow only one instance of %regword%
  274.         RegSetDWord(regkey, "[Single Instance]", 1)
  275.         
  276.         ; allow the cursor to move past the ends of lines
  277.         RegSetDWord(regkey, "[VirtualWhitespace]", 1)
  278.         RegCloseKey(regkey)
  279.  
  280.         ; set WIL files to be FileOpen default
  281.         regkey = RegCreateKey(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Options")
  282.         RegSetDWord(regkey, "[FilterIndex]", 1)
  283.         RegCloseKey(regkey)
  284.  
  285.         return
  286. :NukeSomeSettings
  287.         ConfigVerWBT=2     ; Configuration version number,.  Update when changing this section
  288.  
  289.         if RegExistValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window[ResetBetaVer]")
  290.              ConfigVerReg=RegQueryValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window[ResetBetaVer]")
  291.              if ConfigVerReg >= ConfigVerWBT then return  ; if reg is same or newer, do not excecute
  292.         endif
  293.         RegSetValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window[ResetBetaVer]",ConfigVerWBT)
  294.  
  295.         ;nothing to do this week.
  296.         return
  297.  
  298. :CLEARTOOLBARSETUP
  299.        ;First check to try not to needlessly delete users toolbar view
  300.  
  301.         ConfigVerWBT=3     ; Configuration version number,.  Update when changing this section
  302.  
  303.         if RegExistValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window[ToolBarLevel]")
  304.              ConfigVerReg=RegQueryValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window[ConfigVer]")
  305.              if ConfigVerReg == ConfigVerWBT then return  ; if reg is same, do not excecute
  306.         endif
  307.         RegSetValue(@REGCURRENT, "Software\Wilson WindowWare\%regword%\Settings\Main Window[ToolBarLevel]",ConfigVerWBT)
  308.  
  309.       ;Run exe to cleartoolbar
  310.       Run("winbatch.exe",strcat('"',DirHome(),'WSINIT.DLL" CLEARTOOLBAR'))
  311.  
  312.  
  313. return
  314.  
  315. :CLEARTOOLBAR
  316.      IntControl(12,2+8,"WinBatch Setup%@CRLF%Please close WinBatch Studio before trying to exit Windows.",0,0)
  317.      ;Wait for WBStudio to exit
  318.      AppWaitClose("WinBatch Studio.exe")
  319.      if RegExistKey(@REGCURRENT,"Software\Wilson WindowWare\WinBatch Studio\Toolbars")
  320.         RegDeleteKey(@REGCURRENT,"Software\Wilson WindowWare\WinBatch Studio\Toolbars")
  321.      endif
  322.      exit
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.