home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR13
/
OPENFDR3.ZIP
/
OPENFDR.CMD
next >
Wrap
OS/2 REXX Batch file
|
1993-10-11
|
5KB
|
112 lines
/* ================================================================ */
/* OPENFDR.CMD v.1.3 - by M. Woo, Champaign-Urbana OS/2 Users Group */
/* -- choose a folder to open from a popup list under 4OS2. */
/* Requires OS/2 (R) REXX, J.P. Software Inc.'s 4OS2 (TM). */
/* */
/* My contact addresses through Dec, 1993 (I don't know where I'll */
/* be after then) are: Internet: m-woo@uiuc.edu, Fidonet: 1:233/4.0 */
/* */
/* NOTE: if your desktop doesn't reside on the C: drive, or you are */
/* using OS/2 v2.0, you will have to modify this script where */
/* indicated to reflect your actual desktop's subdirectory. */
/* */
/* Unfortunately, I don't know of a way to make the folder open in */
/* front of the 4OS/2 command window, without adding another set of */
/* external REXX functions. Suggestions would be greatly */
/* appreciated! */
/* */
/* The user assumes responsibility for any damage caused by this */
/* program. There is no warranty, and the program is guaranteed */
/* only to waste space on your hard drive. */
/* ================================================================ */
/* Loads the external REXXUtil functions. */
call RxFuncAdd "SysLoadFuncs", "REXXutil", "SysLoadFuncs"
call SysLoadFuncs
'@echo off'
/* ============================================== */
/* This section reads the names of the folders */
/* on your system, and writes them to a file that */
/* 4OS/2's %@select[] command will read. */
/* */
/* If your desktop is somewhere OTHER than */
/* c:\desktop\, you'll have to make changes to */
/* the script to point to your desktop. */
/* Note: the desktop name under OS/2 2.0 is of */
/* the format <drive>:\OS!2 2.0 DESKTOP\ */
/* ============================================== */
/* Creates an array of all the subdirectories */
/* below "desktop" (recursively). */
call SysFileTree "c:\desktop\*", "dirs.", "DSO"
/* Creates an array of folder names by reading */
/* the subdirectory array and truncating them */
/* after the final backslash. */
do i=1 to dirs.0
lastslash=lastpos("\", dirs.i)
dirname.i=delstr(dirs.i, 1, lastslash)
name=dirname.i
lineout(folder,name) '>& nul'
end /* folder name loop */
/* ============================================== */
/* This section closes the newly-created text */
/* file, sorts it alphabetically, then runs the */
/* 4OS/2 variable function %@select on the text */
/* file to create the popup menu. */
/* ============================================== */
/* Closes the text file called "folder," then */
/* sorts the output into a new file called */
/* "folder.txt" */
lineout(folder) '>& nul'
'sort < folder > folder.txt'
/* Directs the user's selection into a file named */
/* "choice," and pipes any error messages to nul. */
'echos %@select[folder.txt,1,1,15,30,Folder] 1>choice 2>nul'
/* Assigns the text in "choice" to the variable */
/* "answer" and closes "choice." */
answer=linein(choice)
lineout(choice) '>&nul'
/* In case the user presses Esc to cancel the */
/* popup menu, this if-then-do loop will catch */
/* it and exit the script, after cleaning up. */
if answer='' then
do
'del folder.txt folder choice /q /f'
exit
end /* of answer loop */
/* ============================================== */
/* This section reads the array of your */
/* folder names. When the user's choice is the */
/* same as the folder name, the correct folder */
/* will be opened. */
/* ============================================== */
do k=1 to dirs.0 until (answer=dirname.k)
thedir=dirs.k
end /* do k loop */
/* open correct folder, specified by "thedir" */
call SysSetObjectData thedir, "OPEN=DEFAULT";
/* The cleanup of those messy little files that */
/* were created by this program. */
'del folder.txt folder choice /q /f'
exit