#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" 0 FileChooser3 ˆd on preOpenStack -- center the stack on the main screen --************************ set the minWidth of this stack to 320 set the minHeight of this stack to 240 --*********************** Global MyDir put the defaultfolder into MyDir show_drives set the loc of this stack to the screenLoc set the left of this stack to 0 set the top of this stack to 28 resizeStack pass preOpenStack end preOpenStack on resumeStack Global AdjustingWindow if AdjustingWindow = 1 then pass resumeStack Global Init Global ScreenInfo Global ScreenWidth Global ScreenHeight Global GapOnRight ----------------------------------------------------------------------------------------- Global GotPathAlready if GotPathAlready = 0 then resizeStack --******************* end if end resumeStack on resizeStack Global AdjustingWindow if AdjustingWindow = 1 then pass resizeStack Global Init Global ScreenInfo Global ScreenWidth Global ScreenHeight Global GapOnRight if Init = 1 then Global WidgetWidth Global WidgetHeight Position_Controls pass resizeStack --************** end if put the screenRect into ScreenInfo ----By default, the itemdelimeter is set to "," put item 3 of ScreenInfo into ScreenWidth put item 4 of ScreenInfo into ScreenHeight set the left of image "Image1" to 0 set the top of image "Image1" to 0 -------------------------------------------------------------------------------------------- --Card1: set the left of field "List1" of card "Card1" to 50 set the top of field "List1" of card "Card1" to 65 set the height of field "List1" of card "Card1" to ScreenHeight - 200 set the width of field "List1" of card "Card1" to 50 * (ScreenWidth / 100) set the height of field "List2" of card "Card1" to the height of field "List1" of card "Card1" set the top of field "List2" of card "Card1" to the top of field "List1" of card "Card1" set the left of field "List2" of card "Card1" to the right of field "List1" of card "Card1" put (ScreenWidth - the left of field "List2" of card "Card1") into GapOnRight set the width of field "List2" of card "Card1" to GapOnRight - 50 set the top of field "Text2" of card "Card1" to the bottom of field "List1" of card "Card1" show_drives get_ini_parameters call mouseDown of field "DriveField" of card "Card1" --of stack "HDTree" delete line 1 of field "List1" of card "Card1" --of stack "HDTree" --******************* --------------------------------------------------- Global SourceDirectory$ --e.g. c:\ Global StartupPath$ --e.g. c:\francis\posto if the number of chars in StartupPath$ > the number of chars in SourceDirectory$ then get_startup_folder end if --------------------------------------------------- put 1 into Init end resizeStack ---------------------------------------------------------------------------------------------- on show_drives Global AdjustingWindow if AdjustingWindow = 1 then pass show_drives Global DoingDiskError if DoingDiskError = 1 then put 0 into DoingDiskError pass show_drives end if call mouseDown of field "DriveField" of card "Card1" end show_drives ---------------------------------------------------------------------------------------------- on get_ini_parameters Global AdjustingWindow if AdjustingWindow = 1 then pass get_ini_parameters Global SourceDirectory$ Global IndentSize Global TreeFontname$ Global TreeFontsize Global TreeFontbold$ Global TreeFontitalic$ Global NumberOfDrives Global tempForeColour Global tempBackColour Global ProgramWindowIsMinimized if ProgramWindowIsMinimized = 1 then put 0 into ProgramWindowIsMinimized pass get_ini_parameters end if put URL "file:_file_chooser.ini" into field "IniParametersField" of card "Card4" of this stack ----------------------------------------- --Startup drive (e.g. c:\): --Number of spaces for indents (e.g. 8): --Fontname (e.g. Arial): --Fontsize (e.g. 12): --Bold (yes or no): --Italic (yes or no): --Window left position (nnn or centre or center): --Window right position (nnn or centre or center): --Window width (nnn - min=320): --Window height (nnn - min=240): ----------------------------------------- put line 1 of field "IniParametersField" of card "Card4" of this stack into SourceDirectory$ --e.g. "c:\" SourceDirectory$ put line 2 of field "IniParametersField" of card "Card4" of this stack into IndentSize --e.g. 8 IndentSize put line 3 of field "IniParametersField" of card "Card4" of this stack into TreeFontname$ --e.g. "Arial" TreeFontname$ put line 4 of field "IniParametersField" of card "Card4" of this stack into TreeFontsize --e.g. 12 TreeFontsize put line 5 of field "IniParametersField" of card "Card4" of this stack into TreeFontbold$ --e.g. "yes" TreeFontbold$ put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$ --put the first word of SourceDirectory$ into SourceDirectory$ --put the first word of IndentSize into IndentSize --put the first word of TreeFontname$ into TreeFontname$ --put the first word of TreeFontsize into TreeFontsize --put the first word of TreeFontbold$ into TreeFontbold$ --put the first word of TreeFontitalic$ into TreeFontitalic$ put word 1 to -1 of SourceDirectory$ into SourceDirectory$ Global StartupPath$ put SourceDirectory$ into StartupPath$ --e.g. c:\francis\posto or c:\francis\posto\ if the last char of StartupPath$ = "\" then put char 1 to -2 of StartupPath$ into StartupPath$ end if put char 1 to 3 of SourceDirectory$ into SourceDirectory$ --e.g. c:\ --put word 1 to -1 of IndentSize into IndentSize put word 1 to -1 of TreeFontname$ into TreeFontname$ --put word 1 to -1 of TreeFontsize into TreeFontsize put word 1 to -1 of TreeFontbold$ into TreeFontbold$ put word 1 to -1 of TreeFontitalic$ into TreeFontitalic$ if SourceDirectory$ = "" then put "c:\" into SourceDirectory$ if IndentSize = "" then put 8 into IndentSize if TreeFontname$ = "" then put "Arial" into TreeFontname$ if TreeFontsize = "" then put 12 into TreeFontsize if TreeFontbold$ = "" then put "no" into TreeFontbold$ if TreeFontitalic$ = "" then put "no" into TreeFontitalic$ put the toLower of TreeFontbold$ into TreeFontbold$ put the toLower of TreeFontitalic$ into TreeFontitalic$ set the textFont of field "List1" to TreeFontname$ set the textFont of field "List2" to TreeFontname$ set the textFont of button "Filters" to TreeFontname$ set the textFont of button "Cancel" to TreeFontname$ set the textFont of button "OK" to TreeFontname$ set the textSize of field "List1" to TreeFontsize set the textSize of field "List2" to TreeFontsize set the textSize of button "Filters" to TreeFontsize set the textSize of button "Cancel" to TreeFontsize set the textSize of button "OK" to TreeFontsize if TreeFontbold$ = "yes" then set the textStyle of field "List1" to "bold" set the textStyle of field "List2" to "bold" set the textStyle of button "Filters" to "bold" set the textStyle of button "Cancel" to "bold" set the textStyle of button "OK" to "bold" end if if TreeFontitalic$ = "yes" then set the textStyle of field "List1" to "italic" set the textStyle of field "List2" to "italic" set the textStyle of button "Filters" to "italic" set the textStyle of button "Cancel" to "italic" set the textStyle of button "OK" to "italic" end if if TreeFontbold$ = "yes" and TreeFontitalic$ = "yes" then set the textStyle of field "List1" to "bold,italic" set the textStyle of field "List2" to "bold,italic" set the textStyle of button "Filters" to "bold,italic" set the textStyle of button "Cancel" to "bold,italic" set the textStyle of button "OK" to "bold,italic" end if --SourceDirectory$ put the first character of SourceDirectory$ into tempVar --put the backgroundcolor of field "DriveField1" into tempBackColour --put the foregroundcolor of field "DriveField1" into tempForeColour --put 236,233,216 into tempBackColour put 255,255,255 into tempBackColour --******************************* put 0,0,215 into tempForeColour ----------------------------------------- global AdjustingWindow put 1 into AdjustingWindow ----------------------------------------- --Window left position (nnn or centre or center): --Window top position (nnn or centre or center): --Window width (nnn - min=320): --Window height (nnn - min=240): --Main background colour (e.g. grey or gray or 128,128,128 or #808080): --Main font colour (e.g. grey or gray or 128,128,128 or #808080): --Button background colour (e.g. grey or gray or 128,128,128 or #808080): --Button font colour (e.g. grey or gray or 128,128,128 or #808080): ----------------------------------------- --Example only: --put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$ --put word 1 to -1 of TreeFontitalic$ into TreeFontitalic$ --put the toLower of TreeFontitalic$ into TreeFontitalic$ --if TreeFontitalic$ = "" then put "no" into TreeFontitalic$ ----------------------------------------- --Widget left position (nnn or centre or center): --Widget top position (nnn or centre or center): put line 7 of field "IniParametersField" of card "Card4" of this stack into WidgetLeftPosition put line 8 of field "IniParametersField" of card "Card4" of this stack into WidgetTopPosition put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight Global OutputMode$ put line 11 of field "IniParametersField" of card "Card4" of this stack into OutputMode$ put word 1 to -1 of WidgetLeftPosition into WidgetLeftPosition put word 1 to -1 of WidgetTopPosition into WidgetTopPosition put word 1 to -1 of WidgetWidth into WidgetWidth put word 1 to -1 of WidgetHeight into WidgetHeight put word 1 to -1 of OutputMode$ into OutputMode$ put the toLower of WidgetLeftPosition into WidgetLeftPosition put the toLower of WidgetTopPosition into WidgetTopPosition put the toLower of WidgetWidth into WidgetWidth put the toLower of WidgetHeight into WidgetHeight put the toLower of OutputMode$ into OutputMode$ if WidgetLeftPosition = "" then put "centre" into WidgetLeftPosition put "centre" into WidgetTopPosition end if if WidgetTopPosition = "" then put "centre" into WidgetLeftPosition put "centre" into WidgetTopPosition end if if WidgetLeftPosition = "center" then put "centre" into WidgetLeftPosition put "centre" into WidgetTopPosition end if if WidgetTopPosition = "center" then put "centre" into WidgetLeftPosition put "centre" into WidgetTopPosition end if if WidgetWidth < 320 then put 320 into WidgetWidth if WidgetHeight < 240 then put 240 into WidgetHeight set the width of this stack to WidgetWidth set the height of this stack to WidgetHeight if WidgetLeftPosition <> "centre" and WidgetTopPosition <> "centre" then set the left of this stack to WidgetLeftPosition set the top of this stack to WidgetTopPosition end if if WidgetLeftPosition = "centre" and WidgetTopPosition = "centre" then Global ScreenWidth Global ScreenHeight --set the rect of this stack to the screenRect --put the width of this stack into ScreenWidth --put the height of this stack into ScreenHeight --The above should have already been done If WidgetWidth > ScreenWidth then put ScreenWidth into WidgetWidth If WidgetHeight > ScreenHeight then put ScreenHeight into WidgetHeight put (ScreenWidth - WidgetWidth) into HorizontalDifference put (ScreenHeight - WidgetHeight) into VerticalDifference put (HorizontalDifference / 2) into WidgetLeftMargin put (VerticalDifference / 2) into WidgetTopMargin set the left of this stack to WidgetLeftMargin set the top of this stack to WidgetTopMargin end if set the bottomright of button "OK" to (WidgetWidth - 15),(WidgetHeight - 15) set the top of button "Cancel" to the top of button "OK" set the right of button "Cancel" to (the left of button "OK" - 5) set the top of button "Filters" to the top of button "OK" set the width of button "Filters" to (the left of button "Cancel" - 20) set the left of button "Filters" to 15 put (WidgetWidth - 30) into HorizontalWidgetSpaceForLists put ((2 * HorizontalWidgetSpaceForLists) / 3) into List1Width set the width of field "List1" to List1Width set the width of field "List2" to (HorizontalWidgetSpaceForLists - the width of field "List1") set the left of field "List1" to 15 set the left of field "List2" to the right of field "List1" put (the top of button "Filters" - 10) - (the bottom of field "DriveField1" + 10) into theListHeight set the height of field "List1" to theListHeight set the height of field "List2" to theListHeight set the top of field "List1" to (the bottom of field "DriveField1" + 10) set the top of field "List2" to (the bottom of field "DriveField1" + 10) if OutputMode$ <> "hd" and OutputMode$ <> "clipboard" then put "hd" into OutputMode$ end if ------------------------------------- ----------------------------------------- --global AdjustingWindow put 0 into AdjustingWindow ----------------------------------------- -------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------- put URL "file:_file_chooser_filters.ini" into field "Filters" of card "Card4" of this stack put URL "file:_file_chooser_filters.ini" into button "Filters" of card "Card1" of this stack if line 1 of field "Filters" of card "Card4" of this stack is empty then put "*.* All files" into field "Filters" of card "Card4" of this stack put "*.* All files" into button "Filters" of card "Card1" of this stack end if -------------------------------------------------------------------------- --Global NumberOfDrives Put 0 into Counter repeat for each line ThisLine in field "DriveField" put (Counter + 1) into Counter if the text of field ("DriveField" & Counter) = tempVar then set the backgroundcolor of field ("DriveField" & Counter) to tempForeColour set the foregroundcolor of field ("DriveField" & Counter) to tempBackColour Global GotPathAlready if GotPathAlready <> 1 then --***************************** Global WidgetFolder$ put the defaultfolder into WidgetFolder$ replace "/" with "\" in WidgetFolder$ if the last char of WidgetFolder$ is "\" then put char 1 to -2 of WidgetFolder$ into WidgetFolder$ end if --***************************** remove_all_drivebox_highlights call mouseDown of field ("DriveField" & Counter) --*************************** end if exit repeat end if end repeat put IndentSize into field "TextIndentSizeField" of card "Card3" ------------------------------------------------- put SourceDirectory$ into field "Text2" put SourceDirectory$ into InputDirectory$ put 1 into GotPathAlready put empty into field "List1" call mouseUp of button "GetFolderButton" of card "Card3" put field "ListExpandedField" of card "Card3" into field "List1" of this card end get_ini_parameters ---------------------------------------------------------------------------------------------- on iconifyStack Global AdjustingWindow if AdjustingWindow = 1 then pass iconifyStack Global ProgramWindowIsMinimized put 1 into ProgramWindowIsMinimized end iconifyStack ---------------------------------------------------------------------------------------------- on remove_all_drivebox_highlights Global AdjustingWindow if AdjustingWindow = 1 then pass remove_all_drivebox_highlights Global tempForeColour Global tempBackColour set the backgroundcolor of field "DriveField" to tempBackColour set the foregroundcolor of field "DriveField" to tempForeColour Put 0 into Counter repeat for each line ThisLine in field "DriveField" put (Counter + 1) into Counter set the backgroundcolor of field ("DriveField" & Counter) to tempBackColour set the foregroundcolor of field ("DriveField" & Counter) to tempForeColour end repeat end remove_all_drivebox_highlights ---------------------------------------------------------------------------------------------- on error_reading_diskette Global AdjustingWindow if AdjustingWindow = 1 then pass error_reading_diskette put empty into field "List2" of card "Card1" --********************* if the sysError is 21 or the sysError is 1235 then Global DoingDiskError put 1 into DoingDiskError end if remove_all_drivebox_highlights set the backgroundcolor of field "DriveField1" to tempBackColour set the foregroundcolor of field "DriveField1" to tempForeColour end error_reading_diskette on get_startup_folder Global Init if Init = 1 then pass get_startup_folder Global SourceDirectory$ --e.g. c:\ Global StartupPath$ --e.g. c:\francis\posto if field "List1" of card "Card1" is empty then pass get_startup_folder put StartupPath$ into field "Text2" put StartupPath$ into SourceDirectory$ put SourceDirectory$ into InputDirectory$ put 1 into GotPathAlready put empty into field "List1" ----------------------------------------------------------------- ----------------------------------------------------------------- Global IndentSize Global InputDirectory$ Global Counter put 0 into Counter repeat for 30 times put Counter + 1 into Counter if exists (field ("LabelBlockField" & Counter) of card "Card3") then delete field ("LabelBlockField" & Counter) of card "Card3" end if end repeat if the last character of InputDirectory$ is ":" then put (InputDirectory$ & "\") into InputDirectory$ end if put InputDirectory$ into field "Text1Field" of card "Card3" --e.g. InputDirectory$: --d:\program files\howsoft\html slideshow --Get the items of this string and put them into LabelBlockField0, LabelBlockField1 .... --put characters 1 to 3 of InputDirectory$ into field "LabelBlockField0" --WRONG --set the text of field "LabelBlockField0" to (characters 1 to 3 of InputDirectory$) --WRONG --set the itemDelimiter to "/" --N.B NOT "\" set the itemDelimiter to "\" --*****************changed************** put 0 into Counter repeat for each item ThisItem in InputDirectory$ put Counter + 1 into Counter if the last item of InputDirectory$ is ThisItem then if exists (field ("LabelBlockField" & Counter) of card "Card3") is false then clone field "LabelBlockField0" of card "Card3" set the name of it to ("LabelBlockField" & Counter) end if put ThisItem into field ("LabelBlockField" & Counter) of card "Card3" exit repeat else if exists (field ("LabelBlockField" & Counter) of card "Card3") is false then clone field "LabelBlockField0" of card "Card3" set the name of it to ("LabelBlockField" & Counter) end if put ThisItem into field ("LabelBlockField" & Counter) of card "Card3" end if end repeat put empty into field "ListFilesField" of card "Card3" set the defaultFolder to InputDirectory$ ------------------------------------------------------------------------------ if the sysError is 21 or the sysError is 1235 then put "" into field "Text2" of card "Card1" put "" into SourceDirectory$ error_reading_diskette pass get_startup_folder end if --------------------------------------------------------------------------------- put the files into field "ListFilesField" of card "Card3" sort lines of field "ListFilesField" of card "Card3" put empty into field "ListSubfoldersField" of card "Card3" put the folders into field "ListSubfoldersField" of card "Card3" delete line 1 of field "ListSubfoldersField" of card "Card3" --***************************** sort lines of field "ListSubfoldersField" of card "Card3" --THIS PART IS TO MAKE LITERALLY THE PORTION OF THE LIST THAT NEEDS TO BE INCLUDED --AS A RESULT OF CLICKING ON A "+" LINE --The new items appearing in ListExpanded need to be tested one by one to see --whether they also contain folders. This determines whether they have "+" or Chr$(160) -- + Chr$(160) before them. if field "ListSubfoldersField" of card "Card3" is empty then put "no" into field "LabelLastBlockContainsFoldersField" of card "Card3" else put "yes" into field "LabelLastBlockContainsFoldersField" of card "Card3" end if put (Counter + 1) into field "LabelNumberOfBlocksField" of card "Card3" put empty into field "ListExpandedField" of card "Card3" --You have items in ListSubfolders such as: --d:\program files\adobe\acrobat 5.0 --The number of blocks is in Counter + 1 or LabelNumberOfBlocks.Caption --The IndentSize is multiplied by the Sourcepath's number of blocks - 2, --or in other words, the max block number - 1 ---------------------------------------------------------------------------------------------- Global LHSIndentInBlankChars put ((Counter - 1) * IndentSize) into LHSIndentInBlankChars ---------------------------------------------------------------------------------------------- if LHSIndentInBlankChars < 0 then put 0 into LHSIndentInBlankChars end if put LHSIndentInBlankChars into field "LabelLHSIndentInBlankCharsField" of card "Card3" repeat for each line ThisLine in field "ListSubfoldersField" of card "Card3" put empty into field "TempField" of card "Card3" set the defaultFolder to InputDirectory$ & "/" & ThisLine put the folders into field "TempField" of card "Card3" delete line 1 of field "TempField" of card "Card3" --********************* sort lines of field "TempField" of card "Card3" if the number of lines in field "TempField" of card "Card3" is 0 then put (numToChar(160) & numToChar(160) & ThisLine) into ThisLine else put ("+" & ThisLine) into ThisLine end if if the number of characters in ThisLine > 0 then put ((field "ListExpandedField" of card "Card3") & return & ThisLine) into field "ListExpandedField" of card "Card3" end if end repeat ----------------------------------------------------------------- ----------------------------------------------------------------- put field "ListExpandedField" of card "Card3" into field "List1" of this card delete the first line of field "List1" of this card Global PathShowingInText2$ put field "Text2" of card "Card1" into PathShowingInText2$ set the defaultFolder to PathShowingInText2$ put the files into field "ListFilesField" of card "Card3" sort lines of field "ListFilesField" of card "Card3" call filter_out_files of field "List1" of card "Card1" put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" end get_startup_folder on Position_Controls Global WidgetWidth Global WidgetHeight put the width of this stack into WidgetWidth put the height of this stack into WidgetHeight if WidgetWidth < 320 then put 320 into WidgetWidth end if if WidgetHeight < 240 then put 240 into WidgetHeight end if set the bottomright of button "OK" to (WidgetWidth - 15),(WidgetHeight - 15) set the top of button "Cancel" to the top of button "OK" set the right of button "Cancel" to (the left of button "OK" - 5) set the top of button "Filters" to the top of button "OK" set the width of button "Filters" to (the left of button "Cancel" - 20) set the left of button "Filters" to 15 put (WidgetWidth - 30) into HorizontalWidgetSpaceForLists put ((2 * HorizontalWidgetSpaceForLists) / 3) into List1Width set the width of field "List1" to List1Width set the width of field "List2" to (HorizontalWidgetSpaceForLists - the width of field "List1") set the left of field "List1" to 15 set the left of field "List2" to the right of field "List1" put (the top of button "Filters" - 10) - (the bottom of field "DriveField1" + 10) into theListHeight set the height of field "List1" to theListHeight set the height of field "List2" to theListHeight set the top of field "List1" to (the bottom of field "DriveField1" + 10) set the top of field "List2" to (the bottom of field "DriveField1" + 10) end Position_Controls €"ç@ð FileChooser@ðÿÿÿÿ UTahoma UArialUArialWArialWArialWArial UArialUArial$UArial$WArial U UArialcRevStandaloneSettings;scriptLibrariesInternet Geometry PrintingMacOSXfalse OSX,nameHDTreeMacOS,documentTypeUNIX,fileSelectortrueWindowstrueWindows,LegalCopyright.2006 howsoft.com All rights reserved worldwideMacOS,longVersionHDTree 1.0.0.0Windows,CommentsAuthor: Robert J WarrenUNIX,pageSetuptrueOSX,documentTypeLinuxfalseOdtfalse inclusionsselectWindows,documenticonFile;D:/Program Files/Revolution 2.6/Sample Icons/genericdoc.ico answerDialogtrueSPARCfalse SolIntelfalseOSX,documentExtensionWindows,FileDescription&File Chooser Widget 1.1 for Windows XPOSX,longVersionHDTree 1.0.0.0 MacOSfatfalseOSX,copyright.2005 howsoft.com All rights reserved worldwideUNIX,printerChoosertrueMacOS,MinimumSize15000MacOS,versionnumber11MacOS,versionnumber20MacOS,ReleaseFinalOSX,identifiercom.howsoft.com.hdtreename _file_chooserMacOS,versionnumber30Hp9k700falsers6000false MacOS,Region1OSX,shortVersion1.0.0.0Windows,fileversion11Windows,productversion11Windows,fileversion21Windows,productversion21Windows,fileversion30BsdfalsecursorstrueWindows,productversion30Windows,fileversion40Windows,productversion40 OSX,infoHDTree Version 1.0.0.0 MacOS68kfalseMacOS,dynamicMemorytrueIrisfalse askDialogtrueOSX,signature????Windows,iconFile#h_deep_sky_blue_all_resolutions.icoMacOS,PreferredSize15000Windows,ProductNameFile Chooser WidgetUNIX,colorChoosertrue MacOSPPCfalseWindows,companyname howsoft.com SolSparcfalseMacOS,creator????cREVGeometryCachestackID1072 cREVGeneralscriptChecksum¼

on preOpenStack -- center the stack on the main screen

--************************

set the minWidth of this stack to 320

set the minHeight of this stack to 240

--***********************

Global MyDir

put the defaultfolder into MyDir

show_drives

set the loc of this stack to the screenLoc

set the left of this stack to 0

set the top of this stack to 28

resizeStack

pass preOpenStack

end preOpenStack

on resumeStack

Global AdjustingWindow

if AdjustingWindow = 1 then pass resumeStack

Global Init

Global ScreenInfo

Global ScreenWidth

Global ScreenHeight

Global GapOnRight

-----------------------------------------------------------------------------------------

Global GotPathAlready

if GotPathAlready = 0 then

resizeStack --*******************

end if

end resumeStack

on resizeStack

Global AdjustingWindow

if AdjustingWindow = 1 then pass resizeStack

Global Init

Global ScreenInfo

Global ScreenWidth

Global ScreenHeight

Global GapOnRight

if Init = 1 then

Global WidgetWidth

Global WidgetHeight

Position_Controls

pass resizeStack --**************

end if

put the screenRect into ScreenInfo

----By default, the itemdelimeter is set to ","

put item 3 of ScreenInfo into ScreenWidth

put item 4 of ScreenInfo into ScreenHeight

set the left of image "Image1" to 0

set the top of image "Image1" to 0

--------------------------------------------------------------------------------------------

--Card1:

set the left of field "List1" of card "Card1" to 50

set the top of field "List1" of card "Card1" to 65

set the height of field "List1" of card "Card1" to ScreenHeight - 200

set the width of field "List1" of card "Card1" to 50 * (ScreenWidth / 100)

set the height of field "List2" of card "Card1" to the height of field "List1" of card "Card1"

set the top of field "List2" of card "Card1" to the top of field "List1" of card "Card1"

set the left of field "List2" of card "Card1" to the right of field "List1" of card "Card1"

put (ScreenWidth - the left of field "List2" of card "Card1") into GapOnRight

set the width of field "List2" of card "Card1" to GapOnRight - 50

set the top of field "Text2" of card "Card1" to the bottom of field "List1" of card "Card1"

show_drives

get_ini_parameters

call mouseDown of field "DriveField" of card "Card1" --of stack "HDTree"

delete line 1 of field "List1" of card "Card1" --of stack "HDTree" --*******************

---------------------------------------------------

Global SourceDirectory$ --e.g. c:\

Global StartupPath$ --e.g. c:\francis\posto

if the number of chars in StartupPath$ > the number of chars in SourceDirectory$ then

get_startup_folder

end if

---------------------------------------------------

put 1 into Init

end resizeStack

----------------------------------------------------------------------------------------------

on show_drives

Global AdjustingWindow

if AdjustingWindow = 1 then pass show_drives

Global DoingDiskError

if DoingDiskError = 1 then

put 0 into DoingDiskError

pass show_drives

end if

call mouseDown of field "DriveField" of card "Card1"

end show_drives

----------------------------------------------------------------------------------------------

on get_ini_parameters

Global AdjustingWindow

if AdjustingWindow = 1 then pass get_ini_parameters

Global SourceDirectory$

Global IndentSize

Global TreeFontname$

Global TreeFontsize

Global TreeFontbold$

Global TreeFontitalic$

Global NumberOfDrives

Global tempForeColour

Global tempBackColour

Global ProgramWindowIsMinimized

if ProgramWindowIsMinimized = 1 then

put 0 into ProgramWindowIsMinimized

pass get_ini_parameters

end if

put URL "file:_file_chooser.ini" into field "IniParametersField" of card "Card4" of this stack

-----------------------------------------

--Startup drive (e.g. c:\):

--Number of spaces for indents (e.g. 8):

--Fontname (e.g. Arial):

--Fontsize (e.g. 12):

--Bold (yes or no):

--Italic (yes or no):

--Window left position (nnn or centre or center):

--Window right position (nnn or centre or center):

--Window width (nnn - min=320):

--Window height (nnn - min=240):

-----------------------------------------

put line 1 of field "IniParametersField" of card "Card4" of this stack into SourceDirectory$ --e.g. "c:\" SourceDirectory$

put line 2 of field "IniParametersField" of card "Card4" of this stack into IndentSize --e.g. 8 IndentSize

put line 3 of field "IniParametersField" of card "Card4" of this stack into TreeFontname$ --e.g. "Arial" TreeFontname$

put line 4 of field "IniParametersField" of card "Card4" of this stack into TreeFontsize --e.g. 12 TreeFontsize

put line 5 of field "IniParametersField" of card "Card4" of this stack into TreeFontbold$ --e.g. "yes" TreeFontbold$

put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$

--put the first word of SourceDirectory$ into SourceDirectory$

--put the first word of IndentSize into IndentSize

--put the first word of TreeFontname$ into TreeFontname$

--put the first word of TreeFontsize into TreeFontsize

--put the first word of TreeFontbold$ into TreeFontbold$

--put the first word of TreeFontitalic$ into TreeFontitalic$

put word 1 to -1 of SourceDirectory$ into SourceDirectory$

Global StartupPath$

put SourceDirectory$ into StartupPath$ --e.g. c:\francis\posto or c:\francis\posto\

if the last char of StartupPath$ = "\" then

put char 1 to -2 of StartupPath$ into StartupPath$

end if

put char 1 to 3 of SourceDirectory$ into SourceDirectory$ --e.g. c:\

--put word 1 to -1 of IndentSize into IndentSize

put word 1 to -1 of TreeFontname$ into TreeFontname$

--put word 1 to -1 of TreeFontsize into TreeFontsize

put word 1 to -1 of TreeFontbold$ into TreeFontbold$

put word 1 to -1 of TreeFontitalic$ into TreeFontitalic$

if SourceDirectory$ = "" then put "c:\" into SourceDirectory$

if IndentSize = "" then put 8 into IndentSize

if TreeFontname$ = "" then put "Arial" into TreeFontname$

if TreeFontsize = "" then put 12 into TreeFontsize

if TreeFontbold$ = "" then put "no" into TreeFontbold$

if TreeFontitalic$ = "" then put "no" into TreeFontitalic$

put the toLower of TreeFontbold$ into TreeFontbold$

put the toLower of TreeFontitalic$ into TreeFontitalic$

set the textFont of field "List1" to TreeFontname$

set the textFont of field "List2" to TreeFontname$

set the textFont of button "Filters" to TreeFontname$

set the textFont of button "Cancel" to TreeFontname$

set the textFont of button "OK" to TreeFontname$

set the textSize of field "List1" to TreeFontsize

set the textSize of field "List2" to TreeFontsize

set the textSize of button "Filters" to TreeFontsize

set the textSize of button "Cancel" to TreeFontsize

set the textSize of button "OK" to TreeFontsize

if TreeFontbold$ = "yes" then

set the textStyle of field "List1" to "bold"

set the textStyle of field "List2" to "bold"

set the textStyle of button "Filters" to "bold"

set the textStyle of button "Cancel" to "bold"

set the textStyle of button "OK" to "bold"

end if

if TreeFontitalic$ = "yes" then

set the textStyle of field "List1" to "italic"

set the textStyle of field "List2" to "italic"

set the textStyle of button "Filters" to "italic"

set the textStyle of button "Cancel" to "italic"

set the textStyle of button "OK" to "italic"

end if

if TreeFontbold$ = "yes" and TreeFontitalic$ = "yes" then

set the textStyle of field "List1" to "bold,italic"

set the textStyle of field "List2" to "bold,italic"

set the textStyle of button "Filters" to "bold,italic"

set the textStyle of button "Cancel" to "bold,italic"

set the textStyle of button "OK" to "bold,italic"

end if

--SourceDirectory$

put the first character of SourceDirectory$ into tempVar

--put the backgroundcolor of field "DriveField1" into tempBackColour

--put the foregroundcolor of field "DriveField1" into tempForeColour

--put 236,233,216 into tempBackColour

put 255,255,255 into tempBackColour --*******************************

put 0,0,215 into tempForeColour

-----------------------------------------

global AdjustingWindow

put 1 into AdjustingWindow

-----------------------------------------

--Window left position (nnn or centre or center):

--Window top position (nnn or centre or center):

--Window width (nnn - min=320):

--Window height (nnn - min=240):

--Main background colour (e.g. grey or gray or 128,128,128 or #808080):

--Main font colour (e.g. grey or gray or 128,128,128 or #808080):

--Button background colour (e.g. grey or gray or 128,128,128 or #808080):

--Button font colour (e.g. grey or gray or 128,128,128 or #808080):

-----------------------------------------

--Example only:

--put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$

--put word 1 to -1 of TreeFontitalic$ into TreeFontitalic$

--put the toLower of TreeFontitalic$ into TreeFontitalic$

--if TreeFontitalic$ = "" then put "no" into TreeFontitalic$

-----------------------------------------

--Widget left position (nnn or centre or center):

--Widget top position (nnn or centre or center):

put line 7 of field "IniParametersField" of card "Card4" of this stack into WidgetLeftPosition

put line 8 of field "IniParametersField" of card "Card4" of this stack into WidgetTopPosition

put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth

put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight

Global OutputMode$

put line 11 of field "IniParametersField" of card "Card4" of this stack into OutputMode$

put word 1 to -1 of WidgetLeftPosition into WidgetLeftPosition

put word 1 to -1 of WidgetTopPosition into WidgetTopPosition

put word 1 to -1 of WidgetWidth into WidgetWidth

put word 1 to -1 of WidgetHeight into WidgetHeight

put word 1 to -1 of OutputMode$ into OutputMode$

put the toLower of WidgetLeftPosition into WidgetLeftPosition

put the toLower of WidgetTopPosition into WidgetTopPosition

put the toLower of WidgetWidth into WidgetWidth

put the toLower of WidgetHeight into WidgetHeight

put the toLower of OutputMode$ into OutputMode$

if WidgetLeftPosition = "" then

put "centre" into WidgetLeftPosition

put "centre" into WidgetTopPosition

end if

if WidgetTopPosition = "" then

put "centre" into WidgetLeftPosition

put "centre" into WidgetTopPosition

end if

if WidgetLeftPosition = "center" then

put "centre" into WidgetLeftPosition

put "centre" into WidgetTopPosition

end if

if WidgetTopPosition = "center" then

put "centre" into WidgetLeftPosition

put "centre" into WidgetTopPosition

end if

if WidgetWidth < 320 then put 320 into WidgetWidth

if WidgetHeight < 240 then put 240 into WidgetHeight

set the width of this stack to WidgetWidth

set the height of this stack to WidgetHeight

if WidgetLeftPosition <> "centre" and WidgetTopPosition <> "centre" then

set the left of this stack to WidgetLeftPosition

set the top of this stack to WidgetTopPosition

end if

if WidgetLeftPosition = "centre" and WidgetTopPosition = "centre" then

Global ScreenWidth

Global ScreenHeight

--set the rect of this stack to the screenRect

--put the width of this stack into ScreenWidth

--put the height of this stack into ScreenHeight

--The above should have already been done

If WidgetWidth > ScreenWidth then put ScreenWidth into WidgetWidth

If WidgetHeight > ScreenHeight then put ScreenHeight into WidgetHeight

put (ScreenWidth - WidgetWidth) into HorizontalDifference

put (ScreenHeight - WidgetHeight) into VerticalDifference

put (HorizontalDifference / 2) into WidgetLeftMargin

put (VerticalDifference / 2) into WidgetTopMargin

set the left of this stack to WidgetLeftMargin

set the top of this stack to WidgetTopMargin

end if

set the bottomright of button "OK" to (WidgetWidth - 15),(WidgetHeight - 15)

set the top of button "Cancel" to the top of button "OK"

set the right of button "Cancel" to (the left of button "OK" - 5)

set the top of button "Filters" to the top of button "OK"

set the width of button "Filters" to (the left of button "Cancel" - 20)

set the left of button "Filters" to 15

put (WidgetWidth - 30) into HorizontalWidgetSpaceForLists

put ((2 * HorizontalWidgetSpaceForLists) / 3) into List1Width

set the width of field "List1" to List1Width

set the width of field "List2" to (HorizontalWidgetSpaceForLists - the width of field "List1")

set the left of field "List1" to 15

set the left of field "List2" to the right of field "List1"

put (the top of button "Filters" - 10) - (the bottom of field "DriveField1" + 10) into theListHeight

set the height of field "List1" to theListHeight

set the height of field "List2" to theListHeight

set the top of field "List1" to (the bottom of field "DriveField1" + 10)

set the top of field "List2" to (the bottom of field "DriveField1" + 10)

if OutputMode$ <> "hd" and OutputMode$ <> "clipboard" then

put "hd" into OutputMode$

end if

-------------------------------------

-----------------------------------------

--global AdjustingWindow

put 0 into AdjustingWindow

-----------------------------------------

--------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------

put URL "file:_file_chooser_filters.ini" into field "Filters" of card "Card4" of this stack

put URL "file:_file_chooser_filters.ini" into button "Filters" of card "Card1" of this stack

if line 1 of field "Filters" of card "Card4" of this stack is empty then

put "*.* All files" into field "Filters" of card "Card4" of this stack

put "*.* All files" into button "Filters" of card "Card1" of this stack

end if

--------------------------------------------------------------------------

--Global NumberOfDrives

Put 0 into Counter

repeat for each line ThisLine in field "DriveField"

put (Counter + 1) into Counter

if the text of field ("DriveField" & Counter) = tempVar then

set the backgroundcolor of field ("DriveField" & Counter) to tempForeColour

set the foregroundcolor of field ("DriveField" & Counter) to tempBackColour

Global GotPathAlready

if GotPathAlready <> 1 then

--*****************************

Global WidgetFolder$

put the defaultfolder into WidgetFolder$

replace "/" with "\" in WidgetFolder$

if the last char of WidgetFolder$ is "\" then

put char 1 to -2 of WidgetFolder$ into WidgetFolder$

end if

--*****************************

remove_all_drivebox_highlights

call mouseDown of field ("DriveField" & Counter) --***************************

end if

exit repeat

end if

end repeat

put IndentSize into field "TextIndentSizeField" of card "Card3"

-------------------------------------------------

put SourceDirectory$ into field "Text2"

put SourceDirectory$ into InputDirectory$

put 1 into GotPathAlready

put empty into field "List1"

call mouseUp of button "GetFolderButton" of card "Card3"

put field "ListExpandedField" of card "Card3" into field "List1" of this card

end get_ini_parameters

----------------------------------------------------------------------------------------------

on iconifyStack

Global AdjustingWindow

if AdjustingWindow = 1 then pass iconifyStack

Global ProgramWindowIsMinimized

put 1 into ProgramWindowIsMinimized

end iconifyStack

----------------------------------------------------------------------------------------------

on remove_all_drivebox_highlights

Global AdjustingWindow

if AdjustingWindow = 1 then pass remove_all_drivebox_highlights

Global tempForeColour

Global tempBackColour

set the backgroundcolor of field "DriveField" to tempBackColour

set the foregroundcolor of field "DriveField" to tempForeColour

Put 0 into Counter

repeat for each line ThisLine in field "DriveField"

put (Counter + 1) into Counter

set the backgroundcolor of field ("DriveField" & Counter) to tempBackColour

set the foregroundcolor of field ("DriveField" & Counter) to tempForeColour

end repeat

end remove_all_drivebox_highlights

----------------------------------------------------------------------------------------------

on error_reading_diskette

Global AdjustingWindow

if AdjustingWindow = 1 then pass error_reading_diskette

put empty into field "List2" of card "Card1" --*********************

if the sysError is 21 or the sysError is 1235 then

Global DoingDiskError

put 1 into DoingDiskError

end if

remove_all_drivebox_highlights

set the backgroundcolor of field "DriveField1" to tempBackColour

set the foregroundcolor of field "DriveField1" to tempForeColour

end error_reading_diskette

on get_startup_folder

Global Init

if Init = 1 then pass get_startup_folder

Global SourceDirectory$ --e.g. c:\

Global StartupPath$ --e.g. c:\francis\posto

if field "List1" of card "Card1" is empty then pass get_startup_folder

put StartupPath$ into field "Text2"

put StartupPath$ into SourceDirectory$

put SourceDirectory$ into InputDirectory$

put 1 into GotPathAlready

put empty into field "List1"

-----------------------------------------------------------------

-----------------------------------------------------------------

Global IndentSize

Global InputDirectory$

Global Counter

put 0 into Counter

repeat for 30 times

put Counter + 1 into Counter

if exists (field ("LabelBlockField" & Counter) of card "Card3") then

delete field ("LabelBlockField" & Counter) of card "Card3"

end if

end repeat

if the last character of InputDirectory$ is ":" then

put (InputDirectory$ & "\") into InputDirectory$

end if

put InputDirectory$ into field "Text1Field" of card "Card3"

--e.g. InputDirectory$:

--d:\program files\howsoft\html slideshow

--Get the items of this string and put them into LabelBlockField0, LabelBlockField1 ....

--put characters 1 to 3 of InputDirectory$ into field "LabelBlockField0" --WRONG

--set the text of field "LabelBlockField0" to (characters 1 to 3 of InputDirectory$) --WRONG

--set the itemDelimiter to "/" --N.B NOT "\"

set the itemDelimiter to "\" --*****************changed**************

put 0 into Counter

repeat for each item ThisItem in InputDirectory$

put Counter + 1 into Counter

if the last item of InputDirectory$ is ThisItem then

if exists (field ("LabelBlockField" & Counter) of card "Card3") is false then

clone field "LabelBlockField0" of card "Card3"

set the name of it to ("LabelBlockField" & Counter)

end if

put ThisItem into field ("LabelBlockField" & Counter) of card "Card3"

exit repeat

else

if exists (field ("LabelBlockField" & Counter) of card "Card3") is false then

clone field "LabelBlockField0" of card "Card3"

set the name of it to ("LabelBlockField" & Counter)

end if

put ThisItem into field ("LabelBlockField" & Counter) of card "Card3"

end if

end repeat

put empty into field "ListFilesField" of card "Card3"

set the defaultFolder to InputDirectory$

------------------------------------------------------------------------------

if the sysError is 21 or the sysError is 1235 then

put "" into field "Text2" of card "Card1"

put "" into SourceDirectory$

error_reading_diskette

pass get_startup_folder

end if

---------------------------------------------------------------------------------

put the files into field "ListFilesField" of card "Card3"

sort lines of field "ListFilesField" of card "Card3"

put empty into field "ListSubfoldersField" of card "Card3"

put the folders into field "ListSubfoldersField" of card "Card3"

delete line 1 of field "ListSubfoldersField" of card "Card3" --*****************************

sort lines of field "ListSubfoldersField" of card "Card3"

--THIS PART IS TO MAKE LITERALLY THE PORTION OF THE LIST THAT NEEDS TO BE INCLUDED

--AS A RESULT OF CLICKING ON A "+" LINE

--The new items appearing in ListExpanded need to be tested one by one to see

--whether they also contain folders. This determines whether they have "+" or Chr$(160)

-- + Chr$(160) before them.

if field "ListSubfoldersField" of card "Card3" is empty then

put "no" into field "LabelLastBlockContainsFoldersField" of card "Card3"

else

put "yes" into field "LabelLastBlockContainsFoldersField" of card "Card3"

end if

put (Counter + 1) into field "LabelNumberOfBlocksField" of card "Card3"

put empty into field "ListExpandedField" of card "Card3"

--You have items in ListSubfolders such as:

--d:\program files\adobe\acrobat 5.0

--The number of blocks is in Counter + 1 or LabelNumberOfBlocks.Caption

--The IndentSize is multiplied by the Sourcepath's number of blocks - 2,

--or in other words, the max block number - 1

----------------------------------------------------------------------------------------------

Global LHSIndentInBlankChars

put ((Counter - 1) * IndentSize) into LHSIndentInBlankChars

----------------------------------------------------------------------------------------------

if LHSIndentInBlankChars < 0 then

put 0 into LHSIndentInBlankChars

end if

put LHSIndentInBlankChars into field "LabelLHSIndentInBlankCharsField" of card "Card3"

repeat for each line ThisLine in field "ListSubfoldersField" of card "Card3"

put empty into field "TempField" of card "Card3"

set the defaultFolder to InputDirectory$ & "/" & ThisLine

put the folders into field "TempField" of card "Card3"

delete line 1 of field "TempField" of card "Card3" --*********************

sort lines of field "TempField" of card "Card3"

if the number of lines in field "TempField" of card "Card3" is 0 then

put (numToChar(160) & numToChar(160) & ThisLine) into ThisLine

else

put ("+" & ThisLine) into ThisLine

end if

if the number of characters in ThisLine > 0 then

put ((field "ListExpandedField" of card "Card3") & return & ThisLine) into field "ListExpandedField" of card "Card3"

end if

end repeat

-----------------------------------------------------------------

-----------------------------------------------------------------

put field "ListExpandedField" of card "Card3" into field "List1" of this card

delete the first line of field "List1" of this card

Global PathShowingInText2$

put field "Text2" of card "Card1" into PathShowingInText2$

set the defaultFolder to PathShowingInText2$

put the files into field "ListFilesField" of card "Card3"

sort lines of field "ListFilesField" of card "Card3"

call filter_out_files of field "List1" of card "Card1"

put field "ListFilesField" of card "Card3" into field "List2" of card "Card1"

set the label of this stack to field "Text2" of card "Card1"

end get_startup_folder

on Position_Controls

Global WidgetWidth

Global WidgetHeight

put the width of this stack into WidgetWidth

put the height of this stack into WidgetHeight

if WidgetWidth < 320 then

put 320 into WidgetWidth

end if

if WidgetHeight < 240 then

put 240 into WidgetHeight

end if

set the bottomright of button "OK" to (WidgetWidth - 15),(WidgetHeight - 15)

set the top of button "Cancel" to the top of button "OK"

set the right of button "Cancel" to (the left of button "OK" - 5)

set the top of button "Filters" to the top of button "OK"

set the width of button "Filters" to (the left of button "Cancel" - 20)

set the left of button "Filters" to 15

put (WidgetWidth - 30) into HorizontalWidgetSpaceForLists

put ((2 * HorizontalWidgetSpaceForLists) / 3) into List1Width

set the width of field "List1" to List1Width

set the width of field "List2" to (HorizontalWidgetSpaceForLists - the width of field "List1")

set the left of field "List1" to 15

set the left of field "List2" to the right of field "List1"

put (the top of button "Filters" - 10) - (the bottom of field "DriveField1" + 10) into theListHeight

set the height of field "List1" to theListHeight

set the height of field "List2" to theListHeight

set the top of field "List1" to (the bottom of field "DriveField1" + 10)

set the top of field "List2" to (the bottom of field "DriveField1" + 10)

end Position_Controls

êCard1 P ²on openCard hide this stack show this stack -------------------------------------------------------------------------------------- --Private Sub Form_Load() --On Error Resume Next --'Global SourceDirectory$ --'Global IndentSize --'Global TreeFontname$ --'Global TreeFontsize --'Global TreeFontbold --'Global TreeFontitalic --Open App.Path + "\_HDtree.ini" For Input As #1 --Input #1, SourceDirectory$ --Input #1, IndentSize --Input #1, TreeFontname$ --Input #1, TreeFontsize --Input #1, TreeFontbold --Input #1, TreeFontitalic --Input #1, ScrollSmallAndLargeChange --Close #1 --If SourceDirectory$ = "" Then SourceDirectory$ = Form1.LabelSourceDirectory.Caption --If IndentSize = 0 Then IndentSize = Val(Form1.LabelIndentSize.Caption) --If TreeFontname$ = "" Then TreeFontname$ = Form1.LabelFontname.Caption --If TreeFontsize = 0 Then TreeFontsize = Val(Form1.LabelFontsize.Caption) --If Err <> 0 Then --If Trim$(LCase$(Form1.LabelFontbold.Caption)) = "yes" Then --TreeFontbold = -1 --Else --TreeFontbold = 0 --End If --End If --If Err <> 0 Then --If Trim$(LCase$(Form1.LabelFontitalic.Caption)) = "yes" Then --TreeFontitalic = -1 --Else --TreeFontitalic = 0 --End If --End If --If ScrollSmallAndLargeChange = 0 Then ScrollSmallAndLargeChange = 120 --Err = 0 --'Global IndentSize --Form3.TextIndentSize.Text = CStr(IndentSize) --Form1.List1.FontName = TreeFontname$ --Form1.List1.FontSize = TreeFontsize --Form1.List1.FontBold = TreeFontbold --Form1.List1.FontItalic = TreeFontitalic --Form1.List2.FontName = TreeFontname$ --Form1.Text2.FontName = TreeFontname$ --Form1.List2.FontSize = TreeFontsize --Form1.List2.FontBold = TreeFontbold --Form1.List2.FontItalic = TreeFontitalic --Form1.Text1.Text = SourceDirectory$ --Form3.Text1.Text = SourceDirectory$ --Form1.Text2.Text = SourceDirectory$ --Form1.VScroll1.SmallChange = ScrollSmallAndLargeChange --Form1.VScroll1.LargeChange = ScrollSmallAndLargeChange --'Global GotPathAlready --GotPathAlready = 1 --'Global InputDirectory$ --InputDirectory$ = SourceDirectory$ --Call Form3.Command1_Click --'Form3.Show 'for removal --'ListExpanded --For n = 0 To Form3.ListExpanded.ListCount - 1 --ThisItem$ = Form3.ListExpanded.List(n) --Form1.List1.AddItem ThisItem$ --Next n --'Form1.VScroll1.Min = -1 --'Form1.VScroll1.Max = ((Form1.List1.Height - Form1.VScroll1.Height + 270) / 15) + 10 --Adjust_Scroll --Set_Up_Drive_Icons --End Sub end openCard €@ðcREVGeometryCacheIDs 11362221471671065113624359839510661136244250907106811188876137181012113629762758610691118892123274101311187938454871006113103930793210491118863130578100811187937815481004cREVGeometrycacheorder total10 cREVGeneralscriptChecksum¹Ãúúœ«Í']‹¸¤Ó®¬" bookmarks handlerListopenCard tempScript prevHandleropenCardscriptSelection char 15 to 14script

on openCard

hide this stack

show this stack

--------------------------------------------------------------------------------------

--Private Sub Form_Load()

--On Error Resume Next

--'Global SourceDirectory$

--'Global IndentSize

--'Global TreeFontname$

--'Global TreeFontsize

--'Global TreeFontbold

--'Global TreeFontitalic

--Open App.Path + "\_HDtree.ini" For Input As #1

--Input #1, SourceDirectory$

--Input #1, IndentSize

--Input #1, TreeFontname$

--Input #1, TreeFontsize

--Input #1, TreeFontbold

--Input #1, TreeFontitalic

--Input #1, ScrollSmallAndLargeChange

--Close #1

--If SourceDirectory$ = "" Then SourceDirectory$ = Form1.LabelSourceDirectory.Caption

--If IndentSize = 0 Then IndentSize = Val(Form1.LabelIndentSize.Caption)

--If TreeFontname$ = "" Then TreeFontname$ = Form1.LabelFontname.Caption

--If TreeFontsize = 0 Then TreeFontsize = Val(Form1.LabelFontsize.Caption)

--If Err <> 0 Then

--If Trim$(LCase$(Form1.LabelFontbold.Caption)) = "yes" Then

--TreeFontbold = -1

--Else

--TreeFontbold = 0

--End If

--End If

--If Err <> 0 Then

--If Trim$(LCase$(Form1.LabelFontitalic.Caption)) = "yes" Then

--TreeFontitalic = -1

--Else

--TreeFontitalic = 0

--End If

--End If

--If ScrollSmallAndLargeChange = 0 Then ScrollSmallAndLargeChange = 120

--Err = 0

--'Global IndentSize

--Form3.TextIndentSize.Text = CStr(IndentSize)

--Form1.List1.FontName = TreeFontname$

--Form1.List1.FontSize = TreeFontsize

--Form1.List1.FontBold = TreeFontbold

--Form1.List1.FontItalic = TreeFontitalic

--Form1.List2.FontName = TreeFontname$

--Form1.Text2.FontName = TreeFontname$

--Form1.List2.FontSize = TreeFontsize

--Form1.List2.FontBold = TreeFontbold

--Form1.List2.FontItalic = TreeFontitalic

--Form1.Text1.Text = SourceDirectory$

--Form3.Text1.Text = SourceDirectory$

--Form1.Text2.Text = SourceDirectory$

--Form1.VScroll1.SmallChange = ScrollSmallAndLargeChange

--Form1.VScroll1.LargeChange = ScrollSmallAndLargeChange

--'Global GotPathAlready

--GotPathAlready = 1

--'Global InputDirectory$

--InputDirectory$ = SourceDirectory$

--Call Form3.Command1_Click

--'Form3.Show 'for removal

--'ListExpanded

--For n = 0 To Form3.ListExpanded.ListCount - 1

--ThisItem$ = Form3.ListExpanded.List(n)

--Form1.List1.AddItem ThisItem$

--Next n

--'Form1.VScroll1.Min = -1

--'Form1.VScroll1.Max = ((Form1.List1.Height - Form1.VScroll1.Height + 270) / 15) + 10

--Adjust_Scroll

--Set_Up_Drive_Icons

--End Sub

end openCard

-ìîðôõ)*,ñCard2 @€@ðcREVGeometryCacheIDs 113397732716610561134039519824106011339776122351059113397721538010551133977086796105411339769820031053113397689457910521133977512847105811339774274461057 cREVGeneral bookmarks handlerList prevHandler tempScriptscriptcREVGeometryCachetotal9order  !"#$òCard3 @€@ðcREVGeometryCacheIDs1119190048195103511191908167681044111918993115910311119189985468103311193071507311047111918945545210281136311191229107011191907933571042111918977794910301119190612056104011191908068271043111919058891110391119189538606102911191901659341037113640060420710721119190784587104111191905353161038cREVGeometryCachetotal17order    .0óCard4 @€@ðcREVGeometryCacheIDs113621515046910641136214694160106311191210939711015cREVGeometryCachetotal3order ÷'( ìList1Å)8š/on rawKeyDown end rawKeyDown on mouseDown disable button "OK" of card "Card1" Global DoingSelect If DoingSelect = 1 Then pass mouseDown --''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' --'When the operator clicks on a line with "+" WITH SOME INDENT --'1) Save the tree up to and including the clicked line in traceback.txt --'2) Set the SourceDirectory$ (see original program) and run the traceback module. --'3) Note the HDpath (to the line clicked) --'4) Input the ENTIRE HDpath from above to the Expand Folder module --'5) This module produces a new segment (with the expanded folders) to be included --'in the tree immediately after the line with "+" that was clicked. --'6) Put the traceback.txt data from 1), the new segment data from 5) and the rest --'of the treefile after the "+" line that was clicked all together to form a new treefile. --''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' --'When the operator clicks on a line with "+" WITH NO INDENT --'a) Deduce the path to the line clicked from the line clicked itself --'b) Continue for 4) above --'c) When copying back the data in step 6), a single indent will be needed in the --'new segment --'************************************************************************************** Global LineNumberClicked put the second word of the mouseline into LineNumberClicked Global ItemClicked$ put the the value of the clickLine into ItemClicked$ if char 1 of ItemClicked$ <> " " Then call LineClickedWithNoIndent pass mouseDown end if if char 1 of ItemClicked$ = " " then call LineClickedWithIndent pass mouseDown end if pass mouseDown end mouseDown on LineClickedWithNoIndent Global ItemClicked$ if char 1 of ItemClicked$ = "+" Then call LineClickedWithNoIndentButPlus --******************************************************************** if the charToNum of the last char of field "List1" = 10 then delete the last char of field "List1" --************************* Global LineNumberClicked select line LineNumberClicked of field "List1" end if --******************************************************************** pass LineClickedWithNoIndent end if if char 1 of ItemClicked$ = "-" Then call LineClickedWithNoIndentButMinus --******************************************************************** if the charToNum of the last char of field "List1" = 10 then Global LineNumberClicked delete the last char of field "List1" --************************* select line LineNumberClicked of field "List1" end if --******************************************************************** pass LineClickedWithNoIndent end if if char 1 of ItemClicked$ = numtochar(160) then call LineClickedWithNoIndentButChr160 --******************************************************************** if the charToNum of the last char of field "List1" = 10 then Global LineNumberClicked delete the last char of field "List1" --************************* select line LineNumberClicked of field "List1" end if --******************************************************************** pass LineClickedWithNoIndent end if end LineClickedWithNoIndent ----------------------------------------------------------------------------------- on LineClickedWithNoIndentButPlus Global PathBlock$ Global SourceDirectory$ Global ItemClicked$ Global HDPathToExpand$ put char 2 to -1 of ItemClicked$ into PathBlock$ If char -1 of SourceDirectory$ = "\" Then put SourceDirectory$ & PathBlock$ into HDPathToExpand$ Else put SourceDirectory$ & "\" & PathBlock$ into HDPathToExpand$ End If Global InputDirectory$ put HDPathToExpand$ into field "Text1Field" of card "card3" put word 1 to -1 of field "Text1Field" of card "card3" into InputDirectory$ Global GotPathAlready put 1 into GotPathAlready call mouseUp of button "GetFolderButton" of card "card3" put empty into field "List3" Global LineNumberClicked if LineNumberClicked = 1 then --put line 1 of field "List1" into field "List3" ------------------------------------------------ --put ("--" & (char 2 to -1 of line 1 of field "List1")) into field "List3" --********************************** ------------------------------------------------ end if put 0 into n repeat (LineNumberClicked -1) times put n + 1 into n put line n of field "List1" into ThisItem$ put field "List3" & ThisItem$ & return into field "List3" end repeat Global PathBlock$ put "--" & PathBlock$ into NewItemClicked$ put field "List3" & NewItemClicked$ into field "List3" Global IndentSize put 0 into n repeat until n = the number of lines of field "ListExpandedField" of card "Card3" put n + 1 into n put line n of field "ListExpandedField" of card "Card3" into ThisItem$ put 0 into c if IndentSize > 0 then repeat until c = IndentSize put c + 1 into c put space & ThisItem$ into ThisItem$ end repeat end if put field "List3" & ThisItem$ & return into field "List3" end repeat If LineNumberClicked < the number of lines of field "List1" then put LineNumberClicked into n repeat until n = the number of lines of field "List1" put n + 1 into n put line n of field "List1" into ThisItem$ put field "List3" & ThisItem$ & return into field "List3" end repeat end if put empty into field "List1" put 0 into n repeat until n = the number of lines of field "List3" put n + 1 into n put line n of field "List3" into ThisItem$ put field "List1" & ThisItem$ & return into field "List1" end repeat Global LineNumberClicked select line LineNumberClicked of field "List1" put HDPathToExpand$ into field "Text2" set the label of this stack to field "Text2" of card "Card1" put empty into field "List2" ----------------------------------------- Global HDPathToExpand$ set the defaultFolder to HDPathToExpand$ put the files into field "ListFilesField" of card "Card3" sort lines of field "ListFilesField" of card "Card3" call filter_out_files ----------------------------------------- if the number of lines of field "ListFilesField" of card "Card3" = 0 then pass LineClickedWithNoIndentButPlus end if put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 end LineClickedWithNoIndentButPlus ----------------------------------------------------------------------------------- on LineClickedWithNoIndentButMinus --'e.g. --'--Program Files <--------------------YOU CLICKED HERE --' +Accessories --' +Adaptec --' --Adobe --' --Acrobat 5.0 --' +Help --' --Reader --'   ActiveX --'   Browser --'   JavaScripts --'   Legal --'   Optional --' --plug_ins --'   InterTrust --'   Movie --' +WEBBUY --'+rebol --'The task here is simply to remove everything following the line clicked up to (but --'not including) +rebol and to change the line clicked from minus to plus: --'+Program Files <--------------------YOU CLICKED HERE --'Then, you need to show what files (if any) are present in the clicked line folder --'The path to the directory is simply Global SourceDirectory$ + "\Program Files" --'''''''''''''''''''''''''''''''''''''''''''''' --'e.g. --'--Program Files <--------------------YOU CLICKED HERE Global LineNumberClicked put the second word of the mouseline into LineNumberClicked Global ItemClicked$ put the value of the clickLine into ItemClicked$ Global SourceDirectory$ put char 3 to -1 of ItemClicked$ into EndBlock$ put SourceDirectory$ into DriveEtcBit$ If char -1 of DriveEtcBit$ = "\" Then put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$ end if put (DriveEtcBit$ & "\" & EndBlock$) into PathToLineClicked$ put PathToLineClicked$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" --'Show files straight away: put empty into field "List2" put empty into field "ListFilesField" of card "Card3" set the defaultFolder to PathToLineClicked$ put the files into field "ListFilesField" of card "Card3" call filter_out_files ------------------------------- sort lines of field "ListFilesField" of card "Card3" if field "ListFilesField" of card "Card3" is not empty then put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" end if --ShownAllFilesNIB: --'''''''''''''''''''''''''''' --'--Program Files <--------------------YOU CLICKED HERE --' +Accessories --' +Adaptec --' --Adobe --' --Acrobat 5.0 --' +Help --' --Reader --'   ActiveX --'   Browser --'   JavaScripts --'   Legal --'   Optional --' --plug_ins --'   InterTrust --'   Movie --' +WEBBUY --'+rebol --'The task here is simply to remove everything following the line clicked up to (but --'not including) +rebol and to change the line clicked from minus to plus: --'LineNumberClicked --'ItemClicked$ --'EndBlock$ (no --) --'NewLineClicked$ put empty into field "List3" of card "Card1" put 0 into n if LineNumberClicked > 0 then repeat for (LineNumberClicked -1) times put (n + 1) into n put line n of field "List1" into LineToAdd put (field "List3" & return & LineToAdd) into field "List3" end repeat delete line 1 of field "List3" --************* end if --CopiedUpToLineBeforeLineClickedNIB: --'Change the line clicked from minus to plus and copy it: put ("+" & EndBlock$) into NewLineClicked$ put (field "List3" & return & NewLineClicked$) into field "List3" --'Remove all following lines until you find another line with no blanks on the LHS --'OR EOF: put LineNumberClicked into ThisLineNumber repeat forever put (ThisLineNumber + 1) into ThisLineNumber If the first char of line ThisLineNumber of field "List1" <> space then exit repeat if ThisLineNumber = the number of lines in field "List1" then exit repeat end repeat if ThisLineNumber < the number of lines in field "List1" then put (ThisLineNumber - 1) into n put (field "List3" & return) into field "List3" repeat forever put (n + 1) into n put line n of field "List1" into ThisItem$ put (field "List3" & ThisItem$ & return) into field "List3" if n = the number of lines in field "List1" then exit repeat end repeat end if --CopiedRestOfFileNIB: -------------------------------------------------- if LineNumberClicked = 1 then delete line 1 of field "List3" --************************************* -------------------------------------------------- put field "List3" into field "List1" select line LineNumberClicked of field "List1" Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 end LineClickedWithNoIndentButMinus ----------------------------------------------------------------------------------- on LineClickedWithNoIndentButChr160 --LineClickedWithNoIndentButChr160: --'e.g. --'+Program Files --'+rebol --'+shit --'  shit2 <-----------YOU CLICKED HERE --'+VB1 --'+VisualWx --'+WINDOWS --'+WindowsME.BAK --'--WINICON --'   BIN --' +IPL --'The only action here is to show what files may or may not be present in shit2 --'The path to the directory is simply Global SourceDirectory$ + "\shit2" --'''''''''''''''''''''''''''''''''''''''''''''' --'  shit2 <-----------YOU CLICKED HERE Global LineNumberClicked put the second word of the mouseline into LineNumberClicked Global ItemClicked$ put the the value of the clickLine into ItemClicked$ Global SourceDirectory$ put char 3 to -1 of ItemClicked$ into EndBlock$ put SourceDirectory$ into DriveEtcBit$ If char -1 of DriveEtcBit$ = "\" Then put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$ end if put (DriveEtcBit$ & "\" & EndBlock$) into PathToLineClicked$ put PathToLineClicked$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" --'Show files straight away: put empty into field "List2" put empty into field "ListFilesField" of card "Card3" set the defaultFolder to PathToLineClicked$ put the files into field "ListFilesField" of card "Card3" call filter_out_files sort lines of field "ListFilesField" of card "Card3" if field "ListFilesField" of card "Card3" is not empty then put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" end if --ShownAllFilesChr160: select line LineNumberClicked of field "List1" Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 end LineClickedWithNoIndentButChr160 ----------------------------------------------------------------------------------------------- on LineClickedWithIndent Global LineNumberClicked Global ItemClicked$ put the second word of the mouseline into LineNumberClicked --********** put the the value of the clickLine into ItemClicked$ --********** put ItemClicked$ into TestString$ put word 1 to -1 of TestString$ into TestString$ if the first char of TestString$ is "+" then call LineClickedWithIndentAndPlus if the first char of TestString$ is "-" then call LineClickedWithIndentAndMinus if the charToNum of the first char of TestString$ is 160 then call LineClickedWithIndentAndChr160 --******************************************************************** if the charToNum of the last char of field "List1" = 10 then Global LineNumberClicked delete the last char of field "List1" --************************* select line LineNumberClicked of field "List1" end if --******************************************************************** Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 end LineClickedWithIndent -------------------------------------------------------------- on LineClickedWithIndentAndPlus --LineClickedWithIndentAndPlus: Global LineNumberClicked Global ItemClicked$ put the second word of the mouseline into LineNumberClicked --********** put the the value of the clickLine into ItemClicked$ --********** --SINCE THE ABOVE IS ALSO DONE BY TracebackSubroutine (BELOW), THERE IS NO REAL NEED TO REPEAT IT HERE call TracebackSubroutine Global PathToLineClicked$ Global HDPathToExpand$ put PathToLineClicked$ into HDPathToExpand$ Global InputDirectory$ put HDPathToExpand$ into field "Text1Field" of card "Card3" put word 1 to -1 of field "Text1Field" of card "Card3" into InputDirectory$ Global GotPathAlready put 1 into GotPathAlready call mouseUp of button "GetFolderButton" of card "Card3" --'************************************* put empty into field "List3" of card "Card1" put 0 into n repeat until n = LineNumberClicked -1 --Corrected (-1 now included) put n + 1 into n put ((field "List3" of card "Card1") & (line n of field "List1" of card "Card1") & return) into field "List3" of card "Card1" end repeat --'ItemClicked$ --'e.g. +Application Data --'PathBlock$ --'e.g. Application Data Global PathBlock$ --**** put (the number of characters in ItemClicked$ - the number of characters in PathBlock$ - 1) into NumberOfBlanks put empty into LHSBlanks$ put 0 into n repeat until n = NumberOfBlanks put n + 1 into n put LHSBlanks$ & space into LHSBlanks$ end repeat put LHSBlanks$ & "--" & PathBlock$ into NewItemClicked$ put field "List3" of card "Card1" & NewItemClicked$ & return into field "List3" of card "Card1" Global IndentSize put 0 into n put empty into PrecedingSpaces$ repeat until n = IndentSize put n + 1 into n put (PrecedingSpaces$ & space) into PrecedingSpaces$ end repeat ------------------------------------------------------- --PATCH Global LHSIndentInBlankChars put 0 into n put empty into PrecedingSpaces$ repeat until n = LHSIndentInBlankChars put n + 1 into n put (PrecedingSpaces$ & space) into PrecedingSpaces$ end repeat ------------------------------------------------------- put 0 into n delete the first line of field "ListExpandedField" of card "Card3" --********************** repeat until n = the number of lines in field "ListExpandedField" of card "Card3" put n + 1 into n put line n of field "ListExpandedField" of card "Card3" into ThisItem$ put (PrecedingSpaces$ & ThisItem$) into ThisItem$ put ((field "List3" of card "Card1") & ThisItem$ & return) into field "List3" of card "Card1" end repeat if the number of lines in field "List1" of card "Card1" > LineNumberClicked then put LineNumberClicked into n repeat until n = the number of lines in field "List1" of card "Card1" put n + 1 into n put line n of field "List1" of card "Card1" into ThisItem$ put ((field "List3" of card "Card1") & ThisItem$ & return) into field "List3" of card "Card1" end repeat end if --NewTreeNowMountedB: put empty into field "List1" of card "Card1" put 0 into n repeat until n = the number of lines in field "List3" of card "Card1" put n + 1 into n put line n of field "List3" of card "Card1" into ThisItem$ Put field "List1" of card "Card1" & ThisItem$ & return into field "List1" of card "Card1" end repeat put HDPathToExpand$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" put empty into field "List2" of card "Card1" if the number of lines in field "ListFilesField" of card "Card3" > 0 then put 0 into n repeat until n = the number of lines in field "ListFilesField" of card "Card3" put n + 1 into n put line n of field "ListFilesField" of card "Card3" into ThisItem$ put field "List2" of card "Card1" & ThisItem$ & return into field "List2" of card "Card1" end repeat end if --FilesAllListedB: select line LineNumberClicked of field "List1" of card "Card1" ------------------------------------------------------ Global InputDirectory$ put field "Text2" of card "Card1" into InputDirectory$ set the label of this stack to field "Text2" of card "Card1" put empty into field "ListFilesField" of card "Card3" set the defaultFolder to InputDirectory$ put the files into field "ListFilesField" of card "Card3" call filter_out_files sort lines of field "ListFilesField" of card "Card3" put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" --*********** select line LineNumberClicked of field "List1" of card "Card1" ------------------------------------------------------ end LineClickedWithIndentAndPlus -------------------------------------------------------------- on LineClickedWithIndentAndMinus --'e.g. --'--Program Files --' +Accessories --' +Adaptec --' --Adobe --' --Acrobat 5.0 --' +Help --' --Reader <--------------------YOU CLICKED HERE --'   ActiveX --'   Browser --'   JavaScripts --'   Legal --'   Optional --' --plug_ins --'   InterTrust --'   Movie --' +WEBBUY --'+rebol --'What you need to do here is to remove everything up to (but not including) --'EVERYTHING WITH A GREATER NUMBER OF INDENTS THAN THE LINE CLICKED until you --'find a line of equal or lesser indent. --'Then you need to change the line clicked into --' +Reader <--------------------YOU CLICKED HERE --'and show what files (if any) it contains. --'HOWEVER: --'You do not know what the path to "Reader" is. You need to do a TRACEBACK in order --'to discover the path. This can be done at any time before attempting to show --'the files. --'''''''''''''''''''''''''''''''''''''''''''' Global LineNumberClicked Global ItemClicked$ put the second word of the mouseline into LineNumberClicked --********** put the the value of the clickLine into ItemClicked$ --********** --SINCE THE ABOVE IS ALSO DONE BY TracebackSubroutine (BELOW), THERE IS NO REAL NEED TO REPEAT IT HERE call TracebackSubroutine --'e.g. c:\Program Files\-Adobe Global PathToLineClicked$ --'Rather than mess with the traceback routine itself, it is easier to remove the --'incorrect "-" here: put ((the number of chars in PathToLineClicked$) + 1) into n repeat until n = 1 put n - 1 into n put char n of PathToLineClicked$ into ThisChar$ if ThisChar$ = "\" then exit repeat end repeat put n into LastBackslashPos --e.g. PathToLineClicked$ = c:\francis\-posto --N.B. minus sign in front of posto put char 1 to LastBackslashPos of PathToLineClicked$ into LeftBit$ put char (LastBackslashPos + 2) to -1 of PathToLineClicked$ into RightBit$ put LeftBit$ & RightBit$ into PathToLineClicked$ put PathToLineClicked$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" --'''''''''''''''''''''''''''''''''''''''''''' --'What you need to do here is to remove everything up to (but not including) --'EVERYTHING WITH A GREATER NUMBER OF INDENTS THAN THE LINE CLICKED until you --'find a line of equal or lesser indent. --'Then you need to change the line clicked into --' +Reader <--------------------YOU CLICKED HERE --'and show what files (if any) it contains. --'''''''''''''''''''''''''''''''''''''''''''' --'Copy up to line before the one clicked: put empty into field "List3" of card "Card1" if LineNumberClicked > 0 then put 0 into n repeat until n = LineNumberClicked - 1 put n + 1 into n put line n of field "List1" of card "Card1" into ThisItem$ put field "List3" of card "Card1" & ThisItem$ & return into field "List3" of card "Card1" end repeat end if --NOTE THAT IN LIST 3, CURSOR IS PLACED AT LINE LineNumberClicked --CopiedUpToLineBeforeLineClickedIM: --'Now change -- into + and copy the line clicked: --'e.g. --' --Reader <--------------------YOU CLICKED HERE put word 1 to -1 of ItemClicked$ into ItemClickedWithoutLHSblanks$ put ((the number of chars in ItemClicked$) - (the number of chars in ItemClickedWithoutLHSblanks$)) into NumberOfBlanksOnLHSItemClicked put ItemClickedWithoutLHSblanks$ into ItemClicked$ put char 3 to -1 of ItemClicked$ into ItemClicked$ put empty into LHSBlanks$ put 0 into n repeat until n = NumberOfBlanksOnLHSItemClicked put n + 1 into n put LHSBlanks$ & space into LHSBlanks$ end repeat put LHSBlanks$ & "+" & ItemClicked$ into ItemClicked$ --'e.g. --' +Reader <--------------------YOU CLICKED HERE put ((field "List3" of card "Card1") & (ItemClicked$)) into field "List3" of card "Card1" --'What you need to do here is to remove everything up to (but not including) --'EVERYTHING WITH A GREATER NUMBER OF INDENTS THAN THE LINE CLICKED until you --'find a line of equal or lesser indent OR EOF. repeat with n = (LineNumberClicked + 1) to (the number of lines in field "List1" of card "Card1") put line n of field "List1" of card "Card1" into ThisItem$ put word 1 to -1 of ThisItem$ into ThisItemWithoutLHSBlanks$ put the number of chars in ThisItem$ - the number of chars in ThisItemWithoutLHSBlanks$ into NumberOfBlanksOnLHS If NumberOfBlanksOnLHS <= NumberOfBlanksOnLHSItemClicked Then exit repeat end repeat --FoundLineWithEqualOrLesserNumberOfIndentsIM: --'Copy rest of list: if n < the number of lines in field "List1" of card "Card1" then put field "List3" of card "Card1" & return into field "List3" of card "Card1" --*********************************** put n - 1 into n repeat until n = ((the number of lines in field "List1" of card "Card1") -1) put n + 1 into n put line n of field "List1" of card "Card1" into ThisItem$ put field "List3" of card "Card1" & ThisItem$ & return into field "List3" of card "Card1" end repeat put ((field "List3" of card "Card1") & (the last line of field "List1" of card "Card1")) into field "List3" of card "Card1" --i.e. the last line copied does not have return after it end if --CopiedRestOfListIM: put field "List3" of card "Card1" into field "List1" of card "Card1" --'Show what files (if any) ItemClicked$ contains put empty into field "List2" ------------------------------------------------------ Global InputDirectory$ put field "Text2" of card "Card1" into InputDirectory$ set the label of this stack to field "Text2" of card "Card1" put empty into field "ListFilesField" of card "Card3" set the defaultFolder to InputDirectory$ put the files into field "ListFilesField" of card "Card3" call filter_out_files sort lines of field "ListFilesField" of card "Card3" select line LineNumberClicked of field "List1" of card "Card1" ------------------------------------------------------ if the number of lines of field "ListFilesField" of card "Card3" = 0 then pass LineClickedWithIndentAndMinus end if put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" --ShownAllFilesIM: end LineClickedWithIndentAndMinus -------------------------------------------------------------- on LineClickedWithIndentAndChr160 --'e.g. --'+WINDOWS --'+WindowsME.BAK --'--WINICON --'   BIN <--------------------YOU CLICKED HERE --' +IPL --'You just need to show what files (if any) the clicked directory contains. --'HOWEVER: --'You do not know what the path to "BIN" is. You need to do a TRACEBACK in order --'to discover the path. This needs to be done before attempting to show --'the files. --''''''''''''''''''''''''''''''''''''''''''' Global LineNumberClicked Global ItemClicked$ put the second word of the mouseline into LineNumberClicked --********** put the the value of the clickLine into ItemClicked$ --********** --SINCE THE ABOVE IS ALSO DONE BY TracebackSubroutine (BELOW), THERE IS NO REAL NEED TO REPEAT IT HERE call TracebackSubroutine --'Output is PathToLineClicked$ Global PathToLineClicked$ --'e.g. --'c:\Program Files\Adobe\Acrobat 5.0\Reader\ Browser --'This has an incorrect Chr$(160) inserted in the last path block. --'Rather than mess with the traceback routine itself, it is easier to remove the --'incorrect chr(160) here: put ((the number of chars in PathToLineClicked$) + 1) into n repeat until n = 1 put n - 1 into n put char n of PathToLineClicked$ into ThisChar$ if ThisChar$ = "\" then exit repeat end repeat put n into LastBackslashPos --e.g. PathToLineClicked$ = c:\francis\ posto --N.B. chr$(160) sign in front of posto put char 1 to LastBackslashPos of PathToLineClicked$ into LeftBit$ put char (LastBackslashPos + 2) to -1 of PathToLineClicked$ into RightBit$ put LeftBit$ & RightBit$ into PathToLineClicked$ put PathToLineClicked$ into field "Text2" of card "Card1" set the label of this stack to field "Text2" of card "Card1" ------------------------------------------------------ Global InputDirectory$ put field "Text2" of card "Card1" into InputDirectory$ put empty into field "List2" of card "Card1" --********************************** put empty into field "ListFilesField" of card "Card3" set the defaultFolder to InputDirectory$ put the files into field "ListFilesField" of card "Card3" call filter_out_files sort lines of field "ListFilesField" of card "Card3" select line LineNumberClicked of field "List1" of card "Card1" ------------------------------------------------------ if the number of lines of field "ListFilesField" of card "Card3" = 0 then pass LineClickedWithIndentAndChr160 end if put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" end LineClickedWithIndentAndChr160 --'#################################################################################### on TracebackSubroutine Global LineNumberClicked Global ItemClicked$ put the second word of the mouseline into LineNumberClicked put the the value of the clickLine into ItemClicked$ put 0 into n put empty into field "traceback_txt" of card "Card2" repeat until n = LineNumberClicked put (n + 1) into n put ((field "traceback_txt" of card "Card2") & (line n of field "List1" of card "Card1") & return) into field "traceback_txt" of card "Card2" end repeat Global SourceDirectory$ put SourceDirectory$ into field "TextSourceDirectory" of card "Card2" call Do_Traceback --'e.g. +Help Global PathBlock$ --*** put word 1 to -1 of ItemClicked$ into tempString$ put tempString$ into PathBlock$ put char 2 to -1 of PathBlock$ into PathBlock$ --*****************************corrected******* Global PathToLineClicked$ put field "TextPath" of card "Card2" & "\" & PathBlock$ into PathToLineClicked$ end TracebackSubroutine --'#################################################################################### on Do_Traceback put 0 into n --***************** LabelBlock0 NO LONGER DELETED repeat until n = 30 put (n + 1) into n if exists(field ("LabelBlock" & n) of card "Card2") then delete field ("LabelBlock" & n) of card "Card2" --NOTE THAT THIS ALSO DELETES THE ORIGINAL LabelBlock0 field end if end repeat put empty into field "List1" of card "Card2" put 0 into Counter repeat until Counter = the number of lines in field "traceback_txt" of card "Card2" put (Counter + 1) into Counter put ((field "List1" of card "Card2") & (line Counter of field "traceback_txt" of card "Card2") & return) into field "List1" of card "Card2" end repeat put Counter into NumberOfLinesInTracebackFile --'It is the last line in this file that needs to be traced back put Counter into field "LabelNumberOfLinesInTracebackFile" of card "Card2" put Counter into LastLineListNumber put LastLineListNumber into field "LabelLastLineListNumber" of card "Card2" put 0 into Counter put 0 into n repeat until n = LastLineListNumber put n + 1 into n put line n of field "List1" of card "Card2" into ThisItem$ if char 1 of ThisItem$ <> " " Then put n into Counter end if end repeat put Counter into TracebackLineNumber put TracebackLineNumber into field "LabelTracebackLineNumber" of card "Card2" put Counter into TracebackListNumber put TracebackListNumber into field "LabelTracebackListNumber" of card "Card2" put the last line of field "List1" of card "Card2" into LastLineInTracebackFile$ put word 1 to -1 of LastLineInTracebackFile$ into trimmedString$ put ((the number of chars in LastLineInTracebackFile$) - (the number of chars in trimmedString$)) into NumberOfBlanksOnLHSOfLastLineInTracebackFile --'************************************************************************************** put NumberOfBlanksOnLHSOfLastLineInTracebackFile + 1 into NumberOfBlanksOnLHSOfLastLineInTracebackFile --'THE ADDITION OF 1 TO THIS VALUE IS SIMPLY TO MAKE SURE THE PROGRAM DETECTS THE --'DIFFERENCE IN INDENT in relation to the previous item being traced back --'(see also correction at ###). --'************************************************************************************** put NumberOfBlanksOnLHSOfLastLineInTracebackFile - 1 into NumberOfPrecedingBlanksPreviousLine --'The above compensates for the "artificial" adjustment of 1 made immediately above, --'OTHERWISE THE "ERROR" IS CARRIED FORWARD IN NumberOfPrecedingBlanksPreviousLine --'AND CONTINUES GROWING!!!!! put 0 into Counter ---------------------------------------- repeat with c = LastLineListNumber down to TracebackListNumber put line c of field "List1" of card "Card2" into ThisItem$ --**************************************************** --SOMEHOW OR OTHER, BLANKS ARE GETTING PUT ON THE RHS OF --ThisItem$, causing this routine not to be executed --correctly. Until the cause is found, the following --patch simply lops off the blanks put char 1 to length(word 1 to -1 of ThisItem$) + (offset(word 1 of ThisItem$, ThisItem$) - 1) of ThisItem$ into ThisItem$ --**************************************************** put word 1 to -1 of ThisItem$ into trimmedItem$ put ((the number of chars in ThisItem$) - (the number of chars in trimmedItem$)) into NumberOfPrecedingBlanksThisLine put trimmedItem$ into ThisItem$ if char 1 to 2 of ThisItem$ = "--" And NumberOfPrecedingBlanksThisLine < NumberOfPrecedingBlanksPreviousLine Then put NumberOfPrecedingBlanksThisLine into NumberOfPrecedingBlanksPreviousLine put Counter + 1 into Counter clone field "LabelBlock0" of card "Card2" set the name of it to ("LabelBlock" & Counter) --***************************************************************************** set the visible of field ("LabelBlock" & Counter) of card "Card2" to true --PROBABLY NOT NEC set the left of field ("LabelBlock" & Counter) of card "Card2" to (the left of field ("LabelBlock" & (Counter -1)) of card "Card2" + the width of field ("LabelBlock" & (Counter -1)) of card "Card2") set the top of field ("LabelBlock" & Counter) of card "Card2" to the top of field "LabelBlock0" of card "Card2" put char 3 to -1 of ThisItem$ into field ("LabelBlock" & Counter) of card "Card2" end if end repeat put field "TextSourceDirectory" of card "Card2" into field "LabelBlock0" of card "Card2" --'Blocks 1 onwards are in the wrong order, so reverse them to make the path: put field "LabelBlock0" of card "Card2" into OutputPath$ if the last char of OutputPath$ <> "\" Then put OutputPath$ & "\" into OutputPath$ ------------------------------------------------------------------ repeat with c = Counter down to 1 put OutputPath$ & field ("LabelBlock" & c) of card "Card2" & "\" into OutputPath$ end repeat ------------------------------------------------------------------ put char 1 to -2 of OutputPath$ into OutputPath$ put OutputPath$ into field "TextPath" of card "Card2" end Do_Traceback --'#################################################################################### on filter_out_files put the selectedText of button "Filters" of card "Card1" into currentSelectedFilter$ --e.g. *.* All files if (word 1 of currentSelectedFilter$ <> "*.*") and (the number of lines of field "ListFilesField" of card "Card3" > 0) then put word 1 of currentSelectedFilter$ into FilterSelected$ --e.g. *.* repeat with n = 1 to the number of chars in FilterSelected$ put char n of FilterSelected$ into ThisChar$ if ThisChar$ = "." then exit repeat end repeat put n into dotPosition put char dotPosition to -1 of FilterSelected$ into dotAndSuffixOfCurrentFilter$ put toLower(dotAndSuffixOfCurrentFilter$) into LowerCasedotAndSuffixOfCurrentFilter$ put empty into field "FilteredFiles" of card "Card3" repeat with n = 1 to the number of lines of field "ListFilesField" of card "Card3" put line n of field "ListFilesField" of card "Card3" into ThisLine$ put toLower(ThisLine$) into LowerCaseThisLine$ --e.g. tomas.JPG -- N.B. Capital letters --IF YOU DELETE LINES DURING THIS REPEAT, YOU MAY HAVE CONFUSION RE-DEFINING ThisLine$ CORRECTLY. --IT MIGHT BE SAFER TO CREATE A NEW FIELD. if matchChunk(LowerCaseThisLine$, LowerCasedotAndSuffixOfCurrentFilter$) is true and LowerCaseThisLine$ <> "" then put (the number of chars in LowerCasedotAndSuffixOfCurrentFilter$) into SuffixLength put (-1 * SuffixLength) into SuffixLength put 1 into MatchIsOK repeat with s = SuffixLength down to -1 -- or DOWN to ??? put char s of LowerCaseThisLine$ into a put char s of LowerCasedotAndSuffixOfCurrentFilter$ into b if a <> b then put 0 into MatchIsOK end repeat if MatchIsOK = 1 then put field "FilteredFiles" of card "Card3" & ThisLine$ & return into field "FilteredFiles" of card "Card3" end if end if end repeat --delete the last char (return) of field "FilteredFiles": if the charToNum of the last char of field "FilteredFiles" of card "Card3" = 10 then delete the last char of field "FilteredFiles" of card "Card3" end if put field "FilteredFiles" of card "Card3" into field "ListFilesField" of card "Card3" end if end filter_out_files ------------------------------------------- €2Api cREVGeneral@scriptChecksum"Žß”»¡GN _]ëó$õw bookmarks revUniqueID 1118793781548 handlerList.rawKeyDown mouseDown LineClickedWithNoIndent LineClickedWithNoIndentButPlus LineClickedWithNoIndentButMinus LineClickedWithNoIndentButChr160 LineClickedWithIndent LineClickedWithIndentAndPlus LineClickedWithIndentAndMinus LineClickedWithIndentAndChr160 TracebackSubroutine Do_Traceback filter_out_filesscriptSelectionchar 39471 to 39470 prevHandlermouseUp tempScriptscript}p

on rawKeyDown

end rawKeyDown

on mouseDown

disable button "OK" of card "Card1"

Global DoingSelect

If DoingSelect = 1 Then pass mouseDown

--'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

--'When the operator clicks on a line with "+" WITH SOME INDENT

--'1) Save the tree up to and including the clicked line in traceback.txt

--'2) Set the SourceDirectory$ (see original program) and run the traceback module.

--'3) Note the HDpath (to the line clicked)

--'4) Input the ENTIRE HDpath from above to the Expand Folder module

--'5) This module produces a new segment (with the expanded folders) to be included

--'in the tree immediately after the line with "+" that was clicked.

--'6) Put the traceback.txt data from 1), the new segment data from 5) and the rest

--'of the treefile after the "+" line that was clicked all together to form a new treefile.

--'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

--'When the operator clicks on a line with "+" WITH NO INDENT

--'a) Deduce the path to the line clicked from the line clicked itself

--'b) Continue for 4) above

--'c) When copying back the data in step 6), a single indent will be needed in the

--'new segment

--'**************************************************************************************

Global LineNumberClicked

put the second word of the mouseline into LineNumberClicked

Global ItemClicked$

put the the value of the clickLine into ItemClicked$

if char 1 of ItemClicked$ <> " " Then

call LineClickedWithNoIndent

pass mouseDown

end if

if char 1 of ItemClicked$ = " " then

call LineClickedWithIndent

pass mouseDown

end if

pass mouseDown

end mouseDown

on LineClickedWithNoIndent

Global ItemClicked$

if char 1 of ItemClicked$ = "+" Then

call LineClickedWithNoIndentButPlus

--********************************************************************

if the charToNum of the last char of field "List1" = 10 then

delete the last char of field "List1" --*************************

Global LineNumberClicked

select line LineNumberClicked of field "List1"

end if

--********************************************************************

pass LineClickedWithNoIndent

end if

if char 1 of ItemClicked$ = "-" Then

call LineClickedWithNoIndentButMinus

--********************************************************************

if the charToNum of the last char of field "List1" = 10 then

Global LineNumberClicked

delete the last char of field "List1" --*************************

select line LineNumberClicked of field "List1"

end if

--********************************************************************

pass LineClickedWithNoIndent

end if

if char 1 of ItemClicked$ = numtochar(160) then

call LineClickedWithNoIndentButChr160

--********************************************************************

if the charToNum of the last char of field "List1" = 10 then

Global LineNumberClicked

delete the last char of field "List1" --*************************

select line LineNumberClicked of field "List1"

end if

--********************************************************************

pass LineClickedWithNoIndent

end if

end LineClickedWithNoIndent

-----------------------------------------------------------------------------------

on LineClickedWithNoIndentButPlus

Global PathBlock$

Global SourceDirectory$

Global ItemClicked$

Global HDPathToExpand$

put char 2 to -1 of ItemClicked$ into PathBlock$

If char -1 of SourceDirectory$ = "\" Then

put SourceDirectory$ & PathBlock$ into HDPathToExpand$

Else

put SourceDirectory$ & "\" & PathBlock$ into HDPathToExpand$

End If

Global InputDirectory$

put HDPathToExpand$ into field "Text1Field" of card "card3"

put word 1 to -1 of field "Text1Field" of card "card3" into InputDirectory$

Global GotPathAlready

put 1 into GotPathAlready

call mouseUp of button "GetFolderButton" of card "card3"

put empty into field "List3"

Global LineNumberClicked

if LineNumberClicked = 1 then

--put line 1 of field "List1" into field "List3"

------------------------------------------------

--put ("--" & (char 2 to -1 of line 1 of field "List1")) into field "List3" --**********************************

------------------------------------------------

end if

put 0 into n

repeat (LineNumberClicked -1) times

put n + 1 into n

put line n of field "List1" into ThisItem$

put field "List3" & ThisItem$ & return into field "List3"

end repeat

Global PathBlock$

put "--" & PathBlock$ into NewItemClicked$

put field "List3" & NewItemClicked$ into field "List3"

Global IndentSize

put 0 into n

repeat until n = the number of lines of field "ListExpandedField" of card "Card3"

put n + 1 into n

put line n of field "ListExpandedField" of card "Card3" into ThisItem$

put 0 into c

if IndentSize > 0 then

repeat until c = IndentSize

put c + 1 into c

put space & ThisItem$ into ThisItem$

end repeat

end if