I want the program to work as follows:
I paste text into the editor and click 'process'. It then shows me each line of text one at a time and should wait for me to click 'yes' or 'no' - at this point the current string will be written to one of two files. It should continue stepping through the text in the editor one line at a time until the end is reached.
The procedure below doesn't seem to work, and I have no idea why. It gets in a loop where it steps through the strings one at a time, but it doesn't wait for my yes/no input. What am I doing wrong?
Thanks!
Code: Select all
Procedure Process()
  
  fulltext$ = GetGadgetText(#Editor)
  string_length = 1+CountString(fulltext$,Chr(13)+Chr(10))
  
  OpenFile(0,GetGadgetText(#YesFilename))
  OpenFile(1,GetGadgetText(#YesFilename))
  
  For position = 1 To string_length
  
    currentstring$ = StringField(fulltext$,position,Chr(13)+Chr(10))
    cleanstring1$ = Trim(currentstring$,Chr(13))
    cleanstring2$ = Trim(cleanstring1$,Chr(10))
    cleanstring3$ = Trim(cleanstring2$)
    cleanstring$ = cleanstring3$
    
    SetGadgetText(#TextCurrentProc,cleanstring$)
    Delay(1000)
    
    Repeat
      
        If position = string_length
          Break
        EndIf
        
        Event = WaitWindowEvent()
         
        Select Event
         
          Case #Yes
            WriteStringN(0,cleanstring$)
      
          Case #No
            WriteStringN(0,cleanstring$)
             
        EndSelect
              
     Until Event = #PB_Event_Gadget
       
  Next
  
  CloseFile(0)
  CloseFile(1)
   
EndProcedure


