Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB64-PE Sample Showcase
#30
fixed an error occuring in multifile selection

this is the new code that runs ok

Code: (Select All)
Sub RunFile (file$, I%)
    ReDim As String Dir(0), File(0)
    $If WIN Then
        slash$ = "\"
    $Else
            slash$ = "/"
    $End If
    GetFileList file$, Dir(), File()
    'first, count bas files
    max = UBound(File)
    ReDim bbas$(max)
    For i = 1 To max
        If LCase$(Right$(File(i), 4)) = ".bas" Then counter = counter + 1: bas$ = File(i): num = i: bbas$(counter) = bas$
    Next
    If counter < max Then ReDim _Preserve bbas$(counter)

    ' selecting file.bas to run
    If SI(I%).Status = "Multifile" Then
        'pop up menu with files .BAS
        a& = _Dest
        _Dest 0
        chosen = 1
        Locate 10, 45: Print "arrows " + Chr$(24) + " " + Chr$(25) + " for choosing and Enter for running"
        Do
            Locate 12, 45
            For i = 1 To counter

                If i = chosen Then Color Black, Blue Else Color White, Black
                Locate , 45: Print bbas$(i)

            Next
            k = _KeyHit
            Select Case k
                Case 18432
                    'up
                    If chosen > 1 Then chosen = chosen - 1
                Case 20480:
                    'down
                    If chosen < counter Then chosen = chosen + 1
            End Select
            _Dest a&
            _Display

        Loop Until k = 13
        bas$ = bbas$(chosen)
    ElseIf LCase$(Right$(_Trim$(SI(I%).Status), 4)) = ".bas" Then
        ' it is a chain of programs and status is the head of the chain
        bas$ = LCase$(_Trim$(SI(I%).Status))
    ElseIf SI(I%).Status = "Monofile" Or counter = 1 Then
        ' do  nothing because file has already been selected
    End If

    ' running file.bas choosen
    '    If counter = 1 Then
    path$ = _CWD$ + slash$ + file$ + slash$
    exe$ = path$ + Left$(bas$, Len(bas$) - 4) + ".exe"
    If _FileExists(exe$) Then 'see if that bas file has been turned into an exe file already
        Shell Chr$(34) + exe$ + Chr$(34) 'if so, then just run it
    Else
        b$ = path$ + bas$
        If _FileExists("..\qb64pe.exe") Then pe$ = "pe" Else pe$ = "" ' path corrected for working both with QB64 both QB64pe
        Shell _Hide "..\qb64" + pe$ + " -c " + Chr$(34) + b$ + Chr$(34) + " -o " + Chr$(34) + exe$ + Chr$(34)
        Shell Chr$(34) + exe$ + Chr$(34)
    End If
    '   End If
    screenchanged = -1
    _KeyClear
End Sub
Reply


Messages In This Thread
QB64-PE Sample Showcase - by SMcNeill - 08-14-2022, 04:00 PM
RE: QB64-PE Sample Showcase - by Pete - 08-14-2022, 04:29 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-14-2022, 04:42 PM
RE: QB64-PE Sample Showcase - by Pete - 08-14-2022, 05:39 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-14-2022, 05:08 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-14-2022, 05:42 PM
RE: QB64-PE Sample Showcase - by vince - 08-14-2022, 07:50 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-14-2022, 08:53 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-14-2022, 10:10 PM
RE: QB64-PE Sample Showcase - by dbox - 08-14-2022, 11:48 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-15-2022, 12:04 AM
RE: QB64-PE Sample Showcase - by bplus - 08-14-2022, 11:51 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-15-2022, 12:06 AM
RE: QB64-PE Sample Showcase - by bplus - 08-15-2022, 12:07 AM
RE: QB64-PE Sample Showcase - by mnrvovrfc - 08-16-2022, 09:16 AM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-16-2022, 01:39 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-21-2022, 07:00 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 08-21-2022, 07:07 PM
RE: QB64-PE Sample Showcase - by justsomeguy - 09-02-2022, 09:33 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 09-02-2022, 09:36 PM
RE: QB64-PE Sample Showcase - by grymmjack - 09-12-2023, 11:41 PM
RE: QB64-PE Sample Showcase - by grymmjack - 09-13-2023, 12:06 AM
RE: QB64-PE Sample Showcase - by TempodiBasic - 10-09-2023, 11:29 PM
RE: QB64-PE Sample Showcase - by SMcNeill - 10-10-2023, 12:05 AM
RE: QB64-PE Sample Showcase - by SpriggsySpriggs - 10-10-2023, 06:49 AM
RE: QB64-PE Sample Showcase - by bplus - 10-10-2023, 09:41 AM
RE: QB64-PE Sample Showcase - by TempodiBasic - 10-11-2023, 12:06 AM
RE: QB64-PE Sample Showcase - by TempodiBasic - 10-11-2023, 01:20 PM
RE: QB64-PE Sample Showcase - by TempodiBasic - 10-25-2023, 01:37 AM
RE: QB64-PE Sample Showcase - by TempodiBasic - 11-01-2023, 07:27 PM



Users browsing this thread: 6 Guest(s)