REVO2700 ! FileChooser 3 @ on closeStackRequest end closeStackRequest on preOpenStack -- center the stack on the main screen global driveInUse put "hd" into driveInUse --FOR HIDDEN TOGGLE REFRESH --************************ set the minWidth of this stack to 320 set the minHeight of this stack to 240 --*********************** Global MyDir put the defaultfolder into MyDir --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ----answer "$0 directory = " & $0 & " MyDir = " & MyDir with "OK" --TEMP ONLY @@@@@@@@@@@@@@@ --E.G. $0 = /host/_Proj_2011_D/software/linux/ubuntu File Chooser POST MEDIABASE CORRECTION/ubuntu_file_chooser_47.rev set the itemDelimiter to "/" put $0 into temp delete the last item of temp --delete char - 1 of temp set the defaultFolder to temp put temp into myDir --answer "$0 directory = " & $0 & " MyDir = " & MyDir with "OK" --TEMP ONLY @@@@@@@@@@@@@@@ --THE ABOVE IS DESIGNED TO MAKE SURE THE PROJECT STARTS UP WITH THE DEFAULT FOLDER --SET TO THE PROJECT FOLDER ITSELF --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 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 wait 2 --@@@@@@@@@@@@@@@@ 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 call adjust_for_folder_chooser 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 show_drives get_ini_parameters -------------------------------------------- call adjust_for_folder_chooser -------------------------------------------- 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 put field "List1" of card "Card1" into field "plain" of card "Card1" --NEW******************* call prettify_List1 of this stack 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 WidgetWidth --@@@@@@@@@@@ global WidgetHeight --@@@@@@@@@@@@ Global AdjustingWindow if AdjustingWindow = 1 then pass get_ini_parameters Global SourceDirectory$ Global CDDirectory$ --NEW FOR UNIVERSAL EDITION Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION 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. Windows only c:\): --In Linux, startup folders can begin as follows: --/ --/media/floppy0 or just "floppy" or "diskette" --/media/cdrom0 or just "cd" or "cdrom" --In the above optional startup drive specifications, you need to check for UCase, trailing slashes, etc. --Specifications such as floppy/subfolder should not be permitted. These should be specified as /media/floppy0/subfolder --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$ if the charToNum of the last char of SourceDirectory$ is 13 then --LINUX only put char 1 to -2 of SourceDirectory$ into SourceDirectory$ end if --/ --/media/floppy0 or just "floppy" or "diskette" --/media/cdrom0 or just "cd" or "cdrom" --Changed for UBUNTU later versions: --if toLower(SourceDirectory$) = "floppy" then put "/media/floppy0" into SourceDirectory$ --if toLower(SourceDirectory$) = "diskette" then put "/media/floppy0" into SourceDirectory$ --if toLower(SourceDirectory$) = "cd" then put "/media/cdrom0" into SourceDirectory$ --if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom0" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/floppy0/" then put "/media/floppy0" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/cdrom0/" then put "/media/cdrom0" into SourceDirectory$ --if toLower(SourceDirectory$) = "floppy" then put "/media/floppy" into SourceDirectory$ --if toLower(SourceDirectory$) = "diskette" then put "/media/floppy" into SourceDirectory$ --if toLower(SourceDirectory$) = "cd" then put "/media/cdrom" into SourceDirectory$ --if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/floppy/" then put "/media/floppy" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/cdrom/" then put "/media/cdrom" into SourceDirectory$ --------------------------------------------------------------------------------------------------------- --REMOVED IN UNIVERSAL EDITION: --if toLower(SourceDirectory$) = "floppy" then put "/media/fd0" into SourceDirectory$ --if toLower(SourceDirectory$) = "diskette" then put "/media/fd0" into SourceDirectory$ --if toLower(SourceDirectory$) = "cd" then put "/media/cdrom" into SourceDirectory$ --if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/floppy/" then put "/media/fd0" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/fd0/" then put "/media/fd0" into SourceDirectory$ --if toLower(SourceDirectory$) = "/media/cdrom/" then put "/media/cdrom" into SourceDirectory$ -------------------------------------------------------------------------------------------------------- --Global CDDirectory$ --NEW FOR UNIVERSAL EDITION --Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION put line 2 of field "IniParametersField" of card "Card4" of this stack into CDDirectory$ --NEW FOR UNIVERSAL EDITION put line 3 of field "IniParametersField" of card "Card4" of this stack into FloppyDirectory$ --NEW FOR UNIVERSAL EDITION if the charToNum of the last char of CDDirectory$ is 13 then --LINUX only put char 1 to -2 of CDDirectory$ into CDDirectory$ end if if the charToNum of the last char of FloppyDirectory$ is 13 then --LINUX only put char 1 to -2 of FloppyDirectory$ into FloppyDirectory$ end if -------------------------------------------------------------------------------------------------------- --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --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 line 4 of field "IniParametersField" of card "Card4" of this stack into IndentSize --e.g. 8 IndentSize put line 5 of field "IniParametersField" of card "Card4" of this stack into TreeFontname$ --e.g. "Arial" TreeFontname$ put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontsize --e.g. 12 TreeFontsize put line 7 of field "IniParametersField" of card "Card4" of this stack into TreeFontbold$ --e.g. "yes" TreeFontbold$ put line 8 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$ ------------------------------------------------------------------------------------------------------ if the charToNum of the last char of IndentSize is 13 then --LINUX only put char 1 to -2 of IndentSize into IndentSize end if if the charToNum of the last char of TreeFontname$ is 13 then --LINUX only put char 1 to -2 of TreeFontname$ into TreeFontname$ end if if the charToNum of the last char of TreeFontsize is 13 then --LINUX only put char 1 to -2 of TreeFontsize into TreeFontsize end if if the charToNum of the last char of TreeFontbold$ is 13 then --LINUX only put char 1 to -2 of TreeFontbold$ into TreeFontbold$ end if if the charToNum of the last char of TreeFontitalic$ is 13 then --LINUX only put char 1 to -2 of TreeFontitalic$ into TreeFontitalic$ end if 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 --LINUX put char 1 to -2 of StartupPath$ into StartupPath$ end if --SourceDirectory$ can be: --"/" --"/media/floppy0/****************" (perhaps with some UCase) --"/media/cdrom0/****************" (perhaps with some UCase) ------------------------------------------------------------------------------------------------------------------------------- --put toLower(SourceDirectory$) into SourceDirectory$ --WRONG! REMOVED FOR UNIVERSAL EDITION ------------------------------------------------------------------------------------------------------------------------------- ----if char 1 to 14 of SourceDirectory$ = "/media/floppy0" then put "/media/floppy0" into SourceDirectory$ ----if char 1 to 13 of SourceDirectory$ = "/media/cdrom0" then put "/media/cdrom0" into SourceDirectory$ ----if char 1 to 14 of SourceDirectory$ <> "/media/floppy0" and char 1 to 13 of SourceDirectory$ <> "/media/cdrom0" then put "/" into SourceDirectory$ ----if char 1 to 13 of SourceDirectory$ = "/media/floppy" then put "/media/floppy" into SourceDirectory$ --if char 1 to 13 of SourceDirectory$ = "/media/floppy" then put "/media/fd0" into SourceDirectory$ --if char 1 to 12 of SourceDirectory$ = "/media/cdrom" then put "/media/cdrom" into SourceDirectory$ ----if char 1 to 13 of SourceDirectory$ <> "/media/floppy" and char 1 to 12 of SourceDirectory$ <> "/media/cdrom" then put "/" into SourceDirectory$ --if char 1 to 10 of SourceDirectory$ <> "/media/fd0" and char 1 to 12 of SourceDirectory$ <> "/media/cdrom" then put "/" into SourceDirectory$ --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 "/" into SourceDirectory$ --LINUX if IndentSize = "" then put 4 into IndentSize if TreeFontname$ = "" then put "default" into TreeFontname$ if TreeFontsize = "" then put 14 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 textFont of field "suggestedFileName" to TreeFontname$ --REMOVED 23/06/2011 set the textFont of field "suggestedFileName" to "Default" --23/06/2011 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 --set the textSize of field "suggestedFileName" to TreeFontsize --REMOVED 23/06/2011 set the textSize of field "suggestedFileName" to 14 --23/06/2011 --@@@@@@@@@@@@@@@ 14/06/2011 @@@@@@@@@@@@@@@@@@@ set the textStyle of field "List1" to "plain" set the textStyle of field "List2" to "plain" set the textStyle of field "suggestedFileName" to "plain" --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 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" set the textStyle of field "suggestedFileName" 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" set the textStyle of field "suggestedFileName" 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" set the textStyle of field "suggestedFileName" to "bold,italic" end if set the height of field "suggestedFileName" to the textheightSum of field "suggestedFileName" --NEW --SourceDirectory$ can be: --"/" --"/media/floppy0" --"/media/cdrom0" put SourceDirectory$ into tempVar -- tempVar can be: --"/" --"/media/floppy0" --"/media/cdrom0" ----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): ---------------------------------------------------------------------------------------------------------------- --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --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 line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetLeftPosition put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetTopPosition put line 11 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth put line 12 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight Global OutputMode$ put line 13 of field "IniParametersField" of card "Card4" of this stack into OutputMode$ --------------------------------------------------------------------------------------------------------------- if the charToNum of the last char of WidgetLeftPosition is 13 then --LINUX only put char 1 to -2 of WidgetLeftPosition into WidgetLeftPosition end if if the charToNum of the last char of WidgetTopPosition is 13 then --LINUX only put char 1 to -2 of WidgetTopPosition into WidgetTopPosition end if if the charToNum of the last char of WidgetWidth is 13 then --LINUX only put char 1 to -2 of WidgetWidth into WidgetWidth end if if the charToNum of the last char of WidgetHeight is 13 then --LINUX only put char 1 to -2 of WidgetHeight into WidgetHeight end if if the charToNum of the last char of OutputMode$ is 13 then --LINUX only put char 1 to -2 of OutputMode$ into OutputMode$ end if 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 -------------------------------- global temp1 global temp2 Global AdjustingWindow put 1 into AdjustingWindow call check_max_and_min --put 0 into AdjustingWindow -------------------------------- 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 temp1 <> "max" then set the width of this stack to WidgetWidth end if if temp2 <> "max" then set the height of this stack to WidgetHeight end if ------------------------------- --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 ------------------------------------------------------- --If WidgetWidth is set to "max" then IGNOR WidgetLeftPosition --If WidgetHeight is set to "max" then IGNOR WidgetTopPosition --------------------------------------------- if WidgetLeftPosition <> "centre" and temp1 <> "max" then set the left of this stack to WidgetLeftPosition end if if WidgetTopPosition <> "centre" and temp2 <> "max" then set the top of this stack to WidgetTopPosition end if ------------- if WidgetLeftPosition = "centre" and temp1 <> "max" then Global ScreenWidth If WidgetWidth > ScreenWidth then put ScreenWidth into WidgetWidth put (ScreenWidth - WidgetWidth) into HorizontalDifference put (HorizontalDifference / 2) into WidgetLeftMargin set the left of this stack to WidgetLeftMargin end if if WidgetTopPosition = "centre" and temp2 <> "max" then Global ScreenHeight If WidgetHeight > ScreenHeight then put ScreenHeight into WidgetHeight put (ScreenHeight - WidgetHeight) into VerticalDifference put (VerticalDifference / 2) into WidgetTopMargin set the top of this stack to WidgetTopMargin end if --breakpoint ------------------------------------------------------- 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 -------------------------------------------------------------------- set the top of button "Cancel" to the top of button "Cancel" + 4 set the top of button "OK" to the top of button "OK" + 4 ------------------------------------------------------------------- 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 image "Root" + 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 image "Root" + 10) set the top of field "List2" to (the bottom of image "Root" + 10) if OutputMode$ <> "hd" and OutputMode$ <> "clipboard" then put "hd" into OutputMode$ end if ----------------------------------------- --global AdjustingWindow put 0 into AdjustingWindow ----------------------------------------- -------------------------------------------------------------------------- -------------------------------------------------------------------------- --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 13 of field "IniParametersField" of card "Card4" of this stack into treeFolderColour put line 15 of field "IniParametersField" of card "Card4" of this stack into treeFolderColour ------------------------------------------------------------------------- --Colours used for folders: --red (default) --blue --cherry --cyan --darkblue --darkbrown --darkgreen --darkgrey --grey --lightbrown --lightgreen --mauve --white --yellow put toLower(treeFolderColour) into treeFolderColour put treeFolderColour into treeFolderColourWithSpaces put empty into treeFolderColour repeat for each char thisChar in treeFolderColourWithSpaces if thisChar is not space then put treeFolderColour & thisChar into treeFolderColour end if end repeat if treeFolderColour = "gray" then put "grey" into treeFolderColour if treeFolderColour = "darkgray" then put "darkgrey" into treeFolderColour --blue --cherry --cyan --darkblue --darkbrown --darkgreen --darkgrey --grey --lightbrown --lightgreen --mauve --white --yellow if treeFolderColour <> "blue" and\ treeFolderColour <> "cherry" and\ treeFolderColour <> "cyan" and\ treeFolderColour <> "darkblue" and\ treeFolderColour <> "darkbrown" and\ treeFolderColour <> "darkgreen" and\ treeFolderColour <> "darkgrey" and\ treeFolderColour <> "grey" and\ treeFolderColour <> "lightbrown" and\ treeFolderColour <> "lightgreen" and\ treeFolderColour <> "mauve" and\ treeFolderColour <> "white" and\ treeFolderColour <> "yellow" then put "red" into treeFolderColour end if --************************** 09/07/2011 *************************************************** --red --blue --cherry --cyan --darkblue --darkbrown --darkgreen --darkgrey --grey --lightbrown --lightgreen --mauve --white --yellow if treeFolderColour = "red" then set the backcolor of field "suggestedFileName" to 255,50,50 set the forecolor of field "suggestedFileName" to 255,255,255 end if if treeFolderColour = "blue" then set the backcolor of field "suggestedFileName" to 77,166,255 set the forecolor of field "suggestedFileName" to 255,255,255 end if if treeFolderColour = "cherry" then set the backcolor of field "suggestedFileName" to 255,49,162 set the forecolor of field "suggestedFileName" to 255,255,255 end if if treeFolderColour = "cyan" then set the backcolor of field "suggestedFileName" to 33,255,255 set the forecolor of field "suggestedFileName" to 0,0,0 end if if treeFolderColour = "darkblue" then set the backcolor of field "suggestedFileName" to 10,47,255 set the forecolor of field "suggestedFileName" to 255,255,255 end if if treeFolderColour = "darkbrown" then set the backcolor of field "suggestedFileName" to 204,109,1 set the forecolor of field "suggestedFileName" to 255,255,255 end if if treeFolderColour = "darkgreen" then set the backcolor of field "suggestedFileName" to 0,191,102 set the forecolor of field "suggestedFileName" to 255,255,255 end if if treeFolderColour = "darkgrey" then set the backcolor of field "suggestedFileName" to 166,165,164 set the forecolor of field "suggestedFileName" to 255,255,255 end if if treeFolderColour = "grey" then set the backcolor of field "suggestedFileName" to 204,204,204 set the forecolor of field "suggestedFileName" to 0,0,0 end if if treeFolderColour = "lightbrown" then set the backcolor of field "suggestedFileName" to 254,138,5 set the forecolor of field "suggestedFileName" to 0,0,0 end if if treeFolderColour = "lightgreen" then set the backcolor of field "suggestedFileName" to 0,253,134 set the forecolor of field "suggestedFileName" to 0,0,0 end if if treeFolderColour = "mauve" then set the backcolor of field "suggestedFileName" to 179,29,255 set the forecolor of field "suggestedFileName" to 255,255,255 end if if treeFolderColour = "white" then set the backcolor of field "suggestedFileName" to 255,255,255 set the forecolor of field "suggestedFileName" to 255,0,0 end if if treeFolderColour = "yellow" then set the backcolor of field "suggestedFileName" to 255,219,44 set the forecolor of field "suggestedFileName" to 0,0,0 end if --****************************************************************************************** --folderPic --folderOpenPic if treeFolderColour <> "red" then put treeFolderColour & "_closed" into closedImageName put treeFolderColour & "_open" into openImageName put image closedImageName into image "folderPic" put image openImageName into image "folderOpenPic" end if -------------------------------------------------------------------------------------------- --For suggested file name (if it exists): --Can be a name or a filter global suggestedFileNameExists -------------------------------------------------------- --put line 14 of field "IniParametersField" of card "Card4" of this stack into suggestedFileNameExists --put suggestedFileNameExists into field "suggestedFileName" global thisIsAFolderChooserWidget global testFileName --------------------------------------------------------------------------------------------------- --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 14 of field "IniParametersField" of card "Card4" of this stack into testFileName put line 16 of field "IniParametersField" of card "Card4" of this stack into testFileName --------------------------------------------------------------------------------------------------- put char 1 to -1 of testFileName into testFileName if toLower(testFileName) = "folder" or toLower(testFileName) = "folder/" then put 1 into thisIsAFolderChooserWidget put empty into suggestedFileNameExists put empty into field "suggestedFileName" set the visible of field "suggestedFileName" to false --21/06/2011 enable button "OK" of card "Card1" else if testFileName is empty then put empty into suggestedFileNameExists put empty into field "suggestedFileName" disable button "OK" of card "Card1" else put testFileName into suggestedFileNameExists put testFileName into field "suggestedFileName" enable button "OK" of card "Card1" end if end if ------------------------------------------- --if suggestedFileNameExists is not empty then --REMOVED 22/06/2011 Position_Controls --end if -------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------- put URL "file:_file_chooser_filters.ini" into field "Filters" of card "Card4" 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 end if put 0 into FilterCounter repeat for each line thisLine in field "Filters" of card "Card4" of this stack --LINUX only put (FilterCounter + 1) into FilterCounter if the charToNum of the last char of thisLine is 13 then put char 1 to -2 of thisLine into newLine$ else put thisLine into newLine$ end if put newLine$ into line FilterCounter of button "Filters" of card "Card1" of this stack --LINUX only end repeat -------------------------------------------------------------------------- -- tempVar can be: --"/" --"/media/floppy0" --"/media/cdrom0" --Global NumberOfDrives --For LINUX, this is between 1 and 3 ------------------------------------------------------------------------ --For LINUX: --Highlight the drive according to tempVar, which can be: --"/" --"/media/floppy0" --"/media/cdrom0" Global GotPathAlready if GotPathAlready <> 1 then remove_all_drivebox_highlights --***************************** Global WidgetFolder$ put the defaultfolder into WidgetFolder$ if the last char of WidgetFolder$ is "/" then put char 1 to -2 of WidgetFolder$ into WidgetFolder$ end if --***************************** If tempVar = "/" then call mouseDown of image "Root" end if --Changed for UBUNTU later versions: --If tempVar = "/media/cdrom0" then --call mouseDown of image "CD" --end if --If tempVar = "/media/floppy0" then --call mouseDown of image "Diskette" --end if -------------------------------------------------------------------- --CHANGED FOR UNIVERSAL EDITION: --If tempVar = "/media/cdrom" then --call mouseDown of image "CD" --end if ----If tempVar = "/media/floppy" then --If tempVar = "/media/fd0" then --call mouseDown of image "Diskette" --end if --Global CDDirectory$ --NEW FOR UNIVERSAL EDITION --Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION put the length of CDDirectory$ into lenCDDirectory put the length of FloppyDirectory$ into lenFloppyDirectory --tempVar can contain the startup folder (from ini file line 1) which may be a subfolder of the main CD/floppy folder --cited in lines 2 or 3. put 0 into cdHasAStartupFolder put 0 into floppyHasAStartupFolder if toLower(char 1 to lenCDDirectory of tempVar) = toLower(CDDirectory$) then put 1 into cdHasAStartupFolder end if if toLower(char 1 to lenFloppyDirectory of tempVar) = toLower(FloppyDirectory$) then put 1 into floppyHasAStartupFolder end if /* if CDDirectory$ is not empty and there is a folder CDDirectory$ and cdHasAStartupFolder = 1 then set the visible of image "CD" to true call mouseDown of image "CD" --TEMP REMOVAL FOR UNIVERSAL EDITION (NECESSARY ANYWAY?) end if if FloppyDirectory$ is not empty and there is a folder FloppyDirectory$ and floppyHasAStartupFolder = 1 then set the visible of image "Diskette" to true call mouseDown of image "Diskette" --TEMP REMOVAL FOR UNIVERSAL EDITION (NECESSARY ANYWAY?) end if */ --RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR --THE 2 CD AND DISKETTE IMAGES ABOVE ARE NOW USED FOR MEDIA GENERALLY. --MAKE THEM VISIBLE REGARDLESS: set the visible of image "CD" to true set the visible of image "Diskette" to true --RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR ----------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------- end if ------------------------------------------------------------------------ put IndentSize into field "TextIndentSizeField" of card "Card3" ------------------------------------------------- call mouseDown of image "Root" of card "Card1" --INCLUDED HERE FOR UNIVERSAL EDITION ------------------------------------------------- put SourceDirectory$ into field "Text2" Global InputDirectory$ --INCLUDED HERE FOR UNIVERSAL EDITION 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 put field "List1" into field "plain" --##### INTRODUCED IN UNIVERSAL EDITION ############### call Patch_To_Remove_Trailing_Blanks of this stack --##### INTRODUCED IN UNIVERSAL EDITION ############### call prettify_List1 of this stack --NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN global widgetPromptFile --e.g. prompt_file.txt global promptParameters --e.g. 2,1 put line 2 of field "IniParametersField" of card "Card4" of this stack into widgetPromptFile --e.g. prompt_file.txt put line 3 of field "IniParametersField" of card "Card4" of this stack into promptParameters --e.g. 2,1 if promptParameters is empty then put "2,1" into promptParameters end if if widgetPromptFile is empty or widgetPromptFile = return then put empty into widgetPromptFile put empty into promptParameters end if Global MyDir if widgetPromptFile is not empty then put url ("file:" & MyDir & "/" & widgetPromptFile) into field "prompt" of card "prompt" --TreeFontname$ set the textFont of field "prompt" of card "prompt" to TreeFontname$ set the textSize of field "prompt" of card "prompt" to 18 /* --formattedWidth: The object must be on the current card of an open stack. get the formattedWidth of field "prompt" of card "prompt" set the width of field "prompt" of card "prompt" to it get the formattedHeight of field "prompt" of card "prompt" set the height of field "prompt" of card "prompt" to it put the width of this stack - the width of field "prompt" of card "prompt" into horizontalMargins put the height of this stack - the height of field "prompt" of card "prompt" into verticalMargins put horizontalMargins / 2 into horizontalMargin put verticalMargins / 2 into verticalMargin put the round of horizontalMargin into horizontalMargin put the round of verticalMargin into verticalMargin set the left of field "prompt" of card "prompt" to horizontalMargin set the top of field "prompt" of card "prompt" to verticalMargin */ end if --widgetPromptFile is not empty --NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN put 1 into get_ini_parameters 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 put image "Root_Blank" into image "Root" put image "CD_Blank" into image "CD" put image "Diskette_Blank" into image "Diskette" 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 end error_reading_diskette on get_startup_folder Global Init if Init = 1 then pass get_startup_folder Global SourceDirectory$ Global StartupPath$ Global InputDirectory$ --PUT EARLIER HERE FOR UNIVERSAL EDITION 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$ --PUT EARLIER FOR UNIVERSAL EDITION (see above) 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 put InputDirectory$ into field "Text1Field" of card "Card3" --InputDirectory$: --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 "/" --LINUX 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" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ put empty into field "ListSubfoldersField" of card "Card3" put the folders into field "ListSubfoldersField" of card "Card3" --########################### CORRECTION ################################ --delete line 1 of field "ListSubfoldersField" of card "Card3" --***************************** --sort lines of field "ListSubfoldersField" of card "Card3" sort lines of field "ListSubfoldersField" of card "Card3" delete line 1 of field "ListSubfoldersField" of card "Card3" --***************************** --########################### CORRECTION ################################ --######################### HIDDEN OPTION ############################ global showHiddenFolders if showHiddenFolders <> 1 then filter field "ListSubfoldersField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListSubfoldersField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListSubfoldersField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListSubfoldersField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN OPTION ############################ --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 --(Windows) --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" --################### CORRECTION ######################################## --delete line 1 of field "TempField" of card "Card3" --********************* --sort lines of field "TempField" of card "Card3" sort lines of field "TempField" of card "Card3" delete line 1 of field "TempField" of card "Card3" --********************* --################### CORRECTION ######################################## --######################### HIDDEN OPTION ############################ global showHiddenFolders if showHiddenFolders <> 1 then filter field "TempField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "TempField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "TempField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "TempField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN OPTION ############################ 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" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ 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 -------------------------------------------------------------------- set the top of button "Cancel" to the top of button "Cancel" + 4 set the top of button "OK" to the top of button "OK" + 4 ------------------------------------------------------------------- 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" ----------------------------------------------- --Alteration: --List2 is now set to the right of List1 - 4 --Width is adjusted so that RH margin is 15 set the left of field "List2" to (the right of field "List1" - 4) set the width of field "List2" to the right of button "OK" - the right of field "List1" + 4 + 7 --The reason for the +7 is not known set the width of field "suggestedFilename" to the width of field "List2" - 3 --PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP --set the left of field "suggestedFilename" to the left of field "List2" set the left of field "suggestedFilename" to the left of field "List2" -1 --PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP ----------------------------------------------- put (the top of button "Filters" - 10) - (the bottom of image "Root" + 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 image "Root" + 10) set the top of field "List2" to (the bottom of image "Root"+ 10) set the right of button "hiddenButton" to the right of field "List2" ---------------------------------------------- --Alteration: global suggestedFileNameExists if suggestedFileNameExists is not empty then set the height of field "List2" to (the height of field "List2" - the height of field "suggestedFileName") --PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP --set the top of field "suggestedFileName" to the bottom of field "List2" -- - 3 ##### --set the right of field "suggestedFileName" to the right of field "List2" --#### set the top of field "suggestedFileName" to the bottom of field "List2" - 1 --##### set the right of field "suggestedFileName" to the right of field "List2" - 1 --#### --PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP set the visible of field "suggestedFileName" to true end if end Position_Controls ---------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------- on prettify_List1 Patch_To_Correct_Indents --Patch_To_Remove_Trailing_Blanks --THIS ROUTINE HAS BEEN REFORMED IN ORDER TO ELIMINATE THE USE OF THE find INSTRUCTIONS: --Under some circumstances they cause a crash. if field "List1" is not empty then --put field "List1" into field "list1Pretty" lock screen --folderClosed 1085 --folderOpen 1089 put 0 into lineCounter repeat for each line thisLine in field "List1" put lineCounter + 1 into lineCounter ---------------------------------------------------------------------------- --find string "+" in field "List1" --if the foundChunk is not empty then --set the imageSource of the foundChunk to 1088 --CLOSED FOLDER --end if put 0 into foundPos put 0 into charCounter repeat for each char thisChar in thisLine put charCounter + 1 into charCounter if char charCounter of thisLine = "+" then put charCounter into foundPos exit repeat end if end repeat if foundPos > 0 then set the imageSource of char foundPos of line lineCounter of field "List1" to 1088 --CLOSED FOLDER end if end repeat ----------------------------------- --find empty ----------------------------------- --repeat for each line thisLine in field "List1" --find string "--" in field "List1" ----put the foundChunk --if the foundChunk is not empty then --set the imageSource of the foundChunk to 1089 --OPEN FOLDER --set the itemDelimiter to space --put item 4 of the foundChunk into charToDelete ----delete char charToDelete of field "List1" --****************REMOVED************************ --end if --end repeat --find empty -------------------------------------------------------------------- put 0 into lineCounter repeat for each line thisLine in field "List1" put lineCounter + 1 into lineCounter put 0 into foundPos put 0 into charCounter repeat for each char thisChar in thisLine put charCounter + 1 into charCounter if char charCounter of thisLine = "-" and char (charCounter + 1) of thisLine = "-" then put charCounter into foundPos exit repeat end if end repeat if foundPos > 0 then set the imageSource of char foundPos of line lineCounter of field "List1" to 1089 --OPEN FOLDER put numtochar(160) into char (foundPos + 1) of line lineCounter of field "List1" end if end repeat ------------------------------------------------------------------------------------------------------------------------------- --field "lineTemp" put 0 into counter repeat for each line thisLine in field "List1" put counter + 1 into counter put thisLine into field "lineTemp" of card "Card1" ------------------------------------------------------ --find string "+" in field "lineTemp" of card "Card1" --FOR SUBSTITUTION put line 1 of field "lineTemp" of card "Card1" into thisLine put 0 into foundPos put 0 into charCounter repeat for each char thisChar in thisLine put charCounter + 1 into charCounter if char charCounter of thisLine = "+" then put charCounter into foundPos exit repeat end if end repeat ---------- --if the foundChunk is not empty then if foundPos > 0 then --------------------------------------------------- --set the itemDelimiter to space --FOR SUBSTITUTION --put item 2 of the foundChunk into charPos --FOR SUBSTITUTION put foundPos into charPos -------------------------------------------------- if char (charPos -1) of line 1 of field "lineTemp" of card "Card1" is not empty and char (charPos -1) of line 1 of field "lineTemp" of card "Card1" is not space and char (charPos +1) of line 1 of field "lineTemp" of card "Card1" is not empty and char (charPos +1) of line 1 of field "lineTemp" of card "Card1" is not space then put "+" into char charPos of line counter of field "List1" --In the case that + appears as part of a folder name and has been accidentally replaced with a folder image, --the above puts the + sign back. end if end if end repeat unlock screen end if end prettify_List1 ---------------------------------------------------------------------------------------------------------------------------------- on Patch_To_Correct_Indents ---------------------------------------------------- --THIS PATCH HAS NOW BEEN REMOVED exit Patch_To_Correct_Indents --------------------------------------------------- --For any line in field "List1", if the next line has an indent which is greater than the IndentSize, then reduce it. --"If the indent of the current line is greater than the ORIGINAL indent of the previous line, then --##### --make it ONE IndentSize greater than the previous line's CURRENT indent" --##### global IndentSize put 0 into lineCounter put 0 into previousSpaceCounter repeat for each line thisLine in field "List1" put lineCounter + 1 into lineCounter put 0 into spaceCounter repeat for each char thisChar in thisLine if thisChar = space then put spaceCounter + 1 into spaceCounter else exit repeat end if end repeat put spaceCounter into previousSpaceCounter --##### --Reduce current line to (previousLineSpaceCounter + IndentSize) exactly: put 0 into previousLineSpaceCounter put 0 into previousLineIsOpenFolder repeat for each char thisChar in line (lineCounter - 1) of field "List1" of card "Card1" if thisChar = space then put previousLineSpaceCounter + 1 into previousLineSpaceCounter else if thisChar = "-" then put 1 into previousLineIsOpenFolder end if exit repeat end if end repeat if (spaceCounter > (previousLineSpaceCounter + IndentSize - 1)) and ((previousLineSpaceCounter + IndentSize) > IndentSize) then put empty into newLine if previousLineIsOpenFolder = 1 then repeat with n = 1 to (previousLineSpaceCounter + IndentSize) put newLine & space into newLine end repeat else repeat with n = 1 to previousLineSpaceCounter --BUT IF PREVIOUS LINE IS NOT AN OPEN FOLDER, DO NOT ADD THE IndentSize as ABOVE put newLine & space into newLine end repeat end if repeat with n = (previousSpaceCounter + 1) to (the length of thisLine) --if char n of thisLine <> space then --CORRECTED FOR UNIVERSAL VERSION put newLine & (char n of thisLine) into newLine --end if end repeat put newLine into line lineCounter of field "List1" of card "Card1" else put spaceCounter into previousSpaceCounter end if end repeat end Patch_To_Correct_Indents ------------------------------------------------------------ on Patch_To_Remove_Trailing_Blanks put 0 into lineCounter repeat for each line thisLine in field "List1" put lineCounter + 1 into lineCounter put 0 into RHSblankCharPos repeat with RHSblankCharPos = -1 down to (-1 * (the length of thisLine)) put char RHSblankCharPos of thisLine into thisChar if thisChar is not space then exit repeat end repeat put char 1 to RHSblankCharPos of thisLine into thisLine put thisLine into line lineCounter of field "List1" of card "Card1" end repeat end Patch_To_Remove_Trailing_Blanks ------------------------------------------------------------ on check_max_and_min --breakpoint Global DONEcheck_max_and_min if DONEcheck_max_and_min = 1 then exit check_max_and_min end if put 1 into DONEcheck_max_and_min Global WidgetLeftPosition Global WidgetTopPosition global WidgetWidth global WidgetHeight global ScreenWidth global ScreenHeight global PreviewPictureHeight global temp1 global temp2 ------------------------------------------------------------------------------------------ --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 9 of field "IniParametersField" of card "Card4" of this stack into temp1 --put line 10 of field "IniParametersField" of card "Card4" of this stack into temp2 put line 11 of field "IniParametersField" of card "Card4" of this stack into temp1 put line 12 of field "IniParametersField" of card "Card4" of this stack into temp2 ------------------------------------------------------------------------------------------ put word 1 to -1 of temp1 into temp1 put word 1 to -1 of temp2 into temp2 put the toLower of temp1 into temp1 put the toLower of temp2 into temp2 if temp1 = "max" or temp1 = "maximum" or temp1 = "min" or temp1 = "minimum" or temp1 = empty then if temp1 = "maximum" then put "max" into temp1 end if if temp1 = "minimum" or temp1 = empty then put "min" into temp1 end if if temp1 = "max" then put (ScreenWidth - 11) into WidgetWidth put 6 into WidgetLeftPosition set the width of this stack to WidgetWidth set the left of this stack to WidgetLeftPosition end if if temp1 = "min" then put 320 into WidgetWidth end if else --------------------------------------------------------------------------------------------------- --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth put line 11 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth ------------------------------------------------------------------------------------------------- end if if temp2 = "max" or temp2 = "maximum" or temp2 = "min" or temp2 = "minimum" or temp2 = empty then if temp2 = "maximum" then put "max" into temp2 end if if temp2 = "minimum" or temp2 = empty then put "min" into temp2 end if if temp2 = "max" then put (ScreenHeight - PreviewPictureHeight - 78) into WidgetHeight put 48 into WidgetTopPosition set the height of this stack to WidgetHeight set the top of this stack to WidgetTopPosition end if if temp2 = "min" then put 240 into WidgetHeight end if else ----------------------------------------------------------------------------------------------------- --ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION: --put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight put line 12 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight --------------------------------------------------------------------------------------------------- end if end check_max_and_min ----------------------------------------------------------------------------------------------------------------------------- on adjust_for_folder_chooser --exit adjust_for_folder_chooser -- @@@@@@@@ REMOVED 21/06/2011 global thisIsAFolderChooserWidget if thisIsAFolderChooserWidget = 1 then put ((the right of field "List2" of card "Card1") - (the left of field "List1" of card "Card1")) into newList1Width put the left of field "List1" of card "Card1" into newList1Left set the width of field "List1" of card "Card1" to newList1Width set the left of field "List1" of card "Card1" to newList1Left set the visible of field "List2" of card "Card1" to false end if end adjust_for_folder_chooser ----------------------------------------------------------------------------------------------------------------------------- on idle global previousContentsOfMediaFolder Global LineNumberClicked Global ItemClicked$ global doingMedia if the label of this stack is "/media" then put the defaultFolder into temp set the defaultFolder to "/media" put the folders into currentContentsOfMediaFolder if currentContentsOfMediaFolder <> previousContentsOfMediaFolder then lock screen call mouseDown of image "Root" repeat with counter = 1 to (the number of lines in field "List1") --1000 put line counter of field "List1" into thisLine if toLower(thisLine) = "+media" then put counter into LineNumberClicked put "+media" into ItemClicked$ put 1 into doingMedia call mouseDown of field "List1" put 0 into doingMedia exit repeat end if end repeat put currentContentsOfMediaFolder into previousContentsOfMediaFolder unlock screen end if set the defaultFolder to temp wait 1 tick with messages end if end idle ----------------------------------------------------------------------------------------------------------------------------- 4b /home/bobdell/Desktop @ U Tahoma U Arial U Arial W Arial W Arial W Arial U Arial U Arial $ U Arial $ W Arial U U Arial U Helvetica U Arial U Arial U default U default U Helvetica W Helvetica U default W default W Arial U Arial W Arial W Helvetica U Helvetica U Lucida Bright U Lucida Bright U Arial U FreeMono U FreeMono U Default cRevStandaloneSettings =scriptLibraries Internet Geometry PrintingMacOSX false OSX,name HDTreeMacOS,documentType UNIX,fileSelector trueWindows falseWindows,Comments Author: Robert J WarrenMacOS,longVersion HDTree 1.0.0.0Windows,LegalCopyright .2006 howsoft.com All rights reserved worldwideUNIX,pageSetup trueOSX,documentType Linux trueincludeProfiles setToProfile Windows,documenticonFile ;D:/Program Files/Revolution 2.6/Sample Icons/genericdoc.icoinclusions selectOdt false answerDialog trueSPARC falseOSX,documentExtension SolIntel falseWindows,FileDescription &File Chooser Widget 1.1 for Windows XPOSX,longVersion HDTree 1.0.0.0 MacOSfat falseUNIX,printerChooser trueOSX,copyright .2005 howsoft.com All rights reserved worldwideMacOS,MinimumSize 15000MacOS,versionnumber1 1MacOS,Release FinalMacOS,versionnumber2 0MacOS,versionnumber3 0name _file_chooserOSX,identifier com.howsoft.com.hdtree MacOS,Region 1rs6000 falseHp9k700 falseOSX,shortVersion 1.0.0.0Windows,fileversion1 1Windows,fileversion2 1Windows,productversion1 1Windows,fileversion3 0Windows,productversion2 1Windows,fileversion4 0Windows,productversion3 0cursors trueBsd false OSX,info HDTree Version 1.0.0.0Windows,productversion4 0 MacOS68k falseMacOS,dynamicMemory true askDialog trueIris falseWindows,iconFile #h_deep_sky_blue_all_resolutions.icoOSX,signature ????Windows,ProductName File Chooser WidgetMacOS,PreferredSize 15000UNIX,colorChooser true MacOSPPC falseMacOS,creator ???? SolSparc falseWindows,companyname howsoft.com cREVGeometryCache stackID 1569 cREVGeneral @ scriptChecksum 8q^YyRKgbreakpoints handlerList 1closeStackRequest preOpenStack resumeStack resizeStack show_drives get_ini_parameters iconifyStack remove_all_drivebox_highlights error_reading_diskette get_startup_folder Position_Controls prettify_List1 Patch_To_Correct_Indents Patch_To_Remove_Trailing_Blanks check_max_and_min adjust_for_folder_chooserscriptSelection char 48547 to 48546breakpointstates bookmarks breakpointconditions scripteditorvscroll 16964scripteditorselection 4458tempScript prevHandler Patch_To_Correct_Indentsstackfileversion 2.7script
on closeStackRequest
end closeStackRequest
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
wait 2 --@@@@@@@@@@@@@@@@
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
call adjust_for_folder_chooser
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
show_drives
get_ini_parameters
--------------------------------------------
call adjust_for_folder_chooser
--------------------------------------------
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
put field "List1" of card "Card1" into field "plain" of card "Card1" --NEW*******************
call prettify_List1 of this stack
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 WidgetWidth --@@@@@@@@@@@
global WidgetHeight --@@@@@@@@@@@@
Global AdjustingWindow
if AdjustingWindow = 1 then pass get_ini_parameters
Global SourceDirectory$
Global CDDirectory$ --NEW FOR UNIVERSAL EDITION
Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION
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. Windows only c:\):
--In Linux, startup folders can begin as follows:
--/
--/media/floppy0 or just "floppy" or "diskette"
--/media/cdrom0 or just "cd" or "cdrom"
--In the above optional startup drive specifications, you need to check for UCase, trailing slashes, etc.
--Specifications such as floppy/subfolder should not be permitted. These should be specified as /media/floppy0/subfolder
--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$
if the charToNum of the last char of SourceDirectory$ is 13 then --LINUX only
put char 1 to -2 of SourceDirectory$ into SourceDirectory$
end if
--/
--/media/floppy0 or just "floppy" or "diskette"
--/media/cdrom0 or just "cd" or "cdrom"
--Changed for UBUNTU later versions:
--if toLower(SourceDirectory$) = "floppy" then put "/media/floppy0" into SourceDirectory$
--if toLower(SourceDirectory$) = "diskette" then put "/media/floppy0" into SourceDirectory$
--if toLower(SourceDirectory$) = "cd" then put "/media/cdrom0" into SourceDirectory$
--if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom0" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/floppy0/" then put "/media/floppy0" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/cdrom0/" then put "/media/cdrom0" into SourceDirectory$
--if toLower(SourceDirectory$) = "floppy" then put "/media/floppy" into SourceDirectory$
--if toLower(SourceDirectory$) = "diskette" then put "/media/floppy" into SourceDirectory$
--if toLower(SourceDirectory$) = "cd" then put "/media/cdrom" into SourceDirectory$
--if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/floppy/" then put "/media/floppy" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/cdrom/" then put "/media/cdrom" into SourceDirectory$
---------------------------------------------------------------------------------------------------------
--REMOVED IN UNIVERSAL EDITION:
--if toLower(SourceDirectory$) = "floppy" then put "/media/fd0" into SourceDirectory$
--if toLower(SourceDirectory$) = "diskette" then put "/media/fd0" into SourceDirectory$
--if toLower(SourceDirectory$) = "cd" then put "/media/cdrom" into SourceDirectory$
--if toLower(SourceDirectory$) = "cdrom" then put "/media/cdrom" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/floppy/" then put "/media/fd0" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/fd0/" then put "/media/fd0" into SourceDirectory$
--if toLower(SourceDirectory$) = "/media/cdrom/" then put "/media/cdrom" into SourceDirectory$
--------------------------------------------------------------------------------------------------------
--Global CDDirectory$ --NEW FOR UNIVERSAL EDITION
--Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION
put line 2 of field "IniParametersField" of card "Card4" of this stack into CDDirectory$ --NEW FOR UNIVERSAL EDITION
put line 3 of field "IniParametersField" of card "Card4" of this stack into FloppyDirectory$ --NEW FOR UNIVERSAL EDITION
if the charToNum of the last char of CDDirectory$ is 13 then --LINUX only
put char 1 to -2 of CDDirectory$ into CDDirectory$
end if
if the charToNum of the last char of FloppyDirectory$ is 13 then --LINUX only
put char 1 to -2 of FloppyDirectory$ into FloppyDirectory$
end if
--------------------------------------------------------------------------------------------------------
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--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 line 4 of field "IniParametersField" of card "Card4" of this stack into IndentSize --e.g. 8 IndentSize
put line 5 of field "IniParametersField" of card "Card4" of this stack into TreeFontname$ --e.g. "Arial" TreeFontname$
put line 6 of field "IniParametersField" of card "Card4" of this stack into TreeFontsize --e.g. 12 TreeFontsize
put line 7 of field "IniParametersField" of card "Card4" of this stack into TreeFontbold$ --e.g. "yes" TreeFontbold$
put line 8 of field "IniParametersField" of card "Card4" of this stack into TreeFontitalic$ --e.g. "no" TreeFontitalic$
------------------------------------------------------------------------------------------------------
if the charToNum of the last char of IndentSize is 13 then --LINUX only
put char 1 to -2 of IndentSize into IndentSize
end if
if the charToNum of the last char of TreeFontname$ is 13 then --LINUX only
put char 1 to -2 of TreeFontname$ into TreeFontname$
end if
if the charToNum of the last char of TreeFontsize is 13 then --LINUX only
put char 1 to -2 of TreeFontsize into TreeFontsize
end if
if the charToNum of the last char of TreeFontbold$ is 13 then --LINUX only
put char 1 to -2 of TreeFontbold$ into TreeFontbold$
end if
if the charToNum of the last char of TreeFontitalic$ is 13 then --LINUX only
put char 1 to -2 of TreeFontitalic$ into TreeFontitalic$
end if
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 --LINUX
put char 1 to -2 of StartupPath$ into StartupPath$
end if
--SourceDirectory$ can be:
--"/"
--"/media/floppy0/****************" (perhaps with some UCase)
--"/media/cdrom0/****************" (perhaps with some UCase)
-------------------------------------------------------------------------------------------------------------------------------
--put toLower(SourceDirectory$) into SourceDirectory$ --WRONG! REMOVED FOR UNIVERSAL EDITION
-------------------------------------------------------------------------------------------------------------------------------
----if char 1 to 14 of SourceDirectory$ = "/media/floppy0" then put "/media/floppy0" into SourceDirectory$
----if char 1 to 13 of SourceDirectory$ = "/media/cdrom0" then put "/media/cdrom0" into SourceDirectory$
----if char 1 to 14 of SourceDirectory$ <> "/media/floppy0" and char 1 to 13 of SourceDirectory$ <> "/media/cdrom0" then put "/" into SourceDirectory$
----if char 1 to 13 of SourceDirectory$ = "/media/floppy" then put "/media/floppy" into SourceDirectory$
--if char 1 to 13 of SourceDirectory$ = "/media/floppy" then put "/media/fd0" into SourceDirectory$
--if char 1 to 12 of SourceDirectory$ = "/media/cdrom" then put "/media/cdrom" into SourceDirectory$
----if char 1 to 13 of SourceDirectory$ <> "/media/floppy" and char 1 to 12 of SourceDirectory$ <> "/media/cdrom" then put "/" into SourceDirectory$
--if char 1 to 10 of SourceDirectory$ <> "/media/fd0" and char 1 to 12 of SourceDirectory$ <> "/media/cdrom" then put "/" into SourceDirectory$
--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 "/" into SourceDirectory$ --LINUX
if IndentSize = "" then put 4 into IndentSize
if TreeFontname$ = "" then put "default" into TreeFontname$
if TreeFontsize = "" then put 14 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 textFont of field "suggestedFileName" 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
set the textSize of field "suggestedFileName" 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"
set the textStyle of field "suggestedFileName" 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"
set the textStyle of field "suggestedFileName" 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"
set the textStyle of field "suggestedFileName" to "bold,italic"
end if
set the height of field "suggestedFileName" to the textheightSum of field "suggestedFileName" --NEW
--SourceDirectory$ can be:
--"/"
--"/media/floppy0"
--"/media/cdrom0"
put SourceDirectory$ into tempVar
-- tempVar can be:
--"/"
--"/media/floppy0"
--"/media/cdrom0"
----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):
----------------------------------------------------------------------------------------------------------------
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--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 line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetLeftPosition
put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetTopPosition
put line 11 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth
put line 12 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight
Global OutputMode$
put line 13 of field "IniParametersField" of card "Card4" of this stack into OutputMode$
---------------------------------------------------------------------------------------------------------------
if the charToNum of the last char of WidgetLeftPosition is 13 then --LINUX only
put char 1 to -2 of WidgetLeftPosition into WidgetLeftPosition
end if
if the charToNum of the last char of WidgetTopPosition is 13 then --LINUX only
put char 1 to -2 of WidgetTopPosition into WidgetTopPosition
end if
if the charToNum of the last char of WidgetWidth is 13 then --LINUX only
put char 1 to -2 of WidgetWidth into WidgetWidth
end if
if the charToNum of the last char of WidgetHeight is 13 then --LINUX only
put char 1 to -2 of WidgetHeight into WidgetHeight
end if
if the charToNum of the last char of OutputMode$ is 13 then --LINUX only
put char 1 to -2 of OutputMode$ into OutputMode$
end if
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
--------------------------------
global temp1
global temp2
Global AdjustingWindow
put 1 into AdjustingWindow
call check_max_and_min
--put 0 into AdjustingWindow
--------------------------------
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 temp1 <> "max" then
set the width of this stack to WidgetWidth
end if
if temp2 <> "max" then
set the height of this stack to WidgetHeight
end if
-------------------------------
--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
-------------------------------------------------------
--If WidgetWidth is set to "max" then IGNOR WidgetLeftPosition
--If WidgetHeight is set to "max" then IGNOR WidgetTopPosition
---------------------------------------------
if WidgetLeftPosition <> "centre" and temp1 <> "max" then
set the left of this stack to WidgetLeftPosition
end if
if WidgetTopPosition <> "centre" and temp2 <> "max" then
set the top of this stack to WidgetTopPosition
end if
-------------
if WidgetLeftPosition = "centre" and temp1 <> "max" then
Global ScreenWidth
If WidgetWidth > ScreenWidth then put ScreenWidth into WidgetWidth
put (ScreenWidth - WidgetWidth) into HorizontalDifference
put (HorizontalDifference / 2) into WidgetLeftMargin
set the left of this stack to WidgetLeftMargin
end if
if WidgetTopPosition = "centre" and temp2 <> "max" then
Global ScreenHeight
If WidgetHeight > ScreenHeight then put ScreenHeight into WidgetHeight
put (ScreenHeight - WidgetHeight) into VerticalDifference
put (VerticalDifference / 2) into WidgetTopMargin
set the top of this stack to WidgetTopMargin
end if
--breakpoint
-------------------------------------------------------
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
--------------------------------------------------------------------
set the top of button "Cancel" to the top of button "Cancel" + 4
set the top of button "OK" to the top of button "OK" + 4
-------------------------------------------------------------------
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 image "Root" + 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 image "Root" + 10)
set the top of field "List2" to (the bottom of image "Root" + 10)
if OutputMode$ <> "hd" and OutputMode$ <> "clipboard" then
put "hd" into OutputMode$
end if
-----------------------------------------
--global AdjustingWindow
put 0 into AdjustingWindow
-----------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 13 of field "IniParametersField" of card "Card4" of this stack into treeFolderColour
put line 15 of field "IniParametersField" of card "Card4" of this stack into treeFolderColour
-------------------------------------------------------------------------
--Colours used for folders:
--red (default)
--blue
--cherry
--cyan
--darkblue
--darkbrown
--darkgreen
--darkgrey
--grey
--lightbrown
--lightgreen
--mauve
--white
--yellow
put toLower(treeFolderColour) into treeFolderColour
put treeFolderColour into treeFolderColourWithSpaces
put empty into treeFolderColour
repeat for each char thisChar in treeFolderColourWithSpaces
if thisChar is not space then
put treeFolderColour & thisChar into treeFolderColour
end if
end repeat
if treeFolderColour = "gray" then put "grey" into treeFolderColour
if treeFolderColour = "darkgray" then put "darkgrey" into treeFolderColour
--blue
--cherry
--cyan
--darkblue
--darkbrown
--darkgreen
--darkgrey
--grey
--lightbrown
--lightgreen
--mauve
--white
--yellow
if treeFolderColour <> "blue" and\
treeFolderColour <> "cherry" and\
treeFolderColour <> "cyan" and\
treeFolderColour <> "darkblue" and\
treeFolderColour <> "darkbrown" and\
treeFolderColour <> "darkgreen" and\
treeFolderColour <> "darkgrey" and\
treeFolderColour <> "grey" and\
treeFolderColour <> "lightbrown" and\
treeFolderColour <> "lightgreen" and\
treeFolderColour <> "mauve" and\
treeFolderColour <> "white" and\
treeFolderColour <> "yellow" then
put "red" into treeFolderColour
end if
--folderPic
--folderOpenPic
if treeFolderColour <> "red" then
put treeFolderColour & "_closed" into closedImageName
put treeFolderColour & "_open" into openImageName
put image closedImageName into image "folderPic"
put image openImageName into image "folderOpenPic"
end if
--------------------------------------------------------------------------------------------
--For suggested file name (if it exists):
--Can be a name or a filter
global suggestedFileNameExists
--------------------------------------------------------
--put line 14 of field "IniParametersField" of card "Card4" of this stack into suggestedFileNameExists
--put suggestedFileNameExists into field "suggestedFileName"
global thisIsAFolderChooserWidget
global testFileName
---------------------------------------------------------------------------------------------------
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 14 of field "IniParametersField" of card "Card4" of this stack into testFileName
put line 16 of field "IniParametersField" of card "Card4" of this stack into testFileName
---------------------------------------------------------------------------------------------------
put char 1 to -1 of testFileName into testFileName
if toLower(testFileName) = "folder" or toLower(testFileName) = "folder/" then
put 1 into thisIsAFolderChooserWidget
put empty into suggestedFileNameExists
put empty into field "suggestedFileName"
enable button "OK" of card "Card1"
else
if testFileName is empty then
put empty into suggestedFileNameExists
put empty into field "suggestedFileName"
disable button "OK" of card "Card1"
else
put testFileName into suggestedFileNameExists
put testFileName into field "suggestedFileName"
enable button "OK" of card "Card1"
end if
end if
-------------------------------------------
if suggestedFileNameExists is not empty then
Position_Controls
end if
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
put URL "file:_file_chooser_filters.ini" into field "Filters" of card "Card4" 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
end if
put 0 into FilterCounter
repeat for each line thisLine in field "Filters" of card "Card4" of this stack --LINUX only
put (FilterCounter + 1) into FilterCounter
if the charToNum of the last char of thisLine is 13 then
put char 1 to -2 of thisLine into newLine$
else
put thisLine into newLine$
end if
put newLine$ into line FilterCounter of button "Filters" of card "Card1" of this stack --LINUX only
end repeat
--------------------------------------------------------------------------
-- tempVar can be:
--"/"
--"/media/floppy0"
--"/media/cdrom0"
--Global NumberOfDrives --For LINUX, this is between 1 and 3
------------------------------------------------------------------------
--For LINUX:
--Highlight the drive according to tempVar, which can be:
--"/"
--"/media/floppy0"
--"/media/cdrom0"
Global GotPathAlready
if GotPathAlready <> 1 then
remove_all_drivebox_highlights
--*****************************
Global WidgetFolder$
put the defaultfolder into WidgetFolder$
if the last char of WidgetFolder$ is "/" then
put char 1 to -2 of WidgetFolder$ into WidgetFolder$
end if
--*****************************
If tempVar = "/" then
call mouseDown of image "Root"
end if
--Changed for UBUNTU later versions:
--If tempVar = "/media/cdrom0" then
--call mouseDown of image "CD"
--end if
--If tempVar = "/media/floppy0" then
--call mouseDown of image "Diskette"
--end if
--------------------------------------------------------------------
--CHANGED FOR UNIVERSAL EDITION:
--If tempVar = "/media/cdrom" then
--call mouseDown of image "CD"
--end if
----If tempVar = "/media/floppy" then
--If tempVar = "/media/fd0" then
--call mouseDown of image "Diskette"
--end if
--Global CDDirectory$ --NEW FOR UNIVERSAL EDITION
--Global FloppyDirectory$ --NEW FOR UNIVERSAL EDITION
put the length of CDDirectory$ into lenCDDirectory
put the length of FloppyDirectory$ into lenFloppyDirectory
--tempVar can contain the startup folder (from ini file line 1) which may be a subfolder of the main CD/floppy folder
--cited in lines 2 or 3.
put 0 into cdHasAStartupFolder
put 0 into floppyHasAStartupFolder
if toLower(char 1 to lenCDDirectory of tempVar) = toLower(CDDirectory$) then
put 1 into cdHasAStartupFolder
end if
if toLower(char 1 to lenFloppyDirectory of tempVar) = toLower(FloppyDirectory$) then
put 1 into floppyHasAStartupFolder
end if
if CDDirectory$ is not empty and there is a folder CDDirectory$ and cdHasAStartupFolder = 1 then
set the visible of image "CD" to true
call mouseDown of image "CD" --TEMP REMOVAL FOR UNIVERSAL EDITION (NECESSARY ANYWAY?)
end if
if FloppyDirectory$ is not empty and there is a folder FloppyDirectory$ and floppyHasAStartupFolder = 1 then
set the visible of image "Diskette" to true
call mouseDown of image "Diskette" --TEMP REMOVAL FOR UNIVERSAL EDITION (NECESSARY ANYWAY?)
end if
-----------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
end if
------------------------------------------------------------------------
put IndentSize into field "TextIndentSizeField" of card "Card3"
-------------------------------------------------
call mouseDown of image "Root" of card "Card1" --INCLUDED HERE FOR UNIVERSAL EDITION
-------------------------------------------------
put SourceDirectory$ into field "Text2"
Global InputDirectory$ --INCLUDED HERE FOR UNIVERSAL EDITION
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
put field "List1" into field "plain" --##### INTRODUCED IN UNIVERSAL EDITION ###############
call Patch_To_Remove_Trailing_Blanks of this stack --##### INTRODUCED IN UNIVERSAL EDITION ###############
call prettify_List1 of this stack
put 1 into get_ini_parameters
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
put image "Root_Blank" into image "Root"
put image "CD_Blank" into image "CD"
put image "Diskette_Blank" into image "Diskette"
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
end error_reading_diskette
on get_startup_folder
Global Init
if Init = 1 then pass get_startup_folder
Global SourceDirectory$
Global StartupPath$
Global InputDirectory$ --PUT EARLIER HERE FOR UNIVERSAL EDITION
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$ --PUT EARLIER FOR UNIVERSAL EDITION (see above)
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
put InputDirectory$ into field "Text1Field" of card "Card3"
--InputDirectory$:
--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 "/" --LINUX
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 --(Windows)
--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
--------------------------------------------------------------------
set the top of button "Cancel" to the top of button "Cancel" + 4
set the top of button "OK" to the top of button "OK" + 4
-------------------------------------------------------------------
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"
-----------------------------------------------
--Alteration:
--List2 is now set to the right of List1 - 4
--Width is adjusted so that RH margin is 15
set the left of field "List2" to (the right of field "List1" - 4)
set the width of field "List2" to the right of button "OK" - the right of field "List1" + 4 + 7 --The reason for the +7 is not known
set the width of field "suggestedFilename" to the width of field "List2" - 3
set the left of field "suggestedFilename" to the left of field "List2"
-----------------------------------------------
put (the top of button "Filters" - 10) - (the bottom of image "Root" + 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 image "Root" + 10)
set the top of field "List2" to (the bottom of image "Root"+ 10)
----------------------------------------------
--Alteration:
global suggestedFileNameExists
if suggestedFileNameExists is not empty then
set the height of field "List2" to (the height of field "List2" - the height of field "suggestedFileName")
set the top of field "suggestedFileName" to the bottom of field "List2" - 3
set the visible of field "suggestedFileName" to true
end if
end Position_Controls
----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------
on prettify_List1
Patch_To_Correct_Indents
--Patch_To_Remove_Trailing_Blanks
--THIS ROUTINE HAS BEEN REFORMED IN ORDER TO ELIMINATE THE USE OF THE find INSTRUCTIONS:
--Under some circumstances they cause a crash.
if field "List1" is not empty then
--put field "List1" into field "list1Pretty"
lock screen
--folderClosed 1085
--folderOpen 1089
put 0 into lineCounter
repeat for each line thisLine in field "List1"
put lineCounter + 1 into lineCounter
----------------------------------------------------------------------------
--find string "+" in field "List1"
--if the foundChunk is not empty then
--set the imageSource of the foundChunk to 1088 --CLOSED FOLDER
--end if
put 0 into foundPos
put 0 into charCounter
repeat for each char thisChar in thisLine
put charCounter + 1 into charCounter
if char charCounter of thisLine = "+" then
put charCounter into foundPos
exit repeat
end if
end repeat
if foundPos > 0 then
set the imageSource of char foundPos of line lineCounter of field "List1" to 1088 --CLOSED FOLDER
end if
end repeat
-----------------------------------
--find empty
-----------------------------------
--repeat for each line thisLine in field "List1"
--find string "--" in field "List1"
----put the foundChunk
--if the foundChunk is not empty then
--set the imageSource of the foundChunk to 1089 --OPEN FOLDER
--set the itemDelimiter to space
--put item 4 of the foundChunk into charToDelete
----delete char charToDelete of field "List1" --****************REMOVED************************
--end if
--end repeat
--find empty
--------------------------------------------------------------------
put 0 into lineCounter
repeat for each line thisLine in field "List1"
put lineCounter + 1 into lineCounter
put 0 into foundPos
put 0 into charCounter
repeat for each char thisChar in thisLine
put charCounter + 1 into charCounter
if char charCounter of thisLine = "-" and char (charCounter + 1) of thisLine = "-" then
put charCounter into foundPos
exit repeat
end if
end repeat
if foundPos > 0 then
set the imageSource of char foundPos of line lineCounter of field "List1" to 1089 --OPEN FOLDER
put numtochar(160) into char (foundPos + 1) of line lineCounter of field "List1"
end if
end repeat
-------------------------------------------------------------------------------------------------------------------------------
--field "lineTemp"
put 0 into counter
repeat for each line thisLine in field "List1"
put counter + 1 into counter
put thisLine into field "lineTemp" of card "Card1"
------------------------------------------------------
--find string "+" in field "lineTemp" of card "Card1" --FOR SUBSTITUTION
put line 1 of field "lineTemp" of card "Card1" into thisLine
put 0 into foundPos
put 0 into charCounter
repeat for each char thisChar in thisLine
put charCounter + 1 into charCounter
if char charCounter of thisLine = "+" then
put charCounter into foundPos
exit repeat
end if
end repeat
----------
--if the foundChunk is not empty then
if foundPos > 0 then
---------------------------------------------------
--set the itemDelimiter to space --FOR SUBSTITUTION
--put item 2 of the foundChunk into charPos --FOR SUBSTITUTION
put foundPos into charPos
--------------------------------------------------
if char (charPos -1) of line 1 of field "lineTemp" of card "Card1" is not empty and char (charPos -1) of line 1 of field "lineTemp" of card "Card1" is not space and char (charPos +1) of line 1 of field "lineTemp" of card "Card1" is not empty and char (charPos +1) of line 1 of field "lineTemp" of card "Card1" is not space then
put "+" into char charPos of line counter of field "List1"
--In the case that + appears as part of a folder name and has been accidentally replaced with a folder image,
--the above puts the + sign back.
end if
end if
end repeat
unlock screen
end if
end prettify_List1
----------------------------------------------------------------------------------------------------------------------------------
on Patch_To_Correct_Indents
----------------------------------------------------
--THIS PATCH HAS NOW BEEN REMOVED
exit Patch_To_Correct_Indents
---------------------------------------------------
--For any line in field "List1", if the next line has an indent which is greater than the IndentSize, then reduce it.
--"If the indent of the current line is greater than the ORIGINAL indent of the previous line, then --#####
--make it ONE IndentSize greater than the previous line's CURRENT indent" --#####
global IndentSize
put 0 into lineCounter
put 0 into previousSpaceCounter
repeat for each line thisLine in field "List1"
put lineCounter + 1 into lineCounter
put 0 into spaceCounter
repeat for each char thisChar in thisLine
if thisChar = space then
put spaceCounter + 1 into spaceCounter
else
exit repeat
end if
end repeat
put spaceCounter into previousSpaceCounter --#####
--Reduce current line to (previousLineSpaceCounter + IndentSize) exactly:
put 0 into previousLineSpaceCounter
put 0 into previousLineIsOpenFolder
repeat for each char thisChar in line (lineCounter - 1) of field "List1" of card "Card1"
if thisChar = space then
put previousLineSpaceCounter + 1 into previousLineSpaceCounter
else
if thisChar = "-" then
put 1 into previousLineIsOpenFolder
end if
exit repeat
end if
end repeat
if (spaceCounter > (previousLineSpaceCounter + IndentSize - 1)) and ((previousLineSpaceCounter + IndentSize) > IndentSize) then
put empty into newLine
if previousLineIsOpenFolder = 1 then
repeat with n = 1 to (previousLineSpaceCounter + IndentSize)
put newLine & space into newLine
end repeat
else
repeat with n = 1 to previousLineSpaceCounter
--BUT IF PREVIOUS LINE IS NOT AN OPEN FOLDER, DO NOT ADD THE IndentSize as ABOVE
put newLine & space into newLine
end repeat
end if
repeat with n = (previousSpaceCounter + 1) to (the length of thisLine)
--if char n of thisLine <> space then --CORRECTED FOR UNIVERSAL VERSION
put newLine & (char n of thisLine) into newLine
--end if
end repeat
put newLine into line lineCounter of field "List1" of card "Card1"
else
put spaceCounter into previousSpaceCounter
end if
end repeat
end Patch_To_Correct_Indents
------------------------------------------------------------
on Patch_To_Remove_Trailing_Blanks
put 0 into lineCounter
repeat for each line thisLine in field "List1"
put lineCounter + 1 into lineCounter
put 0 into RHSblankCharPos
repeat with RHSblankCharPos = -1 down to (-1 * (the length of thisLine))
put char RHSblankCharPos of thisLine into thisChar
if thisChar is not space then exit repeat
end repeat
put char 1 to RHSblankCharPos of thisLine into thisLine
put thisLine into line lineCounter of field "List1" of card "Card1"
end repeat
end Patch_To_Remove_Trailing_Blanks
------------------------------------------------------------
on check_max_and_min
--breakpoint
Global DONEcheck_max_and_min
if DONEcheck_max_and_min = 1 then
exit check_max_and_min
end if
put 1 into DONEcheck_max_and_min
Global WidgetLeftPosition
Global WidgetTopPosition
global WidgetWidth
global WidgetHeight
global ScreenWidth
global ScreenHeight
global PreviewPictureHeight
global temp1
global temp2
------------------------------------------------------------------------------------------
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 9 of field "IniParametersField" of card "Card4" of this stack into temp1
--put line 10 of field "IniParametersField" of card "Card4" of this stack into temp2
put line 11 of field "IniParametersField" of card "Card4" of this stack into temp1
put line 12 of field "IniParametersField" of card "Card4" of this stack into temp2
------------------------------------------------------------------------------------------
put word 1 to -1 of temp1 into temp1
put word 1 to -1 of temp2 into temp2
put the toLower of temp1 into temp1
put the toLower of temp2 into temp2
if temp1 = "max" or temp1 = "maximum" or temp1 = "min" or temp1 = "minimum" or temp1 = empty then
if temp1 = "maximum" then
put "max" into temp1
end if
if temp1 = "minimum" or temp1 = empty then
put "min" into temp1
end if
if temp1 = "max" then
put (ScreenWidth - 11) into WidgetWidth
put 6 into WidgetLeftPosition
set the width of this stack to WidgetWidth
set the left of this stack to WidgetLeftPosition
end if
if temp1 = "min" then
put 320 into WidgetWidth
end if
else
---------------------------------------------------------------------------------------------------
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 9 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth
put line 11 of field "IniParametersField" of card "Card4" of this stack into WidgetWidth
-------------------------------------------------------------------------------------------------
end if
if temp2 = "max" or temp2 = "maximum" or temp2 = "min" or temp2 = "minimum" or temp2 = empty then
if temp2 = "maximum" then
put "max" into temp2
end if
if temp2 = "minimum" or temp2 = empty then
put "min" into temp2
end if
if temp2 = "max" then
put (ScreenHeight - PreviewPictureHeight - 78) into WidgetHeight
put 48 into WidgetTopPosition
set the height of this stack to WidgetHeight
set the top of this stack to WidgetTopPosition
end if
if temp2 = "min" then
put 240 into WidgetHeight
end if
else
-----------------------------------------------------------------------------------------------------
--ADD 2 TO LINE NUMBERS FOR UNIVERSAL EDITION:
--put line 10 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight
put line 12 of field "IniParametersField" of card "Card4" of this stack into WidgetHeight
---------------------------------------------------------------------------------------------------
end if
end check_max_and_min
-----------------------------------------------------------------------------------------------------------------------------
on adjust_for_folder_chooser
global thisIsAFolderChooserWidget
if thisIsAFolderChooserWidget = 1 then
put ((the right of field "List2" of card "Card1") - (the left of field "List1" of card "Card1")) into newList1Width
put the left of field "List1" of card "Card1" into newList1Left
set the width of field "List1" of card "Card1" to newList1Width
set the left of field "List1" of card "Card1" to newList1Left
set the visible of field "List2" of card "Card1" to false
end if
end adjust_for_folder_chooser
AlreadyHidden false Card1 P son openCard /* lock screen --############# hide this stack show this stack set the systemWindow of this stack to true --############# --unlock screen --############# */ --set the systemWindow of this stack to true --############# REMOVED 14/06/2011 set the visible of this stack to true --############# --NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN global promptDone global widgetPromptFile --e.g. prompt_file.txt global promptParameters --e.g. 2,1 if widgetPromptFile is not empty then --beep if promptDone <> 1 then go card "prompt" put 1 into promptDone end if end if --NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -------------------------------------------------------------------------------------- --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 81172684439254 11121172684387406 11091139752993842 10801118892123274 10131172683097666 10871172684453059 11131308269156932 12731172684409239 11101308269156933 12741172684328322 11071308334764369 13091172684270569 11041172684045014 10931136243598395 10661136222147167 10651139748243810 10741139752822982 10781172684479981 11151136244250907 10681139753094355 10811172684088317 10951172684208694 11001118863130578 10081308075605712 11601118793781548 10041172684065888 10941172684240553 11021172684179444 10991172683031568 10851172684309864 11061172684425706 11111131039307932 10491172684138415 10971172684003496 10911172684292307 11051139753170540 10821139749090303 10761172684164902 10981172684116482 10961283101112267 11181172683475107 10891172684223879 11011172683932658 10901139001763194 10731172684466286 11141172684256192 11031172684027630 10921136297627586 10691118793845487 10061139748809448 10751172745774939 11171172683450662 10881139752896000 10791139752629447 10771172687466914 11161172684346192 1108 cREVGeometrycache total 56order cREVGeneral scriptChecksum ']Ӯ" bookmarks scripteditorvscroll 356handlerList openCardscriptSelection char 15 to 14prevHandler openCardtempScript scripton 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
- ) * , 1 2 3 4 5 6 7 8 9 : = ? \ ] ^ prompt Pon openCard global promptDone if promptDone = 1 then exit openCard put 1 into promptDone --formattedWidth: The object must be on the current card of an open stack. get the formattedWidth of field "prompt" of card "prompt" set the width of field "prompt" of card "prompt" to it get the formattedHeight of field "prompt" of card "prompt" set the height of field "prompt" of card "prompt" to it put the width of this stack - the width of field "prompt" of card "prompt" into horizontalMargins put the height of this stack - the height of field "prompt" of card "prompt" into verticalMargins put horizontalMargins / 2 into horizontalMargin put verticalMargins / 2 into verticalMargin put the round of horizontalMargin into horizontalMargin put the round of verticalMargin into verticalMargin set the left of field "prompt" of card "prompt" to horizontalMargin set the top of field "prompt" of card "prompt" to verticalMargin global promptParameters --e.g. 2,1 set the itemDelimiter to comma put item 1 of promptParameters into promptDisplayDuration put item 2 of promptParameters into visualEffectDuration wait promptDisplayDuration seconds visual effect dissolve -- sets up the effect --set the effectRate to milliseconds set the effectRate to (visualEffectDuration * 1000) go card "Card1" end openCard cREVGeneral scripteditorvscroll 0 cREVGeometryCacheIDs 1308850825988 1553 cREVGeometrycache total 1order Card2 @ @ cREVGeometryCacheIDs 1133977327166 10561133977215380 10551133977612235 10591134039519824 10601133977086796 10541133976982003 10531133976894579 10521140396567168 10831133977427446 10571133977512847 1058 cREVGeneral bookmarks handlerList tempScript prevHandler script cREVGeometryCache order total 10 ! " # $ ; Card3 @ @ cREVGeometryCacheIDs 1119190048195 10351119190816768 10441119189931159 10311119189985468 10331119307150731 10471119189455452 10281136311191229 10701119190793357 10421119189777949 10301119190612056 10401119190806827 10431119190588911 10391119189538606 10291119190165934 10371136400604207 10721119190784587 10411119190535316 1038 cREVGeometryCache order total 17 . 0 ! Card4 @ cREVGeometryCacheIDs 1136214694160 10631136215150469 10641119121093971 1015 cREVGeometryCache order total 3 ' ( List1 )8 on rawKeyDown end rawKeyDown on mouseUp --call prettify_List1Copy of this stack --set the HTMLtext of field "List1" to the HTMLtext of field "List1Copy" end mouseUp on mouseDown global doingMedia --NEW 14/06/2011 --************* NEW 21 MAY 2011 ************************** global scrollbarPosInPixels put the vScroll of field "List1" into scrollbarPosInPixels --*********************************************************** if the visible of field "suggestedFileName" is false then disable button "OK" of card "Card1" end if global thisIsAFolderChooserWidget if thisIsAFolderChooserWidget = 1 then enable button "OK" of card "Card1" end if Global DoingSelect If DoingSelect = 1 Then pass mouseDown lock screen --''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' --'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 --'************************************************************************************** --put field "plain" into field "List1" --#################### Global LineNumberClicked Global ItemClicked$ ------------------------------------------------------------------------- --global doingMedia --NEW 14/06/2011 if doingMedia <> 1 then --NEW 14/06/2011 put the second word of the mouseline into LineNumberClicked --put the the value of the clickLine into ItemClicked$ --e.g. +home (whole line) end if --It seems that the LineNumberClicked is no longer being detected correctly (because of put field "plain" into field "List1" --above??) --Experiment: --put 6 into LineNumberClicked --YOU NEED TO CLICK ON THE +home LINE ----------------------------------------------------------------------- --EXPERIMENTAL FOR UNIVERSAL VERSION --THIS LINE HAS BEEN MOVED UPWARDS (SEE BELOW) --global doingMedia --NEW 14/06/2011 if doingMedia <> 1 then --NEW 14/06/2011 put line LineNumberClicked of field "List1" into ItemClicked$ end if --@@@@@@@@@@@@@@ 14/06/2011 @@@@@@@@@@@@@@@@@@@@@@@@@ --put ItemClicked$ --e.g. +winsxs if ItemClicked$ contains "+winsxs" then --THIS WILL CAUSE PROG TO HAND IF EXECUTED beep exit mouseDown end if --@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ lock screen --************** 21 MAY 2011 ---------------------------------------------------------------------- --PATCH FOR UNIVERSAL EDITION: if line 1 of field "plain" is empty then delete line 1 of field "plain" end if ---------------------------------------------------------------------- put field "plain" into field "List1" --#################### call Patch_To_Remove_Trailing_Blanks of this stack --put line LineNumberClicked of field "List1" into ItemClicked$ --THIS LINE HAS BEEN MOVED UPWARDS ----The above has now been modified: --put the second word of the mouseline into LineNumberClicked ----put LineNumberClicked --TEMP ONLY ******** ----put field "List1Copy" into field "List1" ----THE ABOVE LINE SEEMS TO UPSET THE Card3 GetFolderButton mouseUp routine!!! ----This is not surprising, since you are changing List1 before the mouseDown routine has been completed! --put line LineNumberClicked of field "List1Copy" into ItemClicked$ --e.g. +home (whole line) ----put ItemClicked$ --TEMP ONLY ******** ----------------------------------------------------------------------- if char 1 of ItemClicked$ <> " " Then call LineClickedWithNoIndent set the vScroll of field "List1" to scrollbarPosInPixels --************** 21 MAY 2011 unlock screen pass mouseDown end if if char 1 of ItemClicked$ = " " then call LineClickedWithIndent set the vScroll of field "List1" to scrollbarPosInPixels --************** 21 MAY 2011 unlock screen pass mouseDown end if unlock screen--************** 21 MAY 2011 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 --LINUX put SourceDirectory$ & PathBlock$ into HDPathToExpand$ Else put SourceDirectory$ & "/" & PathBlock$ into HDPathToExpand$ --LINUX 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" --'The new segment is now in Form3.ListExpanded --'It will need indents added to it. put empty into field "List3" Global LineNumberClicked 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 --Global LineNumberClicked 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 --NewTreeNowMounted: 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 put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack 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" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ 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" --FilesAllListed: 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 --################### CORRECTION ################################ --THE FOLLOWING HAS BEEN EXPERIMENTALLY REMOVED: --put the second word of the mouseline into LineNumberClicked --################### CORRECTION ################################ Global ItemClicked$ --put the value of the clickLine into ItemClicked$ put line LineNumberClicked of field "List1" into ItemClicked$ Global SourceDirectory$ put char 3 to -1 of ItemClicked$ into EndBlock$ put SourceDirectory$ into DriveEtcBit$ If char -1 of DriveEtcBit$ = "/" Then --LINUX put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$ end if put (DriveEtcBit$ & "/" & EndBlock$) into PathToLineClicked$ --LINUX 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" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ 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: 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: --'Copy from List3 back to List1: -------------------------------------------------- if LineNumberClicked = 1 then delete line 1 of field "List3" --************************************* -------------------------------------------------- put field "List3" into field "List1" put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack select line LineNumberClicked of field "List1" Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 end LineClickedWithNoIndentButMinus ----------------------------------------------------------------------------------- on 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 -REMOVED (Causes trouble) Global ItemClicked$ --put the the value of the clickLine into ItemClicked$ put line LineNumberClicked of field "List1" into ItemClicked$ Global SourceDirectory$ put char 3 to -1 of ItemClicked$ into EndBlock$ put SourceDirectory$ into DriveEtcBit$ If char -1 of DriveEtcBit$ = "/" Then --LINUX put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$ end if put (DriveEtcBit$ & "/" & EndBlock$) into PathToLineClicked$ --LINUX 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" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ 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 put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack --ShownAllFilesChr160: select line LineNumberClicked of field "List1" Global LineNumberSelectedInList1 put LineNumberClicked into LineNumberSelectedInList1 exit to top --NEW ************** 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 line LineNumberClicked of field "List1" 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 Global LineNumberClicked Global ItemClicked$ --put the second word of the mouseline into LineNumberClicked --********** --put the the value of the clickLine into ItemClicked$ --********** --put line LineNumberClicked of field "List1" 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" --'************************************* --'THE ITEMS IN Card3.ListExpanded WILL ALSO NEED ANOTHER INDENT ADDED TO THEM --'************************************* --'The new segment is now in Card3.ListExpanded --'It will need indents added to it. 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 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 ------------------------------------------------------- put LHSBlanks$ & PrecedingSpaces$ into PrecedingSpaces$ --EXPERIMENTALLY INCLUDED ------------------------------------------------------- --PATCH --Global LHSIndentInBlankChars --EXPERIMENTALLY REMOVED --put 0 into n --EXPERIMENTALLY REMOVED --put empty into PrecedingSpaces$ --EXPERIMENTALLY REMOVED --repeat until n = LHSIndentInBlankChars --EXPERIMENTALLY REMOVED --put n + 1 into n --EXPERIMENTALLY REMOVED --put (PrecedingSpaces$ & space) into PrecedingSpaces$ --EXPERIMENTALLY REMOVED --end repeat --EXPERIMENTALLY REMOVED ------------------------------------------------------- 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" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files sort lines of field "ListFilesField" of card "Card3" put field "ListFilesField" of card "Card3" into field "List2" of card "Card1" --*********** put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack 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$ --********** --put line LineNumberClicked of field "List1" 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$ --'e.g. c:\Program Files\-Adobe (Windows) 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 --LINUX end repeat put n into LastBackslashPos --e.g. PathToLineClicked$ = c:\francis\-posto --N.B. minus sign in front of posto (Windows) 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: --'Copy List3 back to List1: 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" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files sort lines of field "ListFilesField" of card "Card3" put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack 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$ --********** --put line LineNumberClicked of field "List1" 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 (Windows) --'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 --LINUX end repeat put n into LastBackslashPos --e.g. PathToLineClicked$ = c:\francis\ posto --N.B. chr$(160) sign in front of posto (Windows) put char 1 to LastBackslashPos of PathToLineClicked$ into LeftBit$ put char (LastBackslashPos + 2) to -1 of PathToLineClicked$ into RightBit$ put LeftBit$ & RightBit$ into PathToLineClicked$ --Form1.Text2.Text = 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: 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" --######################### HIDDEN FILES OPTION ############################ global showHiddenFiles if showHiddenFiles <> 1 then filter field "ListFilesField" of card "Card3" without ".*" /* repeat forever put 0 into dotLinesStillExist repeat for each line fieldLine in field "ListFilesField" of card "Card3" if char 1 of fieldLine = "." then put 1 into dotLinesStillExist end if end repeat if dotLinesStillExist = 0 then exit repeat put 0 into lineCounter repeat for each line fieldLine in field "ListFilesField" of card "Card3" put lineCounter + 1 into lineCounter if char 1 of fieldLine = "." then delete line lineCounter of field "ListFilesField" of card "Card3" exit repeat end if end repeat end repeat */ end if --######################### HIDDEN FILES OPTION ############################ call filter_out_files sort lines of field "ListFilesField" of card "Card3" put field "List1" of card "Card1" into field "plain" of card "Card1" call prettify_List1 of this stack 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 line LineNumberClicked of field "List1" 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$ --LINUX 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 CounterX repeat until CounterX = the number of lines in field "traceback_txt" of card "Card2" put (CounterX + 1) into CounterX put ((field "List1" of card "Card2") & (line CounterX of field "traceback_txt" of card "Card2") & return) into field "List1" of card "Card2" end repeat put CounterX into NumberOfLinesInTracebackFile --'It is the last line in this file that needs to be traced back put CounterX into field "LabelNumberOfLinesInTracebackFile" of card "Card2" put CounterX into LastLineListNumber put LastLineListNumber into field "LabelLastLineListNumber" of card "Card2" put 0 into CounterX 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 CounterX end if end repeat put CounterX into TracebackLineNumber put TracebackLineNumber into field "LabelTracebackLineNumber" of card "Card2" put CounterX 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 ###). --'************************************************************************************** --'NumberOfPrecedingBlanksPreviousLine = NumberOfBlanksOnLHSOfLastLineInTracebackFile --NumberOfPrecedingBlanksPreviousLine = NumberOfBlanksOnLHSOfLastLineInTracebackFile - 1 'to compensate for the adjustment above 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 CounterX 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 CounterX + 1 into CounterX clone field "LabelBlock0" of card "Card2" set the name of it to ("LabelBlock" & CounterX) set the visible of field ("LabelBlock" & CounterX) of card "Card2" to true --PROBABLY NOT NEC set the left of field ("LabelBlock" & CounterX) of card "Card2" to (the left of field ("LabelBlock" & (CounterX -1)) of card "Card2" + the width of field ("LabelBlock" & (CounterX -1)) of card "Card2") set the top of field ("LabelBlock" & CounterX) of card "Card2" to the top of field "LabelBlock0" of card "Card2" put char 3 to -1 of ThisItem$ into field ("LabelBlock" & CounterX) 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$ --LINUX repeat with c = CounterX down to 1 put OutputPath$ & field ("LabelBlock" & c) of card "Card2" & "/" into OutputPath$ --LINUX 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. --matchChunk("Hello","Hel") -- returns true 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 --------------------------------------------------------------------------------------------------------------------------- @ 2 cREVTable currentview cREVGeneral scriptChecksum HM8it| >NhandlerList 6rawKeyDown mouseUp mouseDown LineClickedWithNoIndent LineClickedWithNoIndentButPlus LineClickedWithNoIndentButMinus LineClickedWithNoIndentButChr160 LineClickedWithIndent LineClickedWithIndentAndPlus LineClickedWithIndentAndMinus LineClickedWithIndentAndChr160 TracebackSubroutine Do_Traceback filter_out_filesscriptSelection char 20454 to 20453scripteditorvscroll 2008revUniqueID 1118793781548 bookmarks scripteditorselection 9027tempScript prevHandler LineClickedWithIndentAndPlusscript pon rawKeyDown
end rawKeyDown
on mouseUp
--call prettify_List1Copy of this stack
--set the HTMLtext of field "List1" to the HTMLtext of field "List1Copy"
end mouseUp
on mouseDown
if the visible of field "suggestedFileName" is false then
disable button "OK" of card "Card1"
end if
global thisIsAFolderChooserWidget
if thisIsAFolderChooserWidget = 1 then
enable button "OK" of card "Card1"
end if
Global DoingSelect
If DoingSelect = 1 Then pass mouseDown
lock screen
--'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
--'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
--'**************************************************************************************
--put field "plain" into field "List1" --####################
Global LineNumberClicked
Global ItemClicked$
-------------------------------------------------------------------------
put the second word of the mouseline into LineNumberClicked
--put the the value of the clickLine into ItemClicked$ --e.g. +home (whole line)
--It seems that the LineNumberClicked is no longer being detected correctly (because of put field "plain" into field "List1"
--above??)
--Experiment:
--put 6 into LineNumberClicked --YOU NEED TO CLICK ON THE +home LINE
-----------------------------------------------------------------------
--EXPERIMENTAL FOR UNIVERSAL VERSION
--THIS LINE HAS BEEN MOVED UPWARDS (SEE BELOW)
put line LineNumberClicked of field "List1" into ItemClicked$
----------------------------------------------------------------------
--PATCH FOR UNIVERSAL EDITION:
if line 1 of field "plain" is empty then
delete line 1 of field "plain"
end if
----------------------------------------------------------------------
put field "plain" into field "List1" --####################
call Patch_To_Remove_Trailing_Blanks of this stack
--put line LineNumberClicked of field "List1" into ItemClicked$ --THIS LINE HAS BEEN MOVED UPWARDS
----The above has now been modified:
--put the second word of the mouseline into LineNumberClicked
----put LineNumberClicked --TEMP ONLY ********
----put field "List1Copy" into field "List1"
----THE ABOVE LINE SEEMS TO UPSET THE Card3 GetFolderButton mouseUp routine!!!
----This is not surprising, since you are changing List1 before the mouseDown routine has been completed!
--put line LineNumberClicked of field "List1Copy" into ItemClicked$ --e.g. +home (whole line)
----put ItemClicked$ --TEMP ONLY ********
-----------------------------------------------------------------------
if char 1 of ItemClicked$ <> " " Then
call LineClickedWithNoIndent
unlock screen
pass mouseDown
end if
if char 1 of ItemClicked$ = " " then
call LineClickedWithIndent
unlock screen
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 --LINUX
put SourceDirectory$ & PathBlock$ into HDPathToExpand$
Else
put SourceDirectory$ & "/" & PathBlock$ into HDPathToExpand$ --LINUX
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"
--'The new segment is now in Form3.ListExpanded
--'It will need indents added to it.
put empty into field "List3"
Global LineNumberClicked
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
--Global LineNumberClicked
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
--NewTreeNowMounted:
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
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
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"
--FilesAllListed:
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$
put line LineNumberClicked of field "List1" into ItemClicked$
Global SourceDirectory$
put char 3 to -1 of ItemClicked$ into EndBlock$
put SourceDirectory$ into DriveEtcBit$
If char -1 of DriveEtcBit$ = "/" Then --LINUX
put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$
end if
put (DriveEtcBit$ & "/" & EndBlock$) into PathToLineClicked$ --LINUX
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:
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:
--'Copy from List3 back to List1:
--------------------------------------------------
if LineNumberClicked = 1 then delete line 1 of field "List3" --*************************************
--------------------------------------------------
put field "List3" into field "List1"
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
select line LineNumberClicked of field "List1"
Global LineNumberSelectedInList1
put LineNumberClicked into LineNumberSelectedInList1
end LineClickedWithNoIndentButMinus
-----------------------------------------------------------------------------------
on 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 -REMOVED (Causes trouble)
Global ItemClicked$
--put the the value of the clickLine into ItemClicked$
put line LineNumberClicked of field "List1" into ItemClicked$
Global SourceDirectory$
put char 3 to -1 of ItemClicked$ into EndBlock$
put SourceDirectory$ into DriveEtcBit$
If char -1 of DriveEtcBit$ = "/" Then --LINUX
put char 1 to -2 of DriveEtcBit$ into DriveEtcBit$
end if
put (DriveEtcBit$ & "/" & EndBlock$) into PathToLineClicked$ --LINUX
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
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
--ShownAllFilesChr160:
select line LineNumberClicked of field "List1"
Global LineNumberSelectedInList1
put LineNumberClicked into LineNumberSelectedInList1
exit to top --NEW **************
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 line LineNumberClicked of field "List1" 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
Global LineNumberClicked
Global ItemClicked$
--put the second word of the mouseline into LineNumberClicked --**********
--put the the value of the clickLine into ItemClicked$ --**********
--put line LineNumberClicked of field "List1" 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"
--'*************************************
--'THE ITEMS IN Card3.ListExpanded WILL ALSO NEED ANOTHER INDENT ADDED TO THEM
--'*************************************
--'The new segment is now in Card3.ListExpanded
--'It will need indents added to it.
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
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
-------------------------------------------------------
put LHSBlanks$ & PrecedingSpaces$ into PrecedingSpaces$ --EXPERIMENTALLY INCLUDED
-------------------------------------------------------
--PATCH
--Global LHSIndentInBlankChars --EXPERIMENTALLY REMOVED
--put 0 into n --EXPERIMENTALLY REMOVED
--put empty into PrecedingSpaces$ --EXPERIMENTALLY REMOVED
--repeat until n = LHSIndentInBlankChars --EXPERIMENTALLY REMOVED
--put n + 1 into n --EXPERIMENTALLY REMOVED
--put (PrecedingSpaces$ & space) into PrecedingSpaces$ --EXPERIMENTALLY REMOVED
--end repeat --EXPERIMENTALLY REMOVED
-------------------------------------------------------
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" --***********
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
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$ --**********
--put line LineNumberClicked of field "List1" 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$
--'e.g. c:\Program Files\-Adobe (Windows)
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 --LINUX
end repeat
put n into LastBackslashPos
--e.g. PathToLineClicked$ = c:\francis\-posto --N.B. minus sign in front of posto (Windows)
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:
--'Copy List3 back to List1:
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"
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
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$ --**********
--put line LineNumberClicked of field "List1" 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 (Windows)
--'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 --LINUX
end repeat
put n into LastBackslashPos
--e.g. PathToLineClicked$ = c:\francis\ posto --N.B. chr$(160) sign in front of posto (Windows)
put char 1 to LastBackslashPos of PathToLineClicked$ into LeftBit$
put char (LastBackslashPos + 2) to -1 of PathToLineClicked$ into RightBit$
put LeftBit$ & RightBit$ into PathToLineClicked$
--Form1.Text2.Text = 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:
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"
put field "List1" of card "Card1" into field "plain" of card "Card1"
call prettify_List1 of this stack
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 line LineNumberClicked of field "List1" 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$ --LINUX
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 CounterX
repeat until CounterX = the number of lines in field "traceback_txt" of card "Card2"
put (CounterX + 1) into CounterX
put ((field "List1" of card "Card2") & (line CounterX of field "traceback_txt" of card "Card2") & return) into field "List1" of card "Card2"
end repeat
put CounterX into NumberOfLinesInTracebackFile
--'It is the last line in this file that needs to be traced back
put CounterX into field "LabelNumberOfLinesInTracebackFile" of card "Card2"
put CounterX into LastLineListNumber
put LastLineListNumber into field "LabelLastLineListNumber" of card "Card2"
put 0 into CounterX
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 CounterX
end if
end repeat
put CounterX into TracebackLineNumber
put TracebackLineNumber into field "LabelTracebackLineNumber" of card "Card2"
put CounterX 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 ###).
--'**************************************************************************************
--'NumberOfPrecedingBlanksPreviousLine = NumberOfBlanksOnLHSOfLastLineInTracebackFile
--NumberOfPrecedingBlanksPreviousLine = NumberOfBlanksOnLHSOfLastLineInTracebackFile - 1 'to compensate for the adjustment above
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 CounterX
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 CounterX + 1 into CounterX
clone field "LabelBlock0" of card "Card2"
set the name of it to ("LabelBlock" & CounterX)
set the visible of field ("LabelBlock" & CounterX) of card "Card2" to true --PROBABLY NOT NEC
set the left of field ("LabelBlock" & CounterX) of card "Card2" to (the left of field ("LabelBlock" & (CounterX -1)) of card "Card2" + the width of field ("LabelBlock" & (CounterX -1)) of card "Card2")
set the top of field ("LabelBlock" & CounterX) of card "Card2" to the top of field "LabelBlock0" of card "Card2"
put char 3 to -1 of ThisItem$ into field ("LabelBlock" & CounterX) 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$ --LINUX
repeat with c = CounterX down to 1
put OutputPath$ & field ("LabelBlock" & c) of card "Card2" & "/" into OutputPath$ --LINUX
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.
--matchChunk("Hello","Hel") -- returns true
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
---------------------------------------------------------------------------------------------------------------------------
+_Photos @ 1088 +howsoft front page @ 1088 Howsoft Rich Text Editor +OLD Linux Choosers @ 1088 rebol +shit @ 1088 SpamGobbler BOB .+test necessity of CSS for Google-Ubuntu font @ 1088 , +Ubuntu font @ 1088 @ 3 % ! @ List2 )8 aon rawKeyDown end rawKeyDown on mouseDown Global LineNumberClicked --REFERS TO List1 select line LineNumberClicked of field "List1" of card "Card1" enable button "OK" of card "Card1" Global FileItemClicked$ put the the value of the clickLine into FileItemClicked$ put FileItemClicked$ into field "suggestedFileName" end mouseDown @ 2 cREVTable currentview cREVGeneral scriptChecksum _v6=c'z'OBrevUniqueID 1118793845487 bookmarks handlerList rawKeyDown mouseDowntempScript prevHandler mouseDoubleUpscriptSelection char 338 to 337scripton rawKeyDown
end rawKeyDown
on mouseDown
Global LineNumberClicked --REFERS TO List1
select line LineNumberClicked of field "List1" of card "Card1"
enable button "OK" of card "Card1"
Global FileItemClicked$
put the the value of the clickLine into FileItemClicked$
put FileItemClicked$ into field "suggestedFileName"
end mouseDown
gtk-recordmydesktop.desktop hp laser.png officejet_cups.txt ubuntu-11.04-desktop-i386.iso @ x 3 &