Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for wallpapr.rex

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

  1. /* Check command line arguments (none required) */
  2. Parse Arg cmdLineArgs
  3. If cmdLineArgs <> "" Then Call Syntax
  4.  
  5. /* Initialize RexxUtil */
  6. Call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  7. Call SysLoadFuncs
  8.  
  9. /* Initialize W32Funcs */
  10. Call RxFuncAdd 'W32LoadFuncs', 'W32Util', 'W32LoadFuncs'
  11. Call W32LoadFuncs
  12.  
  13. /* * * * * * * * * * * * * * * * * * * * * * * * * * */
  14. /* Current bitmap directory; %SystemRoot%\*.bmp.     */
  15. /* Modify if you want to use a different directory.  */
  16. /* * * * * * * * * * * * * * * * * * * * * * * * * * */
  17. dirBmp = Qualify( SysSystemDirectory( )||"\..\." )||"\*.bmp"
  18.  
  19. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  20. /* The lines calling SysFileTree were adapted so that only bitmaps marked    */
  21. /* read-only will be used; this allows you to make a selection of bitmaps    */
  22. /* without the need to move them into or out of your bitmap directories.     */
  23. /* You may remove the last parameter "*-*+*" to change this and use all      */
  24. /* bitmaps if you like, or replace "FO" with "FOS" to use bitmaps in         */
  25. /* subdirectories as well. Furthermore you could add more bitmap directories */
  26. /* or more bitmap types, if your version of Windows will support them.       */
  27. /* Well, you get the idea . . .                                              */
  28. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  29. Call SysFileTree dirBmp, "arrBmp.", "FO", "*-*+*"
  30. If arrBmp.0 > 0 Then Do
  31. 	/* Randomly choose a bitmap from the array */
  32. 	rnd = Random( 1, arrBmp.0 )
  33. 	bitmap = arrBmp.rnd
  34. 	/* Display the new wallpaper file name */
  35. 	Say "New wallpaper: "||bitmap
  36. 	/* Change the Desktop wallpaper */
  37. 	Call W32SysSetParameter "DeskWallPaper", "NP", bitmap
  38. End
  39. Else Do
  40. 	Call Syntax
  41. End
  42.  
  43. /* Normal program termination */
  44. Exit 0
  45.  
  46.  
  47. Syntax:
  48. 	Say
  49. 	Say "WallPapr.rex,  Version 1.01 for Windows NT 4 / 2000 / XP"
  50. 	Say "Randomly change the Desktop background bitmap (wallpaper)"
  51. 	Say
  52. 	Say "Usage:  REGINA.EXE  WALLPAPR.REX"
  53. 	Say
  54. 	Say "Requires Regina Rexx with RexxUtil and W32Funcs installed."
  55. 	Say "The current version of this script will only choose from bitmap files"
  56. 	Say "that are marked read-only and are located in the WINNT directory."
  57. 	Say "Read the comments in this script to find out how to change this behaviour."
  58. 	Say
  59. 	Say "Written by Rob van der Woude"
  60. 	Say "http://www.robvanderwoude.com"
  61. 	Exit 1
  62. Return
  63.  

page last modified: 2024-02-26; loaded in 0.0206 seconds