Unlike other REXX facilities, these functions are platform dependent
REXXUTIL is an external DLL that must be loaded into the REXX workspace. Unless explicitly removed, REXXUTIL becomes resident and is available to all OS/2 sessions. Note that failing to explicitly load the library in your programs can cause intermittent failure because your program will work only if run after another program that loads the routines.
Loading the REXXUTIL Functions:
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
Types of functions:
| File System Commands |
|---|
|
SysFileSearch() SysFileTree() SysRmDir() SysMkDir() SysDriveInfo() SysTempFileName() SysDriveMap() SysFileDelete() |
| Screen I/O Commands |
|
SysCls() SysGetKey() SysCurPos() SysCurState() SysGetMessage() SysTextScreenSize() SysTextScreenRead() |
| Desktop Object Commands |
|
SysCopyObject() SysCreateObject() SysRegisterObjectClass() SysSaveObject() SysCreateShadow() SysSetObjectData() SysDestroyObject() SysQueryClassList() SysMoveObject() SysOpenObject() SysSetIcon() |
| OS/2 System Copmmands |
|
SysSearchPath() SysSleep() SysgetEA() SysIni() SysDropFuncs() SysOS2Ver() SysWaitNamedPipe() SysPutEA() |
/* Delete any existing files in OutDir */
r = SysFileTree( OutDir || "\*.*", Files., "FO" )
DO I = 1 TO Files.0
r = SysFileDelete( Files.I )
END /* do */
/* Make disk(s) of OS/2 SIG site */
TempDir = "Temp"
/* Make the sub directories */
CALL BuildDir "*"
CALL BuildDir "before"
CALL BuildDir "build"
CALL BuildDir "databus"
CALL BuildDir "depends"
CALL BuildDir "images"
CALL BuildDir "photos"
CALL BuildDir "rexx"
CALL BuildDir "software"
EXIT
BuildDir: Procedure expose TempDir
PARSE ARG NewDir
IF ( NewDir <> "*" ) THEN DO /* Create the sub Directory */
OutDir = TempDir || "\" || NewDir
InFiles = NewDir || "\*.*"
CALL SysMkDir OutDir
END /* do */
ELSE DO /* It's the main directory */
OutDir = TempDir
InFiles = "*.*"
CALL SysMkDir OutDir
END /* do */
/* Delete any existing files */
r = SysFileTree( OutDir || "\*.*", Files., "FO" )
DO I = 1 TO Files.0
r = SysFileDelete( Files.I )
END /* do */
"COPY " || InFiles || " " || OutDir
RETURN
/*
Name: DTWTHR.CMD
Description: Retrieve weather picture and set as desktop background
Author: HG 6/27/01
Comment: Uses www.wunderground.com, requires WGET.EXE
Usage: Run in OS/2 CMD session
Arguments: Type of map
Output: None
Bugs: None
Fixes: None
*/
/* time (seconds) between refreshes */
refreshTime = 600
/* server to connect to */
hostName = "Weather Underground"
hostURL = "www.wunderground.com"
hostPort = 80
hostDir = "/data/images/"
/* filename */
fileName = ""
/* destination */
destDir = "F:\CMDFiles\Weather\"
/* program locations */
wgetExecutable = "F:\wget\os2\wget"
/* load the needed functions */
/* install REXX function library */
rc = RxFuncAdd( "SysLoadFuncs", "RexxUtil", "SysLoadFuncs" )
call SysLoadFuncs
say "Return code from RxFuncAdd:" rc
/* weather images */
mapType = translate( arg(1))
select
when mapType = "DEWPOINT" then do
fileName = "ne_dp.gif" /* dew point */
end
when mapType = "FRONTS" then do
fileName = "ne_sf.gif" /* fronts */
end
when mapType = "HEATINDEX" then do
fileName = "ne_hi.gif" /* heatindex */
end
when mapType = "HUMIDITY" then do
fileName = "ne_rh.gif" /* relative humidity */
end
when mapType = "JETSTREAM" then do
fileName = "ne_jt.gif" /* relative humidity */
end
when mapType = "RADAR" then do
fileName = "ne_rd.gif" /* radar */
end
when mapType = "SATELLITE" then do
fileName = "ne_ir.jpg" /* ir satellite */
end
when mapType = "SNOW" then do
fileName = "ne_snow.gif" /* snow */
end
when mapType = "TEMPERATURE" then do
fileName = "ne_st.gif" /* temperature */
end
when mapType = "UV" then do
fileName = "ne_uv.gif" /* ultraviolet */
end
when mapType = "VISIBILITY" then do
fileName = "ne_vs.gif" /* visibility */
end
when mapType = "WINDCHILL" then do
fileName = "ne_wc.gif" /* windchill */
end
when mapType = "WINDS" then do
fileName = "ne_ws.gif" /* winds */
end
otherwise do
fileName = "ne_ir.jpg" /* ir satellite */
end
end
image = "DIX19_0.gif" /* radar in /data/nids/ */
/* loop continuously */
do forever
/* get graphics file from server */
rc = GetData()
/* update wallpaper and stretch bitmap */
call SysSetObjectData "<WP_DESKTOP>","BACKGROUND="destDir || fileName",S,1,I"
/* sleep */
say "Sleeping..."
rc = SysSleep( refreshTime )
end
/* exit program */
exit
/* get page from site and save */
GetData:
URL = hostURL || hostDir || fileName
call SysFileDelete fileName
say URL
wgetExecutable || " -nd" URL
return rc
Rexx Group Charter
Lesson 1 | Lesson 2 | Lesson 3 | Lesson 4
Exercises 1 | Exercises 2 | Exercises 3
Answers to exercises
Exercises 1
Example code
Stock Market | Stock Market_a
About these pages | Page building by: | Content updated 07-09-2005 09:29am |