I am testing LiveCode 5.5 on Mac OS 10.7.4 and am experimenting some problems with a simple project.
Scripts have been pasted from SC 4.63 into the buttons of the LiveCode stack and modified to match LiveCode syntax. Obviously, the translation is not perfect…
One card, with 2 fields containing accounting data, 2 buttons (Import and Convert). The purpose is to convert a file to match the requirements of my accountant.
The first field (ListeFournisseurs) contains the list of the providers names and codes:
08000001,SNCF
08000002,Restaurant
08000003,Autres fournisseurs
08000004,Decitre
08000005,Leclerc
08000006,Orange
etc.
The second field (ListeOperations) is populated by data using the first button, Import, which works fine. I cannot post a sample of this data here, as it is confidential.
Here is the script of the Convert button, which is supposed to replace some char strings by the provider name when its code is detected at the beginning of a line (in this line and the following lines) :
Code: Select all
on mouseUp
   global gFichier
   lock screen
   put the text of fld "ListeOperations" into tListe
   repeat with i = 1 to the number of lines in tListe
      if char 2 to 3 of line i of tListe = "08" then
         put char 2 to 9 of line i of tListe into tCode
         find word tCode in fld "ListeFournisseurs"
         put the foundLine into tLigne
         select before fld "ListeFournisseurs"
         if tLigne is not empty then
            do "put item 2 of" && tLigne && "into tFournisseur"
            if length (tFournisseur) > 20 then
               put char 1 to 20 of tFournisseur into tFournisseur
            else
               repeat while length (tFournisseur) < 20 
                  put space after tFournisseur
               end repeat
            end if
            put char 22 to 41 of line i of tListe into tLibelle
            put tFournisseur into char 22 to 41 of line i of tListe
            put tFournisseur into char 117 to 136 of line i of tListe
            put "          " into char 137 to 146 of line i of tListe
            repeat while (i < the num of lines of tListe) and (char 2 to 3 of line i+1 of tListe <> "08")
               add 1 to i
               if char 22 to 41 of line i of tListe = tLibelle then
                  put tFournisseur into char 22 to 41 of line i of tListe
                  put tFournisseur into char 117 to 136 of line i of tListe
                  put "          " into char 137 to 146 of line i of tListe
               end if
            end repeat
         end if
      end if
   end repeat
   set the text of fld "ListeOperations" to tListe
   unlock screen
end mouseUp
If I put a breakpoint at the line "if char 2 to 3 of line i of tListe = "08" then" and if I use the Continue button of the script editor each time there is a break, the script performs correctly. So, I am not able to debug it, as it always performs correctly in debug mode.
Any ideas?
TIA
