Get MUI version

Discuss GUI programming with the RapaGUI plugin here
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Get MUI version

Post 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?
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: Get MUI version

Post 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
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Get MUI version

Post 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") 
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: Get MUI version

Post 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?
p-OS
Posts: 167
Joined: Mon Nov 01, 2010 11:56 pm

Re: Get MUI version

Post by p-OS »

No,

but I would suggest to use HW own functions for creating temporary files insted of hardcoded filenames.
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Get MUI version

Post by jPV »

And a feature request to Andreas:

Could Execute() be made to return the output of the executed program?
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Re: Get MUI version

Post 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!
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Get MUI version

Post 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 
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Get MUI version

Post 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.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Get MUI version

Post 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.
Post Reply