SBP ’’main()' to demonstrate the 'whereis routine ’ƒJBWhereis() dlg.SetActive() f$’dlg.Tag' - holds the selection from the file list dlg.Delete() ’•"dlg","wc" ’Āf$ ’’’’ 'Generalised Whereis file finder ' 'NB Requires Superbase v3.2 or later - uses FILLARRAY 5 and 6 ' ' (v2 version available on request from John Barrs) ' (uses DOS calls to achieve the same end) ' ' Operates on all local drives ' offers selection of drives . may be multiple selections ' (defaults to current directory) ' ' Always searches subdirs ' Asks file template ' ' You may add another drive if you can't find the file you wanted on the drive you specified ' ' On Exit: dlg.Tag contains the file you selected from the file-listbox ' ' If you wanted to use this as a menu call then see remarks in SUB main() ' ' Global variables dlg (Dialog) and wc (DialogControl) ' NB: I used SmallFonts at 7 becasue of the resolution I use on my machine ' MS Sans Serif at 8 would be more normal ' (see remark below on the Dialogs.Add section) ’’JBWhereis() ’•"dlg","wc" ’’dlg ’UDialog,wc ’UDialogControl Superbase.Dialogs.Add("JBWhereD") ’Źdlg ’Superbase.Dialogs.JBWhereD dlg.Move(0,0,200,133) dlg.Caption’"Whereis" dlg.FontName’"Small Fonts"'"MS Sans Serif" dlg.FontSize’7'8 dlg.OnActivate’"WhereAct" ’Źwc ’dlg.Add("DL1","DialogLabel") wc.Move(8,5,47,11) wc.Alignment’2 wc.Caption’"&Drives" ’Źwc ’dlg.Add("DLB1","DialogListBox") wc.Move(7,19,70,70) wc.MultiSelect’1 wc.Sorted’0 wc.ScrollBars’2 wc.OnDblClick’"JBWhereClick" wc.OnLostFocus’"JBWhereClick" ’Źwc ’dlg.Add("DL2","DialogLabel") wc.Move(82,6,114,11) wc.Alignment’0 wc.Caption’"&FileTemplate" ’Źwc ’dlg.Add("DT1","DialogTextBox") wc.Move(82,22,114,11) wc.MultiLine’1 wc.WantReturn’1 wc.MaxLength’20 wc.OnLostFocus’"JBWhereClick" ’Źwc ’dlg.Add("DL0","DialogLabel") wc.Move(200,6,40,10) wc.Alignment’0 wc.Caption’"" ’Źwc ’dlg.Add("DLB2","DialogListBox") wc.Move(82,21,156,105) wc.Sorted’1 wc.ScrollBars’2 wc.Visible’0 wc.OnDblClick’"JBWhereClick" wc.OnLostFocus’"JBWhereClick" ’Źwc ’dlg.Add("DCB1","DialogCommandButton") wc.Move(20,80,24,12) wc.Caption’"&Select" wc.ReturnValue’0 wc.Cancel’1 wc.OnClick’"JBWhereClick" ’Źwc ’dlg.Add("DCB2","DialogCommandButton") wc.Move(20,100,24,12) wc.Caption’"E&xit" wc.ReturnValue’0 wc.Cancel’1 wc.OnClick’"JBWhereClick" ’Źwc ’dlg.Add("DL3","DialogLabel") wc.Move(12,122,164,11) wc.Alignment’0 wc.Caption’"To Add another Drive in Search Click it and " wc.Visible’0 ’’’’ ’’WhereAct() ’Źwc ’dlg.DLB1 wc.AddItem(’Ž) wc.AddItem("All Hard Drives") ’›i%%’65’q77'(in my case last drive is M) d$’’(i%%)’":\" a%%’JBGetDrivTyp%%(d$) ’”a%%’2’pwc.AddItem(d$’" Local Exchangeable") ’”a%%’3’pwc.AddItem(d$’" Local HardDisk"):wc.Tag’wc.Tag’d$ ’”a%%’4’pwc.Additem(d$’" CD RomDrive") ’±i%% dlg.DT1.Text’"*.*" ’’’’ ’’JBWhereClick()'Dialog Clicks and LostFocus etc ’É’ęme.name ’ę"DCB1"'Select/OK Button ’”dlg.Tag’""’p  ’ƒJBWhereFillDL2()  me.Caption’"&OK" ’^ ’Źwc ’dlg.DLB2 ’”wc.List.Count’p  x%%’wc.GetSelected(1)  ’”x%%’0’px%%’1'force first if no selection on OK  ’”x%%’p dlg.Tag’’,(wc.List(x%%),81)  ’’’” ’^  dlg.Tag’"" ’’’” dlg.SetActive(0) ’’’” ’ę"DCB2"'Exit Button dlg.Tag’"" dlg.SetActive(0) ’ę"DT1"'LostFocus for TextBox ’”me.Text’""’pme.Text’"*.*" dlg.Tag’"" dlg.DCB1.Caption’"&Select" ’ę"DLB1"' Drive Template ListBox ’”dlg.DT1.Text’"*.*"’pdlg.DT1.SetFocus() ’ę"DLB2"'File List template - same as OK button ’Źwc ’dlg.DLB2 x%%’wc.GetSelected(1) ’”x%%’0’px%%’1 ’”x%%’p  dlg.Tag’’,(wc.List(x%%),61)  ’’’” dlg.SetActive(0) ’’’ę ’’’’ ’’JBWhereFillDL2()' fill ListBox2 ’×fil$(1),dir$(1) dlg.DCB1.Enabled’0 dlg.DCB2.Enabled’0 x%%’dlg.DLB1.GetSelected(1) ’”x%%’0’px%%’1'force current dir if no selection in Listbox1 ’Źwc ’dlg.DLB2 dlg.Move(0,0,250,133) dlg.Caption’"Whereis .. "’dlg.DLB1.List(x%%)’" .. "’dlg.DT1.Text ’”dlg.DLB1.List(x%%)’"All *"’p ’›i%%’1’q’/(dlg.DLB1.Tag)’k3 a$’WhereFillit$(’,(dlg.DLB1.Tag,i%%,3)) ’±i%% ’^’”dlg.DLB1.List(x%%)’’Ž’p a$’WhereFillit$(dlg.DLB1.List(x%%)) ’^ ’Ųx%%’0 d$’dlg.DLB1.List(x%%) d$’’+(d$,3) a$’WhereFillit$(d$) x%%’dlg.DLB1.GetSelected(x%%) ’”x%%’0’p’’’Ų ’Ł ’’’” dlg.DL2.Caption’’(dlg.DLB2.List.Count,".")’" Files Found" dlg.DL2.Caption’’H(dlg.DL2.Caption) dlg.DL2.Caption’’”(dlg.DL2.Caption’"f*","No Files Found",dlg.DL2.Caption) dlg.DCB1.Enabled’’1 dlg.DCB2.Enabled’’1 dlg.DL3.Visible’’1 ’’’’ ’’WhereFillit$(d$)' actually get directory contents - NB recursive - may call itself for subdirs ’×fil$(1),dir$(1) ’”’O(d$’"*\")’pd$’d$’"\" ’’ fil$(1),dir$(1) fil$(0)’"":fil$(1)’"":dir$(0)’"":dir$(1)’"" ’’ fil$(32000),dir$(256) f$’d$’dlg.DT1.Text dlg.DL2.Caption’’”(’/(d$)’20,’+(d$,3)’"..."’’-(d$,18),d$) ’’fil$,5,f$ ’›i%%’0’q32000 ’”fil$(i%%)’""’p x$’d$’fil$(i%%) x$’’”(’/(x$)’34,’+(x$,3)’"..."’’-(x$,30),x$) wc.Additem(’+(x$’’'(80),80)’d$’fil$(i%%)) ’^ i%%’32001 ’’’” ’±i%% ’”wc.Visible’0’ wc.List.Count’0’pwc.Visible’’1:dlg.DT1.Visible’0 ’’dir$,6,d$’"*.*"' get subdirs ’›i%%’0’q256 ’”dir$(i%%)’""’p ’”’O(dir$(i%%)’".*")’p  a$’WhereFillit$(d$’dir$(i%%)) ’’’” ’^ i%%’257 ’’’” ’±i%% dlg.DL0.Caption’’(wc.List.Count,",99999") ’’’’ ’’JBGetDrivTyp%%(d$)' locate what local drives are present ’×d%% d%%’’.(d$) d%%’’”(d%%’96,d%%’97,d%%’65) ’ī’… ’ī"KERNEL.EXE","GetDriveType","HI" d%%’’ƒ("GetDriveType",d%%) ’ī’… JBGetDrivTyp%%’d%% ’’’’