Stupid OS/2 Tricks/REXX Commands

OPEN.CMD
/* OPEN.CMD - opens a folder */ call RxFuncAdd "SysSetObjectData", "RexxUtil", "SysSetObjectData" folderpath=" :\ " call SysSetObjectData folderpath, "OPEN=DEFAULT"; exit /* where is the letter of the drive on which the subdirectory corresponding to the folder is located is the path to the subdirectory corresponding to the folder */

BIGDOS.CMD
/* Start a DOS session with the maximum free memory  */ /* Xavier Caballe - December 1993                    */ /* code added to make DOS session open in foreground */ /* M.Woo - 6 Jan 94                                  */ CALL RxFuncAdd SysLoadFuncs, RexxUtil,SysLoadFuncs; CALL SysLoadFuncs; ClassName='WPProgram';       /* Object type             */ Title='Big DOS';             /* Window title            */ Program='EXENAME=*;';        /* Program to run          */ Location='';     /* Object location         */ Type='PROGTYPE=VDM;';        /* DOS full screen session */ StartUp='STARTUPDIR=C:\;'    /* Working directory       */ Objectid='OBJECTID=;' /* Object ID              */ /* Session Settings */ /* The Video_Mode_Restriction value *MUST BE* fifteen characters long */ Settings='SET VIDEO_MODE_RESTRICTION=CGA           ;' Settings=Settings||'SET DOS_UMB=1;' Settings=Settings||'SET DOS_HIGH=1;' Open='OPEN=DEFAULT;'      /* Open default view       */ call SysCreateObject classname, title, location,, program||type||startup||objectid||settings||open, 'REPLACE' call SysSetObjectData '', open Return

BITMAP.CMD
/* BITMAP.CMD: change the desktop bitmap at regular intervals Syntax: BITMAP.CMD [/?] Copyright 1994 Jack Tan */ /* Check the interval value */ arg interval if interval=="" | WORDPOS("/?", interval)<>0 then do          SAY SAY "  BITMAP.CMD:  randomly change the desktop bitmap at", "periodic intervals" SAY "  Syntax:  BITMAP.CMD [/?]" SAY "  is the interval between bitmap changes,", "in seconds" exit 1 end /* Do */ else if DATATYPE(interval, "Whole Number")<>1 then call badNumber interval else if interval<=0 then call badNumber interval /* Prepare for the changes */ signal on halt name exitProgram BootDrive = VALUE("BOOTDRIVE",, "OS2ENVIRONMENT") BitmapSpec = BootDrive || "\OS2\BITMAP\*.BMP" call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs" call SysLoadFuncs SAY "BITMAP.CMD: Hit Ctrl+Break to exit" /* Execute the change */ do forever call SysFileTree BitmapSpec, "bitmaps", "FO" if bitmaps.0>0 then do               i = RANDOM(1, bitmaps.0) call SysSetObjectData ""; "BACKGROUND="bitmaps.i";" end /* Do */ call SysSleep interval end /* Do */ exitProgram: SAY "            Successfully exited" exit 0 badNumber: procedure SAY "Bad interval value '"ARG(1)"'" exit 2

CHKDRIVE.CMD
/* CHKDRIVE.CMD - check drive status */ '@echo off' parse arg drive_letter; drive_letter=delstr(drive_letter,2); if drive_letter=' ' then do   say "CHKDRIVE.CMD - check status of drive" say "USAGE: CHKDRIVE.CMD " say "where is the letter of drive you wish to check" exit end else signal ON NOTREADY name NOT_READY call STREAM drive_letter || ':*', 'D'   say "Drive Ready" exit NOT_READY: say "Drive Not Ready" return

EVAL.CMD
/* eval by L Kuru 25.11.1993 */ arg params; interpret say params; exit

LARGE.CMD
/* large.cmd - increase cursor size     */ /* If you want to return to the standard */ /* mouse cursor, change '1' to '2' in   */ /* the "val" variable. */ call RxFuncAdd "SysIni", "RexxUtil", "SysIni" inifile='USER' app='PM_IBMVGA' key='CURSOR_SIZE' val='1' call SysIni inifile, app, key, val say Result exit

PUTLONG.CMD
/* This procedure will change the long name of  */ /* a file without changing the actual file name. */ /* Useage:                                      */ /*   PUTLONG myfil.ext "Long File Name"         */ /* Written by Bill Parrill                      */ /* bparrill@vnet.ibm.com                        */ call RxFuncAdd 'SysPutEA', 'RexxUtil', 'SysPutEA' parse arg FileName '"'LongName'"' if FileName = '' then DO  say 'Please specify a file name!' exit 1 end /* Do */ if LongName = '' then DO  say 'Please specify a long name!' exit 2 end /* Do */ say 'File Name: 'FileName say 'Long Name: 'LongName RetCode = SysPutEA(FileName, '.LONGNAME',,                  'FDFF'x||D2C(LENGTH(LongName))||'00'x||LongName) say 'Return Code: 'RetCode EXIT

SETPTR.CMD
/* SetPtr.CMD -- set/remove a custom mouse pointer. Copyright 11 January 1994 by Jack Tan This is based on Dann Lunsford's SETMOUSE.CMD SETMOUSE.CMD by Dann Lunsford Short procedure to set mouse pointer to contents of specified .PTR file This file is in the public domain, but I'd appreciate it greatly if you would leave this notice in... Author: Dann Lunsford Vortex BBS (1:203/726) 13-Aug-1993 Be careful about adding/removing lines to this script -- it uses the SOURCELINE function, which is source-dependent. Syntax: SetPtr.CMD [pointer index] [/X] [/L] [/?] is the name of the file containing the pointer. If does not exist, .PTR is searched. [pointer index] is an optional parameter. It defaults to 1. Index Pointer                       Default OS/2 icon --          1    normal OS/2 pointer           arrow 2   text insertion                I-beam 3   wait cursor                   clock 4   size pointer                  (no icon) 5   move pointer                  four-way arrow 6   resize (NW to SE)             diagonal double arrow (\) 7   resize (NE to SW)             diagonal double arrow (/) 8   resize (horizontal)           horizontal double arrow (-) 9   resize (vertical)             vertical double arrow (|) /X (optional) indicates that the custom pointer should be removed. /L (optional) lists currently installed pointers. /? (optional) displays this help. */ /* Get arguments */ PARSE ARG arguments bigArgs = TRANSLATE(arguments) /* Show help */ if arguments=='' | WORDPOS("/?", arguments)<>0 then do      do i=12 to 33 SAY SOURCELINE(i) end /* do */ EXIT(1) end /* Do */ /* Setup the REXX function */ call RxFuncAdd 'SysIni', 'RexxUtil', 'SysIni' Inifile = 'User' App     = 'PM_SysPointer' /* Show current pointers */ if WORDPOS('/L', bigArgs)<>0 then do      result = SysIni(Inifile, App, 'All:', 'list') if list.0<1 then SAY "No custom pointers have been set." else do         SAY "Current custom pointers:" do i=1 to 9 result = SysIni(Inifile, App, i)            if result<>"ERROR:" then SAY "  ("i")" LEFT(pointerDesc(i), 20), SUBSTR(result, 5, LENGTH(result)-5) end /* Do */ end /* Do */ EXIT(0) end /* Do */ /* Look for a '/X' */ xPos = WORDPOS('/X', bigArgs) if xPos<>0 then do      removePtr = 1 arguments = DELWORD(arguments, xPos, 1) end /* Do */ else removePtr = 0 /* Look for a pointer index */ pointerIndex = 1 if WORDS(arguments)>1 | removePtr then do      /* Last argument should be the pointer index, since any '/X' has already been removed. If the last argument does not fit the requirements for a pointer index, assume that it is part of the filename. */      guessIndex = WORD(arguments, WORDS(arguments)) if LENGTH(guessIndex)==1 & VERIFY(guessIndex, '123456789')==0 then do         arguments = DELWORD(arguments, WORDS(arguments)) pointerIndex = guessIndex end /* Do */ end /* Do */ /* Set the filename */ if removePtr<>1 then do      arguments = STRIP(arguments) if SUBSTR(arguments, 1, 1)=='"' then         arguments = DELSTR(arguments, 1, 1)       if SUBSTR(arguments, LENGTH(arguments))=='"' then arguments = DELSTR(arguments, LENGTH(arguments)) filename = STREAM(arguments, 'Command', 'Query Exists') if filename=='' then do         /* Try again use .PTR extension */ filename = STREAM(arguments".PTR", 'Command', 'Query Exists') if filename=='' then do            SAY "Cannot find file:  '"arguments"'" EXIT(3) end /* Do */ end /* Do */ end /* Do */ /* Execute the change */ if removePtr then result = SysIni(Inifile, App, pointerIndex, 'DELETE:') else do      Keyvalue = x2c('01000000')||filename||x2c('00') result = SysIni(Inifile, App, pointerIndex, Keyvalue) end /* Do */ /* If the change failed... */   if result<>"" then do       returnCode = 3 if removePtr then SAY "Unable to delete the pointer" else SAY "Unable to set the pointer" end /* Do */ /* ... else print 'successful' message */ else do      returnCode = 0 if removePtr then SAY "Pointer successfully removed" else SAY "The new pointer will become effective at the next system boot." end /* Do */ /* Give some more information */ if removePtr<>1 then SAY "  File    = "filename SAY "  Pointer = "pointerDesc(pointerIndex) "("pointerIndex")" EXIT(returnCode) pointerDesc: procedure return STRIP(SUBSTR(SOURCELINE(20+ARG(1)), 15, 30)) /* End of REXX script */

SETFONT.CMD
/* setfont.cmd                         */ /* Usage: SETFONT      */ /* where  is the       */ /* point size and font desired in the  */ /* format size.type (e.g., 8.Helv)     */ call RxFuncAdd "SysIni", "RexxUtil", "SysIni" parse arg Font IniFile = "USER" AppName = "PM_SystemFonts" KeyName = "DefaultFont" call SysIni IniFile, AppName, KeyName, Font||x2c(0) say Result exit

SHUTDOWN.CMD
/* REXX script to shut down the PC in 5 minutes Author: David Matocha           david.matocha@yob.sccsi.com If you make any improvements, please send me a copy. Version 930316.6                           */ say ' ' say 'Please close all running applications.' say ' ' say 'WARNING: The Computer will shut down in 5 minutes!' beep(500, 1000); CALL SysSleep 14; beep(475, 1000); CALL SysSleep 14; beep(450, 1000); CALL SysSleep 14; beep(425, 1000); CALL SysSleep 14; say ' ' say 'WARNING: The Computer will shut down in 4 minutes!' beep(400, 1000); CALL SysSleep 14; beep(375, 1000); CALL SysSleep 14; beep(350, 1000); CALL SysSleep 14; beep(325, 1000); CALL SysSleep 14; say ' ' say 'WARNING: The Computer will shut down in 3 minutes!' beep(300, 1000); CALL SysSleep 14; beep(275, 1000); CALL SysSleep 14; beep(250, 1000); CALL SysSleep 14; beep(225, 1000); CALL SysSleep 14; say ' ' say 'WARNING: The Computer will shut down in 2 minutes!' beep(200, 1000); CALL SysSleep 14; beep(175, 1000); CALL SysSleep 14; beep(150, 1000); CALL SysSleep 14; beep(125, 1000); CALL SysSleep 14; say ' ' say 'WARNING: The Computer will shut down in 1 minute!' beep(100, 1000); CALL SysSleep 14; beep(500, 1000); CALL SysSleep 14; beep(1000, 1000); CALL SysSleep 14; beep(1500, 1000); CALL SysSleep 14; 'setboot /T:NO' 'setboot /B' exit /* shredder.cmd - REXX script to recreate the Shredder */ call RxFuncAdd "SysCreateObject", "RexxUtil", "SysCreateObject" class="WPShredder" title="Shredder" location="" settings="OBJECTID=;" settings=settings||"ICONPOS=90 8;" call SysCreateObject class, title, location, settings, "REPLACE" exit

SHREDDER.CMD
/* shredder.cmd - REXX script to recreate the Shredder */ call RxFuncAdd "SysCreateObject", "RexxUtil", "SysCreateObject" class="WPShredder" title="Shredder" location="" settings="OBJECTID=;" settings=settings||"ICONPOS=90 8;" call SysCreateObject class, title, location, settings, "REPLACE" exit

SLEEP.CMD
/* sleep.cmd - make system sleep for specified # of seconds */ /* syntax: sleep, where is time in seconds */ call RxFuncAdd "SysSleep", "RexxUtil", "SysSleep" parse arg sleeptime; sleeptime=strip(sleeptime) if sleeptime= '' then do  say "SLEEP.CMD - make system sleep for specified # of seconds" say "Usage: sleep " say "      where is time in seconds" exit end else call SysSleep sleeptime exit