[SOLVED] Issue with OpenFileRquester and OpenConsole (Finally the problem was Goto within Select:EndSelect)

Just starting out? Need help? Post your questions and find answers here.
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

[SOLVED] Issue with OpenFileRquester and OpenConsole (Finally the problem was Goto within Select:EndSelect)

Post by boddhi »

Hello,

This snippet works perfectly:

Code: Select all

If OpenConsole("Offres fournisseurs :",#PB_UTF8)
  Fichier.s=OpenFileRequester("Ouvrir un fichier HTML MeteoJob","Fichier.html","Fichiers HTML|*.html",0)
  CloseConsole()
EndIf
But the following crashes when calling OpenFileRequester.
I think the problem is probably due to the use of labels.
I'm well aware that the code can be arranged differently, but in principle, I'd like to understand why it doesn't work.
In theory, nothing seems to stand in the way...

Code: Select all

If OpenConsole("Offres fournisseurs :",#PB_UTF8)
  Define.s Fichier,TexteHTML,Req
  Define.s Retour=LSet("",3,Chr(8))
  
RequeteTraitement:
  Print("Quel traitement lancer (1=Fournisseur 1 / 2=Fournisseur 2 / Q=Quitter) ? : ")
  Req=LCase(Input())
  Select Req
    ;Case "1":Goto OffresF1
    Case "1","2":Goto OffresF2
    Case "","q":Goto Fin
    Default
      Print("Quitter (O/N) ? : ")
      Select LCase(Input())
        Case "n":Goto RequeteTraitement
        Default:Goto Fin
      EndSelect
  EndSelect
  ;══  FOURNISSEUR 1  ════════════════════════
OffresF1:
  
Goto RequeteTraitement
;══  FOURNISSEUR 2  ══════════════════════════════
OffresF2:
  ;{
  PrintN("Récupération des offres fournisseur 2 :")
  Fichier=OpenFileRequester("Ouvrir un fichier HTML fournisseur","Fichier.html","Fichiers HTML|*.html",0)
  If Fichier="":Goto RequeteTraitement:EndIf
  Print("Ouverture du fichier...")
  PrintN(Retour+" : OK")
  ; Pc_TraitementDonnees()
  Goto RequeteTraitement
Fin:
  PrintN("")
  PrintN("Traitement terminé !")
  Input()
EndIf
Last edited by boddhi on Thu Sep 05, 2024 1:00 am, edited 1 time in total.
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
boddhi
Enthusiast
Enthusiast
Posts: 524
Joined: Mon Nov 15, 2010 9:53 pm

Re: [SOLVED] Issue with OpenFileRquester and OpenConsole

Post by boddhi »

In French, we have a proverb that says “La nuit porte conseil” (“The night brings advice”) and...

Idiot! Never place a Goto inside the Select:EndSelect pair!!!
and all will be fine...
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Post Reply