Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for wallpapr.cmd

(view source code of wallpapr.cmd as plain text)

  1. /*
  2.  ษอออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออป
  3.  บ Wallpaper.Cmd                                                             บ
  4.  บ Version 1.10, 22/01/1998                                                  บ
  5.  บ (C) 1997, 1998, Rob van der Woude                                         บ
  6.  บ                                                                           บ
  7.  บ Changes OS/2 background randomly at execution. This file - or a program   บ
  8.  บ object of it - should be placed in OS/2's startup folder.                 บ
  9.  บ                                                                           บ
  10.  บ Most recent update 22/01/1998:                                            บ
  11.  บ Added GIF/JPG support and OS/2 version check for Lockup setting.          บ
  12.  ศอออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออผ
  13. */
  14.  
  15. userini   = value( "USER_INI", , "OS2ENVIRONMENT" )
  16. path      = value( "PATH", , "OS2ENVIRONMENT" )
  17. parse upper value path with "\OS2\SYSTEM" -2 bootdrive +2
  18. bitmapdir = bootdrive||"\OS2\BITMAP\*.BMP"
  19. gifdir    = bootdrive||"\OS2\BITMAP\*.GIF"
  20. jpgdir    = bootdrive||"\OS2\BITMAP\*.JPG"
  21. parse source os type program
  22.  
  23. /* Load RexxUtil */
  24. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  25. call SysLoadFuncs
  26.  
  27. /*
  28.  ษอออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออป
  29.  บ The lines calling SysFileTree were adapted so that only bitmaps marked    บ
  30.  บ read-only will be used; this allows you to make a selection of bitmaps    บ
  31.  บ without the need to move them into or out of your bitmap directories.     บ
  32.  บ You may remove the last parameter "*-*+*" to change this and use all      บ
  33.  บ bitmaps if you like, or replace "FO" with "FOS" to use bitmaps in         บ
  34.  บ subdirectories as well. Furthermore you could change the starting         บ
  35.  บ directories for each individual bitmap type. You could also add more      บ
  36.  บ bitmap directories or more bitmap types, if your version of OS/2 will     บ
  37.  บ support them. You get the idea . . .                                      บ
  38.  ศอออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออผ
  39. */
  40. call SysFileTree bitmapdir, "bitmap.", "FO", "*-*+*"
  41. call SysFileTree gifdir,    "gif.",    "FO", "*-*+*"
  42. call SysFileTree jpgdir,    "jpg.",    "FO", "*-*+*"
  43. pict.  = ""
  44.  
  45. /* List all BMP files */
  46. if bitmap.0 > 0 then do i = 1 to bitmap.0
  47. 	pict.i = bitmap.i
  48. end
  49. pict.0 = bitmap.0
  50.  
  51. /* Add all GIF files to the list */
  52. if gif.0 > 0 then do i = 1 to gif.0
  53. 	j = pict.0 + i
  54. 	pict.j = gif.i
  55. end
  56. pict.0 = pict.0 + gif.0
  57.  
  58. /* Add all JPG files to the list */
  59. if jpg.0 > 0 then do i = 1 to jpg.0
  60. 	j = pict.0 + i
  61. 	pict.j = jpg.i
  62. end
  63. pict.0 = pict.0 + gif.0
  64.  
  65. /* Quit if no bitmaps were found */
  66. if pict.0 = 0 then exit
  67.  
  68. /* Randomly pick two bitmaps, one as the Desktop */
  69. /* background and another one as a Lockup bitmap */
  70. pictnum = random( 1, pict.0 )
  71. pict1   = translate( pict.pictnum )
  72. pictnum = random( 1, pict.0 )
  73. pict2   = translate( pict.pictnum )
  74. say
  75. say " Background bitmap : "||pict1
  76. say " Lockup bitmap     : "||pict2
  77. call SysSetObjectData "<WP_DESKTOP>", "BACKGROUND="||pict1||",S,1,I,0 0 0;"
  78.  
  79. /*
  80.  ษอออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออป
  81.  บ If IBM might still release OS/2 Warp 5 or later, you should change the    บ
  82.  บ line checking for Warp 4 (2.40) to Warp 4 or later.                       บ
  83.  ศอออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออผ
  84. */
  85. setupstring = "LOCKUPBACKGROUND="||pict2||",S,1,I,0 0 0;"
  86. if SysOS2Ver( ) = 2.40 then call SysSetObjectData "<WP_DESKTOP>", setupstring
  87.  
  88. exit
  89.  

page last modified: 2024-04-16; loaded in 0.0208 seconds