Page 1 of 2

Get MUI version

Posted: Mon May 17, 2021 7:06 pm
by mrupp
Hi there
I'm wondering if it's possible to get the installed MUI version with RapaGUI. Because some features are only available from a specific MUI version onwards, I'd like to implement some fallback behaviour for lower MUI version.

Example:
Button.Icon needs MUI 4.0 or newer, so for lower MUI version I'd like to use text instead.

How would I best do this?

Re: Get MUI version

Posted: Mon May 17, 2021 10:34 pm
by amyren
You could use the AmigaOS version command

Code: Select all

Execute("version mui:mui > ram:mui.ver")
OpenFile(1, "ram:mui.ver")
	muiver$ = ReadLine(1)
CloseFile(1)
muiver = Val(RightStr(muiver$, StrLen(muiver$)-4))
If muiver > 20.344 Then SystemRequest("Mui version", "Your MUI version is above version 3.9 2015.R1/nYour Mui version number is: "..muiver, "OK")
Note that the version command will not return the MUI version as 3.8 or 5.0, but the build number something like 20.344 etc.
I dont have the complete version history for MUI, but here is a small list of MUI version numbers I found for OS3.
3.8 = 19.14
3.9 2014.R1 = 20.340
3.9 2015.R1 = 20.344
4.0 2015.R1 = 20.378
4.0 2015.R4 = 20.382
5.0 = 21.23

Re: Get MUI version

Posted: Tue May 18, 2021 8:58 am
by jPV
It would be better to check the version from muimaster.library, because the main MUI program isn't at the same location on every system and the library is what finally defines the actual MUI version you use.

I also modified the code otherwise how I'd do it, although it doesn't affect to functionality, but for myself it would be a bit tidyer and will work if you decide to change the file you check (no fixed values depending on strlen).

Code: Select all

Execute("version muimaster.library > ram:mui.ver")
muiver$ = FileToString("ram:mui.ver")
muiver = ToNumber(PatternFindStrShort(muiver$, "(%d+%.%d+)"))
If muiver > 20.344 Then SystemRequest("Mui version", "Your MUI version is above version 3.9 2015.R1/nYour Mui version number is: "..muiver, "OK") 

Re: Get MUI version

Posted: Fri May 21, 2021 10:49 am
by mrupp
Thanks, guys. This is how I'll do it.

As a side-question: Is there a way to circumwent the creation of a temp file in ram: and to directly receive the return string of the version command?

Re: Get MUI version

Posted: Fri May 21, 2021 2:34 pm
by p-OS
No,

but I would suggest to use HW own functions for creating temporary files insted of hardcoded filenames.

Re: Get MUI version

Posted: Fri May 21, 2021 5:13 pm
by jPV
And a feature request to Andreas:

Could Execute() be made to return the output of the executed program?

Re: Get MUI version

Posted: Sat May 22, 2021 9:17 am
by mrupp
jPV wrote: Fri May 21, 2021 5:13 pm And a feature request to Andreas:

Could Execute() be made to return the output of the executed program?
Yes, I second that request, that would come in very handy indeed!

Re: Get MUI version

Posted: Sat May 22, 2021 1:58 pm
by emeck
mrupp wrote: Fri May 21, 2021 10:49 am Thanks, guys. This is how I'll do it.

As a side-question: Is there a way to circumwent the creation of a temp file in ram: and to directly receive the return string of the version command?
Maybe something like this is what you are looking for:

Code: Select all

Function p_getOutput(msg)
    Switch(msg.action)
          Case "RunOutput":
            Print(msg.output)
    EndSwitch
EndFunction

InstallEventHandler({RunOutput = p_getOutput})

Print("MUI version from event handler:\n")
Run("version", "muimaster.library")

Repeat
    WaitEvent()
Forever 

Re: Get MUI version

Posted: Sat May 22, 2021 4:58 pm
by jPV
Run() has the problem that it doesn't block the script execution, which you usually would want when checking requirements. So, having Execute() to return the output would still be better for this kind of cases.

Re: Get MUI version

Posted: Sat May 22, 2021 6:37 pm
by airsoftsoftwair
jPV wrote: Fri May 21, 2021 5:13 pm Could Execute() be made to return the output of the executed program?
Unlikely. Getting this to work with Run() on all platforms was a major pain and I'm not really keen on going through this again. Better just pipe the output to an external file and get it from there. Alternatively, you could also try to use a modal loop with CheckEvents() or something but that won't work with RapaGUI 2.0.