home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 July / VPR9707A.ISO / OLS / Win32 / Wbat128p / WBAT128P.LZH / SAMPLE / CHGWALLP.BTW < prev    next >
Text File  |  1995-11-15  |  2KB  |  65 lines

  1. @echo off
  2. :/    --------------------------------------------------------------
  3. :/    WinBatchEhサンプルバッチ - CHGWALLP.BTW
  4. :/    次回起動時の壁紙を変更
  5. :/
  6. :/    Author : Yohei Shimizu
  7. :/    Version: 1.02
  8. :/    Date   : 1995/11/15
  9. :/
  10. :/    History: 1.0    1995/05/24
  11. :/            Initial Version
  12. :/         1.01    1995/06/25
  13. :/            小さな変更
  14. :/         1.02    1995/11/15
  15. :/            空白を含むファイル名でも動作するようにした
  16. :/    --------------------------------------------------------------
  17.  
  18. :/ 注意が不要なら下の行は削除してください
  19. echo 次回起動時の壁紙の変更を行います.
  20. echo よろしければ何かキーを押してください.
  21. echo 中止するなら [ESC] キーを押してください.
  22. pause>nul
  23.  
  24. :/ Windowsのドライブ, ディレクトリに移動
  25. :/ ここを適当なディレクトリに変えれば \WINDOWS 以外でも動く
  26. strtokfile=STF_DRV DRV %windir%
  27. %DRV%
  28. cd %WINDIR%
  29.  
  30. :/ .BMPファイルのリストのファイルが無ければ作成 
  31. if not exist bmplist.ini
  32.   set COUNT=0
  33.   for %%a in (*.bmp) do
  34.     sprintf COUNT %%d %COUNT%+1
  35.     writeinistring Wallpaper Entry%COUNT% "%%a" bmplist.ini
  36.   endfor
  37.   writeinistring Wallpaper TotalCount %COUNT% bmplist.ini
  38. endif
  39.  
  40. :/ .BMPファイルのリストからrandomで適当な壁紙を選ぶ
  41. getinistring Wallpaper TotalCount TOTALCOUNT bmplist.ini
  42. if ERRORLEVEL 1 goto NOFILES
  43. if %TOTALCOUNT%.==0. goto NOFILES
  44. set errorlevel=random %TOTALCOUNT%
  45. sprintf CHGNUMBER %%d %ERRORLEVEL%+1
  46. getinistring Wallpaper Entry%CHGNUMBER% WALLNAME bmplist.ini
  47.  
  48. echo 壁紙を %WALLNAME% に設定しています...
  49.  
  50. :/ 壁紙名を変更
  51. writeinistring Desktop Wallpaper "%WALLNAME%" win.ini
  52.   :/ WinBatchEh 1.03 以上ではwin.iniへの設定の代わりに次のようにして
  53.   :/ その場で変えることもできる
  54.   :/ systemparametersinfo SPI_SETDESKWALLPAPER "%WALLNAME%" SPIF_UPDATEINIFILE
  55. :/ Patternは "(なし)" にしておく
  56. writeinistring Desktop Pattern (なし) win.ini
  57. :/ 並べて表示にする
  58. writeinistring Desktop TileWallpaper 1 win.ini
  59.  
  60.  
  61. exit
  62.  
  63. :NOFILES
  64. messagebox BMPファイルが見つかりません. 処理を中止します.
  65.