Many Ambient prefs files for Chrysalis pack ?
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Papiosaur
    Posts: 2042 from 2003/4/10
    From: France
    Hello,

    i would like to change just defaut wallpaper, skin and screenbar module for the Chrysalis pack

    Is there a solution without change screenmode, language, etc...

    Thanks a lot for your help!

    a text file for each variable will be wonderfull!!!

    [ Edité par Papiosaur 27.01.2019 - 16:20 ]
  • »24.12.18 - 15:28
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Papiosaur
    Posts: 2042 from 2003/4/10
    From: France
    Hi,

    I would like to copy a save prefs file for screenbar module, one for skin and another for wallpaper to Chrysalis pack.

    I could open a bounty for this ? jacaDcaps ?

    [ Edité par Papiosaur 27.01.2019 - 16:20 ]
  • »27.01.19 - 16:19
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Korni
    Posts: 471 from 2006/2/23
    From: the Planet of ...
    Not sure what exactly you want to achieve, but screen settings including skin can be found in envarc:mui/screens.txt.

    For changing wallpaper you can use Ambient ARexx commands e.g RXCmd AMBIENT "LoadBackground RAM:butter.png MODE=TITLED TYPE=desktop". You can find some more ARexx commands in Ambients docs, also worth to check the MorphZone wiki.

    Sbar modules settings are saved in envarc:mui/screenmanager.cfg and .prefs
    http://korni.ppa.pl/modkowypaczek/ | My Rifle, My Bunny, and Me
  • »27.01.19 - 21:02
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Korni
    Posts: 471 from 2006/2/23
    From: the Planet of ...
    To change w/o reboot you edit screens.txt file in env:mui using some text editor etc. :), equivalent of "use", if you want to have "save" effect, then you also edit the one in envarc.

    [ Edited by Korni 28.01.2019 - 20:09 ]
    http://korni.ppa.pl/modkowypaczek/ | My Rifle, My Bunny, and Me
  • »28.01.19 - 19:59
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Korni
    Posts: 471 from 2006/2/23
    From: the Planet of ...
    You will need a sed (included with MorphOS SDK) or similar editor.
    http://korni.ppa.pl/modkowypaczek/ | My Rifle, My Bunny, and Me
  • »31.01.19 - 10:19
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    igracki
    Posts: 389 from 2003/2/25
    From: Berlin
    Hi Papio,

    here is a litte arexx script to change the skin of any screen.

    The change will take effect immediatly, if you want it to be permanently (after reboot),
    just remove the command around the last "Copy" command, then it will be copied
    to envarc: too!

    Copy this script to rexx:, then call it like this:
    rx rexx:ChangeSkin.rexx Ambient Nox


    Code:

    /*
    * Change the skin of a screen in env:mui/screens.txt
    * by Thomas Igracki
    *
    * The change will take effect immediatly, if you want it to be permanently (after reboot),
    * just remove the command around the last "Copy" command, then it will be copied
    * to envarc: too!
    *
    * Usage: rx ChangeSkin.rexx <screen name, f.e. Ambient> <new skin>
    *
    * Example: rx ChangeSkin.rexx Ambient Nox
    *
    * 31-Jan-2019: v1.0
    */

    OPTIONS RESULTS

    PARSE ARG Screen" "newSkin

    IF Screen = "" | newSkin = "" THEN
    Say "Usage: rx ChangeSkin.rexx <screen name, f.e. Ambient> <new skin>"
    ELSE; DO
    IF ~EXISTS("MOSSYS:Prefs/Skins/"newSkin) & ~EXISTS("SYS:Prefs/Skins/"newSkin) THEN
    Say "The skin '"newSkin"' didn't exists!"
    ELSE; DO
    IF Open(fhIn, "env:mui/screens.txt", "R") THEN; DO
    IF Open(fhOut, "t:new_screens.txt", "W") THEN; DO
    found = 0
    DO UNTIL EOF(fhIn)
    line = ReadLn(fhIn);
    PARSE VAR line "N="scr" "dummy" S="skin" "dummy2
    IF scr = Screen THEN; DO
    found = 1
    line = "N="scr" "dummy" S="newSkin" "dummy2
    oldSkin = skin
    END
    WriteLn(fhOut, line)
    END
    Close(fhIn)
    Close(fhOut)
    IF found=0 THEN
    Say "Didn't found the screen '"Screen"'!"
    ELSE; DO
    Say "Found the screen '"Screen"'!"
    Say "Changed the skin from '"oldSkin"' to '"newSkin"'."
    SHELL COMMAND "Copy t:new_screens.txt env:mui/screens.txt"
    SHELL COMMAND "Delete >NIL t:new_screens.txt"
    /* remove these comment if you want to save the new screens!
    SHELL COMMAND "Copy env:mui/screens.txt envarc:mui/screens.txt"
    */
    END
    END
    END
    END
    END


    Edited to check, if the skin exists!
  • »31.01.19 - 15:04
    Profile Visit Website
  • jPV
  • Yokemate of Keyboards
    Yokemate of Keyboards
    jPV
    Posts: 2026 from 2003/2/24
    From: po-RNO
    Hehe, I just made a script in Lua too :D

    If you don't want to have any external dependencies (like SDK or rexxsyslib.library), you can use Lua scripts. They do work out of the box on a plain MorphOS installation.

    Here's the script I made. You can select if you want to modify screens.txt in ENV, ENVARC, or both locations. And the script makes optionally a backup of the original file too.

    Code:
    --[[

    A script to change MorphOS skin prefs. Use at your own risk.

    Usage: LuaX changeskin.lua <location> <screen> <skin>

    - The "location" argument can be ENV, ENVARC, or BOTH. It defines where
    the "screens.txt" file is modified.
    - If the "skin" argument is omitted, the default skin is used.
    - The "make_backup" setting creates a "screens.txt.bak" file
    to the corresponding location.
    - The "screen" argument is case sensitive!

    Examples:
    LuaX changeskin.lua ENV Ambient Ater
    LuaX changeskin.lua BOTH Ambient Default

    ]]

    require 'io'
    require 'os'
    require 'string'


    -- CONFIG BEGINS (Use true or false values)

    make_backup = true

    -- CONFIG ENDS


    function change_skin(loc)
    if make_backup then os.execute('Copy ' .. loc .. ':MUI/screens.txt ' .. loc .. ':MUI/screens.txt.bak CLONE') end
    local file = io.open(loc .. ':MUI/screens.txt','r')
    if file then
    local found
    local content = file:read('*a')
    io.close(file)
    content, found = string.gsub(content, '(N="?' .. screen .. '.-S="?)(%w+)', "%1" .. skin)
    if found > 0 then
    file = io.open(loc .. ':MUI/screens.txt','w+')
    if file then
    file:write(content)
    io.close(file)
    else
    io.write('Failed to write the file in ' .. loc .. '.n')
    end
    else
    io.write('Failed to change the skin.n')
    end
    else
    io.write('Failed to read the file in ' .. loc .. '.n')
    end
    end


    if #arg > 1 then
    location = string.upper(arg[1])
    screen = arg[2]
    if arg[3] then skin = arg[3] else skin = 'Default' end
    if location == 'BOTH' then
    change_skin('ENVARC')
    change_skin('ENV')
    elseif location == 'ENV' then
    change_skin('ENV')
    elseif location == 'ENVARC' then
    change_skin('ENVARC')
    else
    io.write('The first argument must be "ENV", "ENVARC", or "BOTH"!n')
    end
    else
    io.write('At least two arguments (location and screen name) are required.n')
    end
  • »31.01.19 - 15:29
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Papiosaur
    Posts: 2042 from 2003/4/10
    From: France
    Hi,

    it's ok now to change wallpaper and skin at startup of the pack ! Thanks

    I would like now load and save Origo MUI Prefs for Origo skin (or other)

    Did you have a suggestion for that please ?

    [EDIT]Is there a solution to save all these prefs and after the user can change them ? because for now i have create a script in WBStartup wich change this prefs at every boot :-)

    [ Edité par Papiosaur 18.02.2019 - 20:31 ]
  • »18.02.19 - 20:17
    Profile Visit Website