Catalog Problems

Find quick help here to get you started with Hollywood
Post Reply
SpawnPPC
Posts: 61
Joined: Fri Mar 15, 2024 11:51 pm

Catalog Problems

Post by SpawnPPC »

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
plouf
Posts: 666
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Catalog Problems

Post by plouf »

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 ??

Code: Select all

OpenCatalog("PROGDIR:Catalogs/italian/AmiWORP-Gate.catalog")
Christos
SpawnPPC
Posts: 61
Joined: Fri Mar 15, 2024 11:51 pm

Re: Catalog Problems

Post by SpawnPPC »

Sorry, but do you read my message ? PLS, ready my message. And OS actually is Windows 11.

Thanx !

bySpawnPPC
plouf
Posts: 666
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Catalog Problems

Post by plouf »

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

Code: Select all

If OpenCatalog("AmiWORP-Gate.catalog") = True
never get true even if the catalog is already opened :)
Christos
SpawnPPC
Posts: 61
Joined: Fri Mar 15, 2024 11:51 pm

Re: Catalog Problems

Post by SpawnPPC »

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!!!
plouf
Posts: 666
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Catalog Problems

Post by plouf »

What if the first line in every catalog is the word "yes"
So check against firat line?
Christos
SpawnPPC
Posts: 61
Joined: Fri Mar 15, 2024 11:51 pm

Re: Catalog Problems

Post by SpawnPPC »

Good idea ! I Will try ! Thanx !
SpawnPPC
Posts: 61
Joined: Fri Mar 15, 2024 11:51 pm

Re: Catalog Problems

Post by SpawnPPC »

It works !!! It works !!!

Thanx my friend !!!

:D

bySpawnPPC
Post Reply