problem to read the file at release

kalarius

Active Member
Licensed User
Longtime User
Code: Copy
Line=tr2.readLine
do until Line<>Null
Try      
      Line=Tr2.ReadLine
      AriumosThlefvnoy=Line
      Line=Tr2.ReadLine
      Mynhma=Line 
       mynhma=Mynhma  & CRLF & Ypografh
       
   If (Mynhma.Length)>70 Then 
      Mynhma1=Mynhma.SubString2(0,6

I have write the above code and when I run it with debug (f8) it read the "line" and pass it to the parameters
AriumosThlefvnoy and mynhma
At the release the parameters AriumosThlefonoy=null and evenif the mynhma.lenght >70 it does not execute the if command


any suggestion?
I have check the file sms.txt and it is ok (4 lines of 10 to 101 chars)
 
instead of 'do until', write 'do while', or 'do until line=null'.
Where do you close the loop? Where is the 'end try'?
Anyway, Erel is right. You can simply get lines in a list and afterwards check each component.
 
Upvote 0
the problem with ReadList as ReadLine is the same
at the debug it can read the first line of the txt file but whe I am at release always the first line read null
with the List I have more problems The first time that run (in debug) the list.size-1=-1 and if I rerun the program then the list.size was 4
So i change to readline At the debug is ok when I go to release the read null
At my post I have not all the code just the position that is the problem
If you want to post it ok write me.
 
Upvote 0
Code: Copy
this my code Only the activite
Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   'Activity.LoadLayout("Layout1")
PE.Initialize("PE")

Dim AriumosThlefvnoy As String, a=0 As Int
Dim Mynhma As String,AriumosMhnhmatvn=0 As Int
Dim Mynhma1 As String, Mynhma2 As String
Dim Pelaths As String, DiplaMynhmata =0 As Int

Dim UeshArxeioy As String, Ypografh As String
'mesa sth karta yparxei to arxeio smsposition.txt poy perexei
   ' thn uesh toy arxeioy tvn mhnhmatvn
   'thn ypografh gia ta sms
Dim Line As String 
SMB1.Initialize("smb1")

SMB1.SetCredentials("","","")



Try
Tr.Initialize2(File.OpenInput("\mnt\sdcard", "smsposition.txt"), "windows-1253")
 ' I have never problem with this file I read it at debug and relaease mode
   UeshArxeioy=Tr.ReadLine
   Ypografh=Tr.ReadLine
   Tr.Close
   
   UeshArxeioy="SMB:" & UeshArxeioy
              DoEvents
    Catch
   Msgbox ("Δεν υπάρχει το αρχείο ή η κάρτα","Σφάλμα")
   ExitApplication
   
End Try   

'τωρα θα κατεβάσω το αρχειο απο τον υπολογιστη στη κάρτα
SMB1.DownloadFile( UeshArxeioy,"Sms.txt","\mnt\sdcard","sms.txt")
ToastMessageShow ("Φέρνω το αρχείο",False)
For a=0 To 65000
DoEvents
Next
a=0
'perimene mexri na eruei to arxeio
  
   DoEvents
 Try
   Tr2.Initialize2(File.OpenInput("\mnt\sdcard", "sms.txt"), "windows-1253")
      
Catch
   Msgbox ("Δεν βρήκα το αρχείο","Σφάλμα")
   Msgbox("Στάλθηκαν συνολικά " & AriumosMhnhmatvn, "Σύνολο αποστολής")
   ExitApplication
   
End Try
ToastMessageShow ("Περιμενε να φορτώσω",False)

Line=Tr2.ReadLine
 Do Until Line<>Null
Try      
   ************ here is the problem **********
               Line=Tr2.ReadLine
      AriumosThlefvnoy=Line
      Line=Tr2.ReadLine
      Mynhma=Line 
      'Mynhma ="Αν κάνεις διαχειρηση χρηματων ή ενημερωση πελατώ Τοτε το προγραμμα ειναι ένα" 
      'AriumosThlefvnoy="6936651125"
      Mynhma=Mynhma  & CRLF & Ypografh
       
   If (Mynhma.Length)>70 Then 
      Mynhma1=Mynhma.SubString2(0,69)
      Mynhma2=Mynhma.SubString(69)
      'Log(Mynhma1.Length)
      'Log(Mynhma2.Length)
      mySms.Send(AriumosThlefvnoy,Mynhma2)
      mySms.Send(AriumosThlefvnoy,Mynhma1)
      AriumosMhnhmatvn =AriumosMhnhmatvn+1
      DiplaMynhmata=DiplaMynhmata+1
   Else
      
   
      mySms.Send (AriumosThlefvnoy,Mynhma)
      AriumosMhnhmatvn =AriumosMhnhmatvn+1
      'ToastMessageShow(AriumosThlefvnoy &" ok" ,False)
   End If
   
   DoEvents
      
Catch
Log(LastException.Message)
   Msgbox( "Δεν μπορώ να στείλω το μήνυμα στο "& AriumosThlefvnoy ,"Σφάλμα στην αποστολή")
End Try
    Loop
   

   Tr2.Close

   Msgbox("Στάλθηκαν συνολικά " & AriumosMhnhmatvn  &" και διπλά "& DiplaMynhmata, "Σύνολο αποστολής")
   'enhmervse kai to arxe;io
 


End Sub

and the events
Sub pe_SmsSentStatus (Success As Boolean, ErrorMessage As String, PhoneNumber As String, Intent As Intent)

 If Success=False Then
   Msgbox("Δεν σταλθηκαν " & metrhths,ErrorMessage)
   metrhths=metrhths+1
 End If

   

End Sub
 Sub SMB1_DownloadCompleted (Url As String, RemoteFile As String, Success As Boolean)
 Geniko=Url '***********never comes here why??????
 End Sub

with F8 works fine
with realease I have problem.
and why it never eraise the event downloadcompleted ????
 
Upvote 0
Back
Top