home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
os2ff101.zip
/
os2ff.VRX
< prev
next >
Wrap
Text File
|
1993-08-12
|
10KB
|
446 lines
/*:VRX Main
*/
/* Main
*/
Main:
/* Process the arguments.
Get the parent window.
*/
parse source . calledAs .
parent = ""
argCount = arg()
argOff = 0
if( calledAs \= "COMMAND" )then do
if argCount >= 1 then do
parent = arg(1)
argCount = argCount - 1
argOff = 1
end
end
InitArgs.0 = argCount
if( argCount > 0 )then do i = 1 to argCount
InitArgs.i = arg( i + argOff )
end
drop calledAs argCount argOff
/* Load the windows
*/
call VRInit
parse source . . spec
_VREPrimaryWindowPath = ,
VRParseFileName( spec, "dpn" ) || ".VRW"
_VREPrimaryWindow = ,
VRLoad( parent, _VREPrimaryWindowPath )
drop parent spec
if( _VREPrimaryWindow == "" )then do
call VRMessage "", "Cannot load window:" VRError(), ,
"Error!"
_VREReturnValue = 32000
signal _VRELeaveMain
end
/* Process events
*/
call Init
signal on halt
do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
_VREEvent = VREvent()
interpret _VREEvent
end
_VREHalt:
_VREReturnValue = Fini()
call VRDestroy _VREPrimaryWindow
_VRELeaveMain:
call VRFini
exit _VREReturnValue
VRLoadSecondary: procedure
name = arg( 1 )
window = VRLoad( VRWindow(), VRWindowPath(), name )
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
return window
/*:VRX About_OK_Click
*/
About_OK_Click:
Call VRSet "About_OS2FF","Visible",0
return/*:VRX About_OS2FF_Close
*/
About_OS2FF_Close:
window = VRInfo( "Object" )
call VRDestroy window
drop window
return
/*:VRX Do_Search
*/
Do_Search:
if search_active = 1 then return
search_active = 1
count = 0
search_for = strip(VRGet("Search_For","Value"))
if length(search_for) = 0 then do
call VRSet VRWindow(),"StatusText","You must specify something to search for"
search_active = 0
return
end
x = VRMethod("data_list","Reset")
stat_opt = null
call set_status
drop data.
Select
When sort_type = "Ascend" then
Call VRSet "Data_List","Sort","Ascending"
When sort_type = "Descend" then
Call VRSet "Data_List","Sort","Descending"
When sort_type = "None" then
Call VRSet "Data_List","Sort","None"
end
Select
When search_Method = "Path" then
do i = 1 to path.0
call set_status path.i
x = SysFileTree(path.i"\"search_for,"data.","F")
if data.0 = 0 then iterate
call fix_up_data
x = VRMethod("data_list","AddStringList","data.")
drop data.
end
When search_Method = "Dpath" then
do i = 1 to dpath.0
call set_status dpath.i
x = SysFileTree(dpath.i"\"search_for,"data.","F")
if data.0 = 0 then iterate
call fix_up_data
x = VRMethod("data_list","AddStringList","data.")
drop data.
end
When search_Method = "Libpath" then
do i = 1 to libpath.0
call set_status libpath.i
x = SysFileTree(libpath.i"\"search_for,"data.","F")
if data.0 = 0 then iterate
call fix_up_data
x = VRMethod("data_list","AddStringList","data.")
drop data.
end
When left(search_Method,3) = "Any" then do
if search_method = "AnyLocal" then
Used_Disks = SysDriveMap('C:',"LOCAL")
else Used_Disks = SysDriveMap('C:')
drives = words(used_disks)
do i = 1 to drives
drive = word(used_disks,i)
call set_status drive
x = SysFileTree(drive"\"search_for,"data.","FS")
if data.0 = 0 then iterate
call fix_up_data
x = VRMethod("data_list","AddStringList","data.")
drop data.
end
end
otherwise nop;
end
call VRSet VRWindow(),"StatusText","Search Complete for" search_for "using" search_method "with" count "hits"
search_active = 0
return
Fix_Up_Data:
count = count + data.0
do ix = 1 to data.0
parse value data.ix with date time size attr file
name = VRParseFileName(file,"NE")
drive = VRParseFileName(file,"d")
path = VRParseFileName(file,"p")
data.ix = name drive":"path date time size attr
end
return
Set_Status:
arg stat_opt
call VRSet VRWindow(),"StatusText","Performing Search for" search_for "using" search_method stat_opt
return/*:VRX Fini
*/
Fini:
window = VRWindow()
call VRSet window, "Visible", 0
drop window
return 0
/*:VRX Halt
*/
Halt:
signal _VREHalt
return
/*:VRX Init
*/
Init:
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
report = "C:\find.rpt"
Current_Dir = VRCurrDrive()""VRCurrDir()
call VRSet VRWindow(),"Caption","OS/2 Find File from: ",
current_dir
config_sys = "c:\config.sys"
parse value "" with null path. libpath. dpath.
parse value "0 0 0 0 0" with path.0 libpath.0 dpath. hit search_active
do until lines(config_sys) = 0
if hit = 3 then leave
data = translate(linein(config_sys))
select
when left(data,9) = "SET PATH=" then call set_path
when left(data,10) = "SET DPATH=" then call set_dpath
when left(data,8) = "LIBPATH=" then call set_libpath
otherwise nop;
end
end
call lineout config_sys
window = VRWindow()
call VRMethod window, "CenterWindow"
call VRSet window, "Visible", 1
call VRMethod window, "Activate"
drop window
Call VRLoad VRWindow(), VRWindowPath(),"About_OS2FF"
Call VRSet "About_OS2FF","Visible",0
sort_type = "None"
search_method = "AnyLocal"
return
set_path:
path = translate(substr(data,10),' ',';')
pathw = words(path)
hit = hit + 1
do i = 1 to pathw
c = path.0 + 1
path.c = word(path,i)
if right(path.c,1) = "\" then do
len = length(path.c)
path.c = left(path.c,len-1)
end
path.0 = c
end
return
set_libpath:
hit = hit + 1
libpath = translate(substr(data,9),' ',';')
libpathw = words(libpath)
do i = 1 to libpathw
c = libpath.0 + 1
libpath.c = word(libpath,i)
if right(libpath.c,1) = "\" then do
len = length(libpath.c)
libpath.c = left(libpath.c,len-1)
end
libpath.0 = c
end
return
set_dpath:
hit = hit + 1
dpath = translate(substr(data,11),' ',';')
dpathw = words(dpath)
do i = 1 to dpathw
c = dpath.0 + 1
dpath.c = word(dpath,i)
if right(dpath.c,1) = "\" then do
len = length(dpath.c)
dpath.c = left(dpath.c,len-1)
end
dpath.0 = c
end
return/*:VRX Menu_About_Click
*/
Menu_About_Click:
Call VRSet "About_OS2FF","Visible",1
return
/*:VRX Menu_Exit_Click
*/
Menu_Exit_Click:
Call VRSet VRWindow(),"Shutdown",1
return
/*:VRX Menu_Path_Anylocal_Click
*/
Menu_Path_Anylocal_Click:
search_method = "AnyLocal"
call do_search
return
/*:VRX Menu_path_anywhere_Click
*/
Menu_path_anywhere_Click:
search_method = "Anywhere"
call do_search
return
/*:VRX Menu_path_dpath_Click
*/
Menu_path_dpath_Click:
search_method = "Dpath"
call do_search
return
/*:VRX Menu_path_libpath_Click
*/
Menu_path_libpath_Click:
search_method = "Libpath"
call do_search
return
/*:VRX Menu_path_Path_Click
*/
Menu_path_Path_Click:
search_method = "Path"
call do_search
return
/*:VRX Menu_Report_Click
*/
Menu_Report_Click:
if search_active = 1 then return
Call VRSet "Report","Set",0
Call VRSet VRWindow(),"StatusText","Reporting"
drop Data_list.
Call VRMethod "Data_list","GetStringList","data_list."
if data_list.0 = 0 then do
Call VRSet VRWindow(),"StatusText","Report Cancelled - ",
"you must do a search first."
return
end
buttons.0 = 2
buttons.1 = "Ok"
buttons.2 = "Cancel"
prompt = VRPrompt(VRWindow(),"Please enter an output file name for the report",,
"report","Report Prompt","buttons.")
if prompt = 2 then do
Call VRSet VRWindow(),"StatusText","Report Cancelled"
return
end
x = VRCreateFile(report)
call lineout report,"Report for file:" search_for
call lineout report,"Search Method is:" search_method "Using Sort Sequence:" sort_type
call lineout report,"Generated on" date() time() "from current directory:",
current_dir
call lineout report," "
if data_list.0 > 0 then do
call lineout report " "
do i = 1 to data_list.0
call lineout report,data_list.i
end
call lineout report," "
end
Call lineout report
Call VRSet VRWindow(),"StatusText","Report Complete to" report
return
/*:VRX Menu_Search_Click
*/
Menu_Search_Click:
return
/*:VRX Menu_Sort_Ascend_Click
*/
Menu_Sort_Ascend_Click:
Sort_Type = "Ascend"
return
/*:VRX Menu_Sort_Descend_Click
*/
Menu_Sort_Descend_Click:
Sort_Type = "Descend"
return
/*:VRX Menu_Sort_None_Click
*/
Menu_Sort_None_Click:
Sort_Type = "None"
return
/*:VRX Quit
*/
Quit:
window = VRWindow()
call VRSet window, "Shutdown", 1
drop window
return
/*:VRX Window1_Close
*/
Window1_Close:
call Quit
return