Setting size and position of a MUI window from Shell?
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Sprocki
    Posts: 128 from 2005/2/23
    From: Berlin - Germany
    Is there any similar approach to https://morph.zone/modules/newbb_plus/viewtopic.php?topic_id=11217&forum=9 for MUI program windows? I need to set position and size from a Shell script on startup. I don't wan't to snapshot them as I need different positions and sizes for different setups.
  • »01.10.15 - 22:01
    Profile
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    Quote:

    Sprocki wrote:
    Is there any similar approach to https://morph.zone/modules/newbb_plus/viewtopic.php?topic_id=11217&forum=9 for MUI program windows? I need to set position and size from a Shell script on startup. I don't wan't to snapshot them as I need different positions and sizes for different setups.


    Nope. MUI is getting position and size from the config file.
    1 + 1 = 3 with very large values of 1
  • »01.10.15 - 22:31
    Profile
  • MorphOS Developer
    geit
    Posts: 1049 from 2004/9/23
    Quote:

    Sprocki wrote:
    Is there any similar approach to https://morph.zone/modules/newbb_plus/viewtopic.php?topic_id=11217&forum=9 for MUI program windows? I need to set position and size from a Shell script on startup. I don't wan't to snapshot them as I need different positions and sizes for different setups.


    You can open a new shell with matching coords.

    newcli MUICON:0/10/400/200/ThisIsTheName/CLOSE

    Same works if you want to launch a tool you can redirect input or output to a new shell.

    ShellUsingApp <>MUICON:0/10/400/200/ThisIsTheName/CLOSE

    EDIT: Ups. Got it wrong. :) For MUI applications this does not work, but i guess there are tools in aminet allowing to change position of windows after they are open. Its a hack, but should work.

    e.g. MMKeyboard provides some macro which allows this via hotkey.


    [ Edited by geit 01.10.2015 - 23:42 ]
  • »01.10.15 - 22:38
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Sprocki
    Posts: 128 from 2005/2/23
    From: Berlin - Germany
    ENV:MUI/*.cfg? Is there a way to override it without opening MUI prefs for every individual program? ENVARC: stayed untouched then.
  • »01.10.15 - 22:42
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Sprocki
    Posts: 128 from 2005/2/23
    From: Berlin - Germany
    Yes, I found two tools on Aminet before writing here, but they need to run in the background and wait for the already opened window to be activated before they can change their size and position. Activation is taken by manually clicking them with your mouse. This is not much more comfortable than changing size and position without these tools.
  • »01.10.15 - 22:45
    Profile
  • jPV
  • Yokemate of Keyboards
    Yokemate of Keyboards
    jPV
    Posts: 2096 from 2003/2/24
    From: po-RNO
    Quote:

    Sprocki wrote:
    Is there any similar approach to https://morph.zone/modules/newbb_plus/viewtopic.php?topic_id=11217&forum=9 for MUI program windows? I need to set position and size from a Shell script on startup. I don't wan't to snapshot them as I need different positions and sizes for different setups.


    I've made different pre-saved setting files for each setup and then I just have a small "modify" script which copies the wanted setting files to use. You can have stored settings on some completely different location and just copy them over or you could have different named files in the original location and rename them when needed.

    I can run my modify script on any machine I have and it copies MUI settings, screenmode settings, network settings, keyfiles etc for the machine and its resolution. That way I can have just one unified system to keep up and backuped :) Or I can run my script on the same machine and just change the resolution where programs will fit themselves.
  • »02.10.15 - 05:22
    Profile Visit Website
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    Quote:

    Sprocki wrote:
    ENV:MUI/*.cfg? Is there a way to override it without opening MUI prefs for every individual program? ENVARC: stayed untouched then.


    You would need special ENV: handler and it is still difficult because window size and position is saved using different ID in different applications (config files are standard Amiga IFF files).
    1 + 1 = 3 with very large values of 1
  • »02.10.15 - 06:11
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Sprocki
    Posts: 128 from 2005/2/23
    From: Berlin - Germany
    @ geit

    I tried with MMKeyboard 4.11. As an example, I configured a hotkey, set command type to CLI and later WB, both with the following line where 'nwb' is the command taken from http://aminet.net/util/cli/NewWinBox.lha:
    C:nwb width=800 height=300 left=4 top=4 quiet

    but when I hit the hotkey I get a requester saying:
    Benötige den Datenträger
    "C
    in beliebigem Laufwerk

    meaning:
    Please insert volume
    "C
    in any drive


    After about ten answers to the requesters saying 'Cancel', a Shell opens up saying:
    C:nwb width=800 height=300 left=4 top=4 quiet: Unbekannter Befehl

    meaning 'Unknown command'.

    When I use the command line
    nwb width=800 height=300 left=4 top=4 quiet

    instead, I don't get to see a series of requesters but the message
    nwb width=800 height=300 left=4 top=4 quiet: Unbekannter Befehl

    immediately opens.

    The hotkey obviously gets called, otherwise the windows did not appear. There seems to be a mistake in either the command or parsing it as always it stops at the colon (tested with other assigns as well). The same command line works flawlessly in a Shell window where I copied it from. What has to be changed here?
  • »03.10.15 - 21:18
    Profile
  • Moderator
    Kronos
    Posts: 2326 from 2003/2/24
    @Sprocki

    "C:" sollte normalerweise auf SYS:c verweisen, ist also völlig unnötig das vor ein Shellkommando zu setzen (da eh schon im Standardsuchpfad).

    Keine Ahnung was "nwb" ist, aber wenn es nicht im Suchpfad der Shell liegt musst du den Pfad natürlich angeben (bzw. vorher in das Verzeichniss wechseln).

    Edith:
    No idea why I answered in german, live with it ;)

    [ Edited by Kronos 04.10.2015 - 08:33 ]
  • »04.10.15 - 07:32
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Sprocki
    Posts: 128 from 2005/2/23
    From: Berlin - Germany
    @ Kronos

    C: points to SYS:C for sure, it would be a bad idea to change that. The curious thing about the message is why the mentioned path stops at the colon, so is an incomplete citation of the path.
    What 'nwb' is is written in my former message. I copied it to C: and addressed it with C:nwb because the general path addressing did not work.

    Trude:
    I'll tell her when she returns home.
  • »04.10.15 - 08:35
    Profile
  • Moderator
    Kronos
    Posts: 2326 from 2003/2/24
    Not sure what your doing wrong, but removing the "quiet" at the end may be a start.

    What I tried:

    -Unpack the archive to ram:
    -create a script :Code:
    wait 3
    nwb width=800 height=500 left=4 top=4

    -save as "nwb.s"
    -type "execute nwb.s" in Shell
    -activate Scribble window
    -> success


    I'll raise you an Hildegard

    And now I see that nwb allready has a delay parameter ... *doh*

    [ Edited by Kronos 04.10.2015 - 10:41 ]
  • »04.10.15 - 09:38
    Profile
  • MorphOS Developer
    geit
    Posts: 1049 from 2004/9/23
    I just tried and it works like expected.

    I copied the command to c:
    created a new hotkey in MMKeyboard. I copied both lines.
    and via hotkey I was able to resize the active window.

    Since i copied both lines, the c:#? and the #?quiiet.line i do not see a problem.

    Just make sure the execute type is set to CLI.

    You must not use "" inside the command field unless you have parameters with spaces. The only reason I see you getting an error spotting << insert "C: #? >> is using the " wrong.

    So use

    c:nwb width=800 height=300 left=4 top=4

    and not

    "c:nwb width=800 height=300 left=4 top=4"
  • »04.10.15 - 12:33
    Profile
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Sprocki
    Posts: 128 from 2005/2/23
    From: Berlin - Germany
    All in one:

    @ jPV

    I thought about the approach to store every setup in a different bunch of config files and then collectively copy them to ENV: but I did not want to place so many windows manually before I can store their configurations. It would be easier to do all that from the script giving the window coordinates as parameters - easier to change and easier to reuse.

    An external mechanism like using the tooltypes or generally enabling all MUI programs to eat the window coordinates and public screen as Shell parameters would be very handy.


    @ Kronos

    Thanks for blaming me doing it wrong but from reading my post above you can see that I already did it right from the beginning. If you check the line
    that I used carefully, then you see that there are no quotation marks. I chose CLI as script type and never entered citation characters other than for citing the output messages. Whether the switch 'quiet' is set or not does not make a difference to the fact that the command cannot be found.


    @ geit

    As written in #8, I did not use quotation marks for my input.
    Actually I have seen that behaviour with wrong quoting program calling paths like an incomplete '"C ' message by another program some time ago but do not remember which one. It might be a general or typical parsing problem. Maybe someone else remembers a program giving those messages and can name it.

    It works now without any config changes but quitting MMKeyboardServer and restarting it. With fixed coordinates in the command line, it will stack all windows on the same position, of course. This is why I joined up 'r' in circuit for the moment to change the coordinates on demand without touching MMK's config on every keypress. Not really what I want but maybe I get a better idea sometime later or I switch to jPV's proposal.
  • »08.10.15 - 22:33
    Profile