Hi to all !
I just done a little program that recognize the system language and try to select and open the correct catalog, in this case italian.
I think that there is some problems with the file becouse the program give the correct results in debug shell.
The error is:
Cannot open the catalog file
The directory tree is this one:
AmiWORP-Gate/Catalogs/italian/AmiWORP-Gate.catalog
This is the catalog content (Hollywood version, normal text UTF-8 format) without minus ofc:
----------------------------
Errore: l'eseguibile deve essere nella cartella AmiWORP-Gate !!!
Il programma si chiuderà in:
secondi
secondo
Abbiamo rilevato che la lingua di sistema è impostata su:
Confermi l'uso di questa lingua?
Vuoi cambiare la lingua?
----------------------------
The editor's text is this:
----------------------------
Function LinguaDefault()
; Rileva la lingua di sistema
SystemLang = GetSystemLanguage()
SystemLangInfo = GetLanguageInfo(SystemLang)
DebugPrint("Lingua di sistema rilevata: " .. SystemLangInfo.Name .. " (" .. SystemLangInfo.Code .. ")")
; Costruisci il percorso del catalogo in base alla lingua di sistema
catalogPath$ = "Catalogs/" .. SystemLangInfo.Name .. "/AmiWORP-Gate.catalog"
DebugPrint("Percorso del catalogo: " .. catalogPath$)
; Verifica se il catalogo esiste
If Exists(catalogPath$)
DebugPrint("Catalogo trovato. Provo ad aprirlo...")
; Tenta di aprire il catalogo
If OpenCatalog("AmiWORP-Gate.catalog") = True
DebugPrint("Catalogo aperto con successo.")
Else
DebugPrint("Impossibile aprire il catalogo.")
EndIf
Else
DebugPrint("Catalogo non trovato.")
EndIf
EndFunction
Function Main()
DebugPrint("Avvio del programma...")
; Esegui la funzione per selezionare la lingua
LinguaDefault()
; Ottieni la directory corrente
RootDir$ = GetCurrentDirectory()
DebugPrint("Directory corrente: " .. RootDir$)
; Verifica se la directory corrente termina con "AmiWORP-Gate"
ExpectedDir$ = "AmiWORP-Gate"
ActualDirEnd$ = RightStr(RootDir$, StrLen(ExpectedDir$))
If ActualDirEnd$ = ExpectedDir$
DebugPrint("La directory corrente è corretta.")
RootDirEsito = True
Else
DebugPrint("La directory corrente NON è corretta.")
RootDirEsito = False
EndIf
; Se la directory non è corretta, mostra un messaggio di errore
If Not RootDirEsito
; Creazione del display per il messaggio di errore
CreateDisplay(2, {Width = 640, Height = 480, Title = "Errore di Directory"})
DebugPrint("Display creato per il messaggio di errore.")
; Mostra il messaggio di errore all'utente
TextOut(#CENTER, #CENTER - 20, "Errore: l'eseguibile deve essere nella cartella AmiWORP-Gate.")
TextOut(#CENTER, #CENTER, "Il programma si chiuderà in:")
DebugPrint("Messaggio di errore mostrato.")
; Avvia un conto alla rovescia
For i = 5 To 1 Step -1
; Cancella l'intera area del testo precedente
SetFillStyle(#FILLCOLOR)
Box(#CENTER, #CENTER + 30, 100, 40, #BLACK)
; Scrivi il countdown
TextOut(#CENTER, #CENTER + 20, i)
; Modifica la scritta "secondi" o "secondo" in base al valore di i
If i = 1
TextOut(#CENTER, #CENTER + 40, "secondo")
Else
TextOut(#CENTER, #CENTER + 40, "secondi")
EndIf
Wait(50)
Next
; Chiudi il display e termina il programma
FreeDisplay(2)
End
EndIf
DebugPrint("Fine del controllo della cartella di root.")
EndFunction
; Avvio del programma principale
Main()
----------------------------
Any idea ?
Thanx to all !
bySpawnPPC
Catalog Problems
Re: Catalog Problems
i guess wrong in your code 
provide at LEAST SOME code
Also have you try with .exe ? final exe and compile-run may have difirent paths
Also what os ? shall i guess Morphos?
in my understang your OpenCatalog()
is like this ??
provide at LEAST SOME code
Also have you try with .exe ? final exe and compile-run may have difirent paths
Also what os ? shall i guess Morphos?
in my understang your OpenCatalog()
is like this ??
Code: Select all
OpenCatalog("PROGDIR:Catalogs/italian/AmiWORP-Gate.catalog")Christos
Re: Catalog Problems
Sorry, but do you read my message ? PLS, ready my message. And OS actually is Windows 11.
Thanx !
bySpawnPPC
Thanx !
bySpawnPPC
Re: Catalog Problems
ok i apologize for this, these italian text make me thouht that was all the catalog from there to bottom 
you problem is that OpenCatalog() do NOT return nothing so
never get true even if the catalog is already opened 
you problem is that OpenCatalog() do NOT return nothing so
Code: Select all
If OpenCatalog("AmiWORP-Gate.catalog") = TrueChristos
Re: Catalog Problems
Ok, I understand, thanks, but then I wonder how can I check that the catalog has actually been opened? Is there a way to check if the catalog has been opened correctly? Thanks!!!
Re: Catalog Problems
What if the first line in every catalog is the word "yes"
So check against firat line?
So check against firat line?
Christos
Re: Catalog Problems
Good idea ! I Will try ! Thanx !
Re: Catalog Problems
It works !!! It works !!!
Thanx my friend !!!
bySpawnPPC
Thanx my friend !!!
bySpawnPPC