1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Re-arranging Toolbar Buttons in TCC 11

Discussion in 'T&T - Scripting' started by Joe Caverly, Oct 19, 2009.

  1. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    680
    Likes Received:
    8
    Hi,
    Over in the Support section of this Forum, I initiated a thread titled "Move Buttons Between Tabbed Toolbars".

    Rex said this was not supported in the Tab Control at present, but said it will hopefully be available in a future version.

    Until then, here is my solution for re-arranging the Toolbar Buttons. I have a bug in the program (see below), so if anyone can provide a solution to the bug, it would be appreciated.

    Note that this was written for use with TCC 11.00.27.
    Rex made some changes to the output of TCTOOLBAR, which this batch file takes into account, so it will not work with previous builds.

    Joe

    Code:
    :: BTNSORT.BTM
    ::
    :: PURPOSE: To sort the TCMD Buttons in the toolbar
    ::
    :: NOTE: Since drag-and-drop sorting of buttons in the toolbar is not available yet,
    ::       this batch file will take a file, generated by doing a;
    ::
    :: TCTOOLBAR /W unsorted.ini
    ::
    ::       allowing you to cut-and-paste the button lines in the unsorted.ini file,
    ::       using a plain text editor, such as NOTEPAD,
    ::       and then sorting the buttons to a file called SORTED.INI
    ::
    :: BUGS: One of my buttons has a URL with part of the URL being;
    ::       all_projects.phpcpid=5c339ad2cf6f1c25ea664266bec482db
    ::
    ::       SETDOS is not my friend, because the = sign is causing me problems, in that the above line
    ::       is being written out as;
    ::
    ::       all_projects.php?cpid
    ::
    :: So, BE CAREFUL, USE AT YOUR OWN RISK, and CHECK THE SORTED.INI FILE BEFORE USING IT!
    ::
    @setlocal
    @echo off
    ::
    :: Check to see that a file has been entered as a parameter
    ::
    if %# LT 1 goto usage
    ::
    :: Check to see if the file exits
    ::
    if not exist %1 goto badfile
    ::
    ::
    setdos /X-57
    set MaxLines=%@lines[%1]
    set ButtonKount=0
    if exist sorted.ini del sorted.ini > nul
    do i = 0 to %MaxLines
      set TheLine=%@line[%1,%i]
      if %@left[8,%TheLine] eq [Toolbar set ButtonKount=1
      if %@left[1,%TheLine] eq B gosub FoundaButton
      if %@left[1,%TheLine] ne B echo %TheLine >> sorted.ini
    enddo
    setdos /X+57
    endlocal
    :eoj
    quit
    ::
    :: Found A Button
    ::
    :FoundaButton
     set ButtonNumber=%@field["=",0,%TheLine]
     set ButtonNumber=%@filter[0123456789,%ButtonNumber]
     set TheRest=%@field["=",1,%TheLine]
     echos B >> sorted.ini
     echos %ButtonKount >> sorted.ini
     echos = >> sorted.ini
     echo %TheRest >> sorted.ini
     set ButtonKount=%@inc[%ButtonKount]
    return
    ::
    :: Usage
    ::
    :usage
     echo USAGE: BTNSORT.BTM filewithbuttonstosort
     echo.
     echo Step 1: TCTOOLBAR /w unsorted.ini
     echo.
     echo Step 2: NOTEPAD unsorted.ini
     echo.
     echo Step 3: Change the order of the buttons as desired
     echo.
     echo Step 4: Save the unsorted.ini file, then exit NOTEPAD
     echo.
     echo BTNSORT unsorted.ini
     echo.
     echo If all goes well, sorted.ini will be created, with all of your buttons in proper order.
     echo.
     echo To reset your toolbar with the new arrangement;
     echo.
     echo TCTOOLBAR /c
     echo TCTOOLBAR /r sorted.ini
     goto eoj
    ::
    :; Bad File
    ::
    :badfile
     echo The file %1 does not exist.
     goto eoj
    
     

Share This Page