Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Speakeasy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    PBWin Speakeasy

    This started off as a little utility for my own purposes, but as the speech to text feature turned out to be a lot better than I expected, I took a little more time and made it a little more versatile.

    To use this program as for any speech to text purpose first take ten minutes or so and acquaint yourself with the voice recognition program found in the Ease of Access folder in the Start Menu.

    By right clicking on the dashboard, you will find an item 'Configuration'.

    On the sub-menu choose to set up your microphone and once that is done, select the next item 'Improve voice recognition' All of that only takes about 10 minutes, but the more time you spend familiarizing yourself with the features, the better your experience will be.

    The code for this app contains no element of Microsoft's voice recognition code.

    '*******************************************************************************
    'using the application:
    '
    Record
    'clicking the record bottomed will set the focus on the textbox. the textbox
    'must have focus for the speech engine to show what what was said.
    '
    Options
    'clicking the options button will allow you to set the options indicated in
    'the statusbars.
    '
    'Any and all of these options that are applicable are made after the text is
    'retrieved from the textbox and before the text is placed on the clipboard.
    '
    'The use header and use footer will place a divider at the start of the text
    'and at the end of the text.
    'In the header footer Char textbox you can place a character of your choice.
    '
    'Use prepend Char toggles the use of the remark character single quote. The
    'use of any other character in this instance is unlikely.
    '
    'By checking the auto clear textbox when you click the to clipboard button
    'that textbox is automatically cleared.
    '
    'By checking the auto minimize checkbox the window will be minimized when you
    'click the to clipboard button.
    '
    'The line length can be as large as 150 characters.
    '
    'Mixed case leaves the text unchanged.

    'one can always use a keyboard for any editing.

    Clear
    ''clicking the clear button will remove text from the textbox and reset the focus.
    '
    To Clipboard
    'clicking the to clipboard button gets the text from the textbox and prepends
    'a remarcharacter. it also truncates a line to the specified line length. the
    'remainder of the line will have the same character pretended to it.
    '
    Help
    'clicking the help button will bring you to lead this thread that will serve as 'the help file for this program.
    '
    'One can always use the keyboard to edit text.
    '
    'After a wee pause, if you say any of "Record", "Options", "Clear", "To 'Clipboard", or "Help", it will be the same as clicking the button.
    '
    'Discussion in this thread.
    Speakeasy.zip
    Code:
    #PBFORMS Created v2.01
    '------------------------------------------------------------------------------
    ' The first line in this file is a PB/Forms metastatement.
    ' It should ALWAYS be the first line of the file. Other
    ' PB/Forms metastatements are placed at the beginning and
    ' end of "Named Blocks" of code that should be edited
    ' with PBForms only. Do not manually edit or delete these
    ' metastatements or PB/Forms will not be able to reread
    ' the file correctly. See the PB/Forms documentation for
    ' more information.
    ' Named blocks begin like this: #PBFORMS BEGIN ...
    ' Named blocks end like this: #PBFORMS END ...
    ' Other PB/Forms metastatements such as:
    ' #PBFORMS DECLARATIONS
    ' are used by PB/Forms to insert additional code.
    ' Feel free to make changes anywhere else in the file.
    '------------------------------------------------------------------------------
    
    #COMPILE EXE
    #DIM ALL
    
    '------------------------------------------------------------------------------
    ' ** Includes **
    '------------------------------------------------------------------------------
    #PBFORMS Begin Includes
    #INCLUDE ONCE "WIN32API.INC"
    #PBFORMS End Includes
    '------------------------------------------------------------------------------
    #RESOURCE ICON, 7303, "micro1.ico"
    '------------------------------------------------------------------------------
    ' ** Constants **
    '------------------------------------------------------------------------------
    #PBFORMS Begin Constants
    %IDD_DIALOG1 = 101
    %IDC_RECORD = 1001
    %IDC_OPTIONS = 1002
    %IDC_HELPER = 1003
    %IDC_CLEAR = 1004
    %IDC_STATUSBAR1 = 1006
    %IDC_TOCLIPBOARD = 1007
    %IDC_TEXT = 1005
    %IDD_DIALOG2 = 102
    %IDC_USEHEADER = 1009
    %IDC_USEFOOTER = 1010
    %IDC_HEADERFOOTERCHAR = 1011
    %IDC_HFCHAR = 1012
    %IDC_MAXLINELENGTH = 1013
    %IDC_MLLENGTH = 1014
    %IDC_AUTOCLEARTEXTBOX = 1016
    %IDC_AUTOMINIMIZE = 1017
    %IDC_LABEL3 = 1018
    %IDC_TEXTBOX1 = 1019
    %IDC_USEPREPENDCHAR = 1020
    %IDC_FRAME1 = 1021
    %IDC_UPPER = 1022
    %IDC_MIXED = 1023
    %IDC_LOWER = 1024
    %IDC_STATUSBAR2 = 1025
    #PBFORMS End Constants
    %FALSE = 0
    %TRUE = 1
    '------------------------------------------------------------------------------
    GLOBAL hdr, ftr, char, linlen, autoclear, autominimize, done AS LONG
    GLOBAL defhdr, defftr, defchar, deflinlen, defautoclear, defautominimize AS LONG
    GLOBAL prepend, prepchar, casing, defprepend, defprepchar, defcasing AS LONG
    GLOBAL dlg1, dlg2 AS DWORD
    '------------------------------------------------------------------------------
    ' ** Declarations **
    '------------------------------------------------------------------------------
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    DECLARE CALLBACK FUNCTION ShowDIALOG2Proc()
    DECLARE FUNCTION ShowDIALOG2(BYVAL hDlg AS DWORD) AS LONG
    #PBFORMS Declarations
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    ' ** Main Application Entry Point **
    '------------------------------------------------------------------------------
    FUNCTION PBMAIN()
    ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    ' ** CallBacks **
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowDIALOG1Proc()
    LOCAL fn, dlgx, dlgy, lng, spot, howmany, ndx, nndx, crlf, strt, subcnt, spotted, chop AS LONG
    STATIC fnm AS STRING
    LOCAL words, reword, worded AS STRING
    LOCAL locs() AS LONG
    LOCAL subs() AS STRING
    DIM locs(1)
    DIM subs(1)
    SELECT CASE AS LONG CB.MSG
    CASE %WM_INITDIALOG
    ' Initialization handler
    
    STATUSBAR SET PARTS CB.HNDL, %IDC_STATUSBAR1, 100, 100, 100, 100, 120, 9999
    STATUSBAR SET PARTS CB.HNDL, %IDC_STATUSBAR2, 230, 230, 9999
    defhdr = 1 'Load the options defaults
    defftr = 1
    defchar = 95
    deflinlen = 80
    defautoclear = 1
    defautominimize = 1
    defprepend = 1
    defprepchar = 39
    defcasing = %IDC_MIXED
    
    fn=FREEFILE
    fnm=CURDIR$+"\who_has.ini"
    IF ISFILE ("who_has.ini") THEN 'Load that ini file
    OPEN fnm FOR INPUT AS #fn
    INPUT #fn, hdr, ftr, char, linlen, autoclear, autominimize, dlgx, dlgy, prepend, prepchar, casing
    CLOSE #fn
    ELSE
    DIALOG SET TEXT CB.HNDL, fnm
    hdr = defhdr
    ftr = defftr
    char = defchar
    linlen = deflinlen
    autoclear = defautoclear
    autominimize = defautominimize
    prepend = defprepend
    prepchar = defprepchar
    casing = defcasing
    
    END IF
    CONTROL SET OPTION CB.HNDL, %IDC_MIXED, %IDC_UPPER, %IDC_LOWER
    IF hdr = %false THEN
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 1, 0, " Header OFF"
    ELSE
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 1, 0, " Header ON"
    END IF
    IF ftr = %false THEN
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 2, 0, " Footer OFF"
    ELSE
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 2, 0, " Footer ON"
    END IF
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 3, 0, " H/F char "+CHR$(char)
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 4, 0, " Length "+FORMAT$(linlen)
    IF autoclear = %false THEN
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 5, 0, " AutoClear OFF"
    ELSE
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 5, 0, " AutoClear ON"
    END IF
    IF autominimize = %false THEN
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 6, 0, " AutoMinimize OFF"
    ELSE
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR1, 6, 0, " AutoMinimize ON"
    END IF
    
    IF prepend=%false THEN
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR2, 1, 0, " Prepend OFF"
    ELSE
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR2, 1, 0, " Prepend ON"
    END IF
    IF prepchar=%false THEN
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR2, 2, 0, " Prepend NONE"
    ELSE
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR2, 2, 0, " Prepend " +CHR$(prepchar)
    END IF
    SELECT CASE casing
    CASE %IDC_UPPER
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR2, 3, 0, " UPPER case"
    CASE %IDC_MIXED
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR2, 3, 0, " MIXED case"
    CASE %IDC_LOWER
    STATUSBAR SET TEXT CB.HNDL, %IDC_STATUSBAR2, 3, 0, " LOWER case"
    END SELECT
    CONTROL SET FOCUS CB.HNDL, %IDC_TEXT
    dlg1= CB.HNDL
    
    CASE %WM_NCACTIVATE
    STATIC hWndSaveFocus AS DWORD
    IF ISFALSE CB.WPARAM THEN
    ' Save control focus
    hWndSaveFocus = GetFocus()
    ELSEIF hWndSaveFocus THEN
    ' Restore control focus
    SetFocus(hWndSaveFocus)
    hWndSaveFocus = 0
    END IF
    CASE %WM_DESTROY 'Store the options and save the file
    fn=FREEFILE
    DIALOG GET LOC CB.HNDL TO dlgx, dlgy
    OPEN fnm FOR OUTPUT AS #fn
    WRITE #fn, hdr, ftr, char, linlen, autoclear, autominimize, dlgx, dlgy, prepend, prepchar, casing
    CLOSE #fn
    CASE %WM_COMMAND
    ' Process control notifications
    SELECT CASE AS LONG CB.CTL
    CASE %IDC_STATUSBAR2
    
    CASE %IDC_RECORD 'Set the focus on the textbox
    IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
    CONTROL SET FOCUS CB.HNDL, %IDC_TEXT
    END IF
    
    CASE %IDC_OPTIONS
    IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN 'The options dialog
    ShowDIALOG2 %HWND_DESKTOP
    DIALOG GET LOC CB.HNDL TO dlgx, dlgy
    OPEN fnm FOR OUTPUT AS #fn
    WRITE #fn, hdr, ftr, char, linlen, autoclear, autominimize, dlgx, dlgy, prepend, prepchar, casing
    CLOSE #fn
    done=0
    END IF
    
    CASE %IDC_HELPER 'Commentator help
    IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
    LOCAL rslt AS LONG
    LOCAL urls AS STRING
    urls= "https://forum.powerbasic.com/forum/user-to-user-discussions/source-code/812859-speakeasy"
    rslt = ShellExecute( CB.HNDL, "Open", (urls), $NUL, $NUL, %SW_SHOWNORMAL)
    CONTROL SET FOCUS CB.HNDL, %IDC_TEXT
    ' MSGBOX "%IDC_HELPER=" + FORMAT$(%IDC_HELPER), %MB_TASKMODAL
    END IF
    
    CASE %IDC_CLEAR
    IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN 'Clear the textbox
    CONTROL SET TEXT CB.HNDL, %IDC_TEXT, ""
    CONTROL REDRAW CB.HNDL, %IDC_TEXT
    CONTROL SET FOCUS CB.HNDL, %IDC_TEXT
    END IF
    
    CASE %IDC_TEXT
    
    CASE %IDC_STATUSBAR1
    CASE %IDC_TOCLIPBOARD 'Set the text on the clipboard
    IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN
    REDIM locs(1), subs(1)
    RESET spotted
    CONTROL GET TEXT CB.HNDL, %IDC_TEXT TO words 'Get the text from the textbox
    IF casing= %IDC_UPPER THEN
    words=UCASE$(words)
    ELSEIF casing=%IDC_LOWER THEN
    words=LCASE$(words)
    END IF
    lng=LEN(words)
    crlf=PARSECOUNT(words, $CRLF) 'Find out how many lines
    REDIM subs(1 TO crlf)
    PARSE words, subs(), $CRLF
    FOR ndx=1 TO crlf 'Put the lights in an array
    subs(ndx)=CHR$(prepchar)+subs(ndx)
    NEXT ndx
    FOR ndx=1 TO crlf
    IF LEN(subs(ndx))>linlen THEN 'If a line is too long put in a carriage return
    reword=subs(ndx)
    locations locs(), reword, " "
    FOR nndx=UBOUND(locs()) TO LBOUND(locs()) STEP -1
    reword=STRINSERT$(reword,$CRLF+CHR$(prepchar),locs(nndx)+1)
    NEXT nndx
    subs(ndx)=reword
    END IF
    NEXT ndx
    words=""
    words=JOIN$(subs(),$CRLF) 'Make a single string from the array
    
    IF ISTRUE hdr THEN 'Add the header line
    words=CHR$(prepchar)+REPEAT$(linlen-1,CHR$(char))+$CRLF+words
    END IF
    IF ISTRUE ftr THEN 'Add that footer line
    words+=$CRLF+CHR$(prepchar)+REPEAT$(linlen-1,CHR$(char))
    END IF
    IF ISTRUE autoclear THEN
    CONTROL SET TEXT CB.HNDL, %IDC_TEXT, ""
    CONTROL REDRAW CB.HNDL, %IDC_TEXT
    CONTROL SET FOCUS CB.HNDL, %IDC_TEXT
    ELSE
    CONTROL SET FOCUS CB.HNDL, %IDC_TEXT
    END IF
    CLIPBOARD SET TEXT words
    
    END IF
    
    END SELECT
    END SELECT
    END FUNCTION
    
    '------------------------------------------------------------------------------
    SUB locations(locs() AS LONG, target AS STRING, mask AS STRING)
    LOCAL ndx, spot, notch, trig, howmany AS LONG
    LOCAL del() AS LONG
    spot=1
    howmany= TALLY(target,mask)
    notch=LEN(target)\linlen
    trig=notch
    REDIM locs(1 TO notch)
    REDIM del(1 TO howmany)
    FOR ndx=1 TO howmany
    del(ndx)=INSTR(spot,target, mask)
    spot=del(ndx)+1
    NEXT ndx
    FOR ndx=howmany TO 1 STEP -1
    SELECT CASE notch
    CASE 1
    IF del(ndx)=linlen-1 THEN
    locs(1)=del(ndx)
    EXIT FOR
    ELSEIF del(ndx)<linlen-1 AND del(ndx+1)>linlen-1 THEN
    locs(1)=del(ndx)
    EXIT FOR
    END IF
    
    CASE >1
    IF del(ndx)=linlen*trig-trig THEN
    locs(trig)=del(ndx)
    DECR trig
    ELSEIF del(ndx)<linlen*trig-trig AND del(ndx+1)>linlen*trig-trig THEN
    locs(trig)=del(ndx)
    DECR trig
    END IF
    IF trig=0 THEN EXIT FOR
    END SELECT
    NEXT ndx
    FOR ndx=1 TO notch
    NEXT ndx
    END SUB
    '------------------------------------------------------------------------------
    ' ** Dialogs **
    '------------------------------------------------------------------------------
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    LOCAL lRslt AS LONG
    
    #PBFORMS Begin Dialog %IDD_DIALOG1->->
    LOCAL hDlg AS DWORD
    LOCAL hFont1 AS DWORD
    
    DIALOG NEW PIXELS, hParent, "Speakeasy", 10, 114, 704, 230, %WS_POPUP OR _
    %WS_BORDER OR %WS_DLGFRAME OR %WS_SYSMENU OR %WS_MINIMIZEBOX OR _
    %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR _
    %DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR _
    %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
    DIALOG SET COLOR hDlg, -1, RGB(172, 196, 196)
    CONTROL ADD BUTTON, hDlg, %IDC_RECORD, "Record", 8, 32, 75, 24
    CONTROL ADD BUTTON, hDlg, %IDC_OPTIONS, "Options", 88, 32, 75, 24
    CONTROL ADD BUTTON, hDlg, %IDC_HELPER, "Help", 624, 32, 75, 24
    CONTROL ADD BUTTON, hDlg, %IDC_CLEAR, "Clear", 168, 32, 75, 24
    CONTROL ADD TEXTBOX, hDlg, %IDC_TEXT, "", 8, 64, 692, 128, %WS_CHILD OR _
    %WS_VISIBLE OR %WS_TABSTOP OR %ES_LEFT OR %ES_MULTILINE OR _
    %ES_AUTOVSCROLL OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR _
    %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
    CONTROL ADD STATUSBAR, hDlg, %IDC_STATUSBAR1, "", 0, 0, 0, 0
    CONTROL ADD STATUSBAR, hDlg, %IDC_STATUSBAR2, "", 0, 0, 0, 0, %CCS_TOP, _
    %WS_EX_STATICEDGE OR %WS_EX_CLIENTEDGE
    CONTROL ADD BUTTON, hDlg, %IDC_TOCLIPBOARD, "To Clipboard", 272, 32, _
    128, 24
    
    FONT NEW "Lucida Console", 10, 0, %ANSI_CHARSET TO hFont1
    
    CONTROL SET FONT hDlg, -1, hFont1
    CONTROL SET FONT hDlg, %IDC_RECORD, hFont1
    CONTROL SET FONT hDlg, %IDC_OPTIONS, hFont1
    CONTROL SET FONT hDlg, %IDC_HELPER, hFont1
    CONTROL SET FONT hDlg, %IDC_CLEAR, hFont1
    CONTROL SET FONT hDlg, %IDC_TEXT, hFont1
    CONTROL SET FONT hDlg, %IDC_STATUSBAR1, hFont1
    CONTROL SET FONT hDlg, %IDC_TOCLIPBOARD, hFont1
    CONTROL SET FONT hDlg, %IDC_STATUSBAR2, hFont1
    #PBFORMS End Dialog
    DIALOG SET ICON hDlg, "#7303"
    DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
    
    #PBFORMS Begin CleanUp %IDD_DIALOG1
    FONT END hFont1
    #PBFORMS End CleanUp
    
    FUNCTION = lRslt
    END FUNCTION
    '------------------------------------------------------------------------------
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowDIALOG2Proc()
    LOCAL spec AS STRING
    SELECT CASE AS LONG CB.MSG
    CASE %WM_INITDIALOG
    ' Initialization handler
    dlg2=CB.HNDL
    CONTROL SET CHECK CB.HNDL, %IDC_USEHEADER, hdr
    CONTROL SET CHECK CB.HNDL, %IDC_USEFOOTER, ftr
    CONTROL SET TEXT CB.HNDL, %IDC_HFCHAR, CHR$(char)
    CONTROL SET TEXT CB.HNDL, %IDC_MLLENGTH, FORMAT$(linlen)
    CONTROL SET TEXT CB.HNDL, %IDC_TEXTBOX1, CHR$(prepchar)
    CONTROL SET CHECK CB.HNDL, %IDC_AUTOCLEARTEXTBOX, autoclear
    CONTROL SET CHECK CB.HNDL, %IDC_AUTOMINIMIZE, autominimize
    CONTROL SET CHECK CB.HNDL, %IDC_USEPREPENDCHAR, prepend
    CONTROL SET OPTION CB.HNDL, casing, %IDC_UPPER, %IDC_LOWER
    CASE %WM_NCACTIVATE
    STATIC hWndSaveFocus AS DWORD
    IF ISFALSE CB.WPARAM THEN
    ' Save control focus
    hWndSaveFocus = GetFocus()
    ELSEIF hWndSaveFocus THEN
    ' Restore control focus
    SetFocus(hWndSaveFocus)
    hWndSaveFocus = 0
    END IF
    
    CASE %WM_COMMAND
    ' Process control notifications
    SELECT CASE AS LONG CB.CTL
    CASE %IDC_UPPER
    casing= %IDC_UPPER
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR2, 3, 0, " UPPER case"
    CASE %IDC_MIXED
    casing= %IDC_MIXED
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR2, 3, 0, " MIXED case"
    CASE %IDC_LOWER
    casing= %IDC_LOWER
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR2, 3, 0, " LOWER case"
    CASE %IDC_TEXTBOX1
    
    CASE %IDC_USEPREPENDCHAR
    CONTROL GET CHECK CB.HNDL, %IDC_USEPREPENDCHAR TO prepend
    
    CASE %IDC_USEHEADER
    CONTROL GET CHECK CB.HNDL, %IDC_USEHEADER TO hdr
    CASE %IDC_USEFOOTER
    CONTROL GET CHECK CB.HNDL, %IDC_USEFOOTER TO ftr
    
    CASE %IDC_HFCHAR
    
    CASE %IDC_MLLENGTH
    
    CASE %IDC_AUTOCLEARTEXTBOX
    CONTROL GET CHECK CB.HNDL, %IDC_AUTOCLEARTEXTBOX TO autoclear
    
    CASE %IDC_AUTOMINIMIZE
    CONTROL GET CHECK CB.HNDL, %IDC_AUTOMINIMIZE TO autominimize
    
    END SELECT
    CONTROL GET TEXT CB.HNDL, %IDC_HFCHAR TO spec
    IF LEN(spec)>1 THEN
    char=ASC(LEFT$(spec,1))
    ELSEIF LEN(spec)=0 THEN
    char=defchar
    ELSE
    char=ASC(spec)
    END IF
    CONTROL GET TEXT CB.HNDL, %IDC_MLLENGTH TO spec
    IF VAL(spec)<40 OR VAL(spec)>150 THEN
    linlen=deflinlen
    ELSE
    linlen=VAL(spec)
    END IF
    CONTROL GET TEXT CB.HNDL, %IDC_TEXTBOX1 TO spec
    IF LEN(spec)>1 THEN
    prepchar=ASC(LEFT$(spec,1))
    ELSEIF LEN(spec)=0 THEN
    prepchar=0
    ELSE
    prepchar=ASC(spec)
    END IF
    
    IF hdr=0 THEN
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 1, 0, " Header OFF"
    ELSE
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 1, 0, " Header ON"
    END IF
    IF ftr = %false THEN
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 2, 0, " Footer OFF"
    ELSE
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 2, 0, " Footer ON"
    END IF
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 3, 0, " H/F char "+CHR$(char)
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 4, 0, " Length "+FORMAT$(linlen)
    IF autoclear = %false THEN
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 5, 0, " AutoClear OFF"
    ELSE
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 5, 0, " AutoClear ON"
    END IF
    IF autominimize = %false THEN
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 6, 0, " AutoMinimize OFF"
    ELSE
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR1, 6, 0, " AutoMinimize ON"
    END IF
    
    IF prepend=%false THEN
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR2, 1, 0, " Prepend OFF"
    ELSE
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR2, 1, 0, " Prepend ON"
    END IF
    IF prepchar=%false THEN
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR2, 2, 0, " Prepend NONE"
    ELSE
    STATUSBAR SET TEXT dlg1, %IDC_STATUSBAR2, 2, 0, " Prepend " +CHR$(prepchar)
    END IF
    END SELECT
    
    END FUNCTION
    '------------------------------------------------------------------------------
    
    '------------------------------------------------------------------------------
    FUNCTION ShowDIALOG2(BYVAL hParent AS DWORD) AS LONG
    LOCAL lRslt AS LONG
    
    #PBFORMS Begin Dialog %IDD_DIALOG2->->
    LOCAL hDlg AS DWORD
    LOCAL hFont1 AS DWORD
    
    DIALOG NEW PIXELS, hParent, "Speakeasy Options", 105, 106, 374, 235, _
    %WS_POPUP OR %WS_BORDER OR %WS_DLGFRAME OR %WS_SYSMENU OR _
    %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR _
    %DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR _
    %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
    CONTROL ADD CHECKBOX, hDlg, %IDC_USEHEADER, "Use Header", 8, 8, 150, 16, _
    %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_TEXT OR %BS_AUTOCHECKBOX _
    OR %BS_NOTIFY OR %BS_LEFT OR %BS_VCENTER, %WS_EX_LEFT OR _
    %WS_EX_LTRREADING
    CONTROL ADD CHECKBOX, hDlg, %IDC_USEFOOTER, "Use Footer", 8, 24, 150, 17, _
    %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %BS_TEXT OR %BS_AUTOCHECKBOX _
    OR %BS_NOTIFY OR %BS_LEFT OR %BS_VCENTER, %WS_EX_LEFT OR _
    %WS_EX_LTRREADING
    CONTROL ADD LABEL, hDlg, %IDC_HEADERFOOTERCHAR, "Header/Footer Char", _
    165, 8, 120, 16
    CONTROL ADD TEXTBOX, hDlg, %IDC_HFCHAR, "*", 304, 8, 30, 21, %WS_CHILD OR _
    %WS_VISIBLE OR %WS_TABSTOP OR %ES_CENTER OR %ES_AUTOHSCROLL, _
    %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
    %WS_EX_RIGHTSCROLLBAR
    CONTROL ADD LABEL, hDlg, %IDC_MAXLINELENGTH, "Line Length", 164, 72, _
    120, 16
    CONTROL ADD TEXTBOX, hDlg, %IDC_MLLENGTH, "80", 303, 72, 30, 21, %WS_CHILD _
    OR %WS_VISIBLE OR %WS_TABSTOP OR %ES_CENTER OR %ES_AUTOHSCROLL OR _
    %ES_NUMBER, %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
    %WS_EX_RIGHTSCROLLBAR
    CONTROL ADD CHECKBOX, hDlg, %IDC_AUTOCLEARTEXTBOX, "Auto Clear Textbox", 8, _
    72, 150, 16
    CONTROL ADD CHECKBOX, hDlg, %IDC_AUTOMINIMIZE, "Auto Minimize", 8, 88, 150, _
    16
    CONTROL ADD LABEL, hDlg, %IDC_LABEL3, "Prepend Char", 164, 40, 120, 16
    CONTROL ADD TEXTBOX, hDlg, %IDC_TEXTBOX1, CHR$(prepchar), 303, 40, 30, 21, %WS_CHILD _
    OR %WS_VISIBLE OR %WS_TABSTOP OR %ES_CENTER, %WS_EX_CLIENTEDGE OR _
    %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
    
    CONTROL ADD FRAME, hDlg, %IDC_FRAME1, "Case", 8, 112, 144, 112,%WS_GROUP OR %WS_TABSTOP
    CONTROL ADD OPTION, hDlg, %IDC_UPPER, "UPPER", 16, 136, 128, 25
    CONTROL ADD OPTION, hDlg, %IDC_MIXED, "MIXED", 16, 161, 128, 25
    CONTROL ADD OPTION, hDlg, %IDC_LOWER, "LOWER", 16, 186, 128, 25
    CONTROL ADD CHECKBOX, hDlg, %IDC_USEPREPENDCHAR, "Use Prepend Char", 8, 40, _
    150, 17, %WS_CHILD OR %WS_VISIBLE OR %WS_GROUP OR %WS_TABSTOP OR %BS_TEXT OR _
    %BS_AUTOCHECKBOX OR %BS_NOTIFY OR %BS_LEFT OR %BS_VCENTER, %WS_EX_LEFT _
    OR %WS_EX_LTRREADING
    
    FONT NEW "MS Sans Serif", 10, 0, %ANSI_CHARSET TO hFont1
    
    CONTROL SET FONT hDlg, -1, hFont1
    CONTROL SET FONT hDlg, %IDC_USEHEADER, hFont1
    CONTROL SET FONT hDlg, %IDC_USEFOOTER, hFont1
    CONTROL SET FONT hDlg, %IDC_HEADERFOOTERCHAR, hFont1
    CONTROL SET FONT hDlg, %IDC_HFCHAR, hFont1
    CONTROL SET FONT hDlg, %IDC_MAXLINELENGTH, hFont1
    CONTROL SET FONT hDlg, %IDC_MLLENGTH, hFont1
    CONTROL SET FONT hDlg, %IDC_AUTOCLEARTEXTBOX, hFont1
    CONTROL SET FONT hDlg, %IDC_AUTOMINIMIZE, hFont1
    CONTROL SET FONT hDlg, %IDC_LABEL3, hFont1
    CONTROL SET FONT hDlg, %IDC_TEXTBOX1, hFont1
    CONTROL SET FONT hDlg, %IDC_USEPREPENDCHAR, hFont1
    CONTROL SET FONT hDlg, %IDC_FRAME1, hFont1
    CONTROL SET FONT hDlg, %IDC_UPPER, hFont1
    CONTROL SET FONT hDlg, %IDC_MIXED, hFont1
    CONTROL SET FONT hDlg, %IDC_LOWER, hFont1
    #PBFORMS End Dialog
    DIALOG SET ICON hDlg, "#7303"
    DIALOG SHOW MODAL hDlg, CALL ShowDIALOG2Proc TO lRslt
    
    #PBFORMS Begin CleanUp %IDD_DIALOG2
    FONT END hFont1
    #PBFORMS End CleanUp
    
    FUNCTION = lRslt
    END FUNCTION
    '------------------------------------------------------------------------------
    Attached Files
    Rod
    In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.
Working...
X
😀
🥰
🤢
😎
😡
👍
👎