Open a drawer from Shell?
  • Order of the Butterfly
    Order of the Butterfly
    GK_LKA
    Posts: 481 from 2004/3/28
    From: Hungary
    Anyone knows how to open a drawer with the latest Ambient from shell? Is there a program for this like OpenDrawer for Workbench? Or is there an Arexx command?
    [ GK / LKA Team ]
  • »08.03.06 - 18:20
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Chain-Q
    Posts: 347 from 2003/10/12
    From: 1 AU, EU, DE/HU
    Ambient has an ARexx port. It's possible to address commands there, which Ambient will understand, and execute. The most simple window opening from ARexx looks like this:

    /**/
    address 'AMBIENT'
    LOADURI 'System:' NEWWIN

    Save this as OpenWindow.rexx, then issue the 'rx OpenWindow.rexx' command, and it will open the System: drawer. It's obvious where to modify to open the desired drawer. Maybe someone will do it better, and makes the thing to accept arguments, etc... :-) Possible Ambient ARexx commands are available in Ambient source, in appclass.c... Maybe it's also documented somewhere, i don't know.
    [.PegasosII/G4.:.Efika.:.Amiga2000/060.]
    [.Free Pascal Compiler MorphOS Port.]
    [.Hosting AmigaSpirit.hu.]
  • »08.03.06 - 23:55
    Profile Visit Website
  • Leo
  • Order of the Butterfly
    Order of the Butterfly
    Leo
    Posts: 419 from 2003/8/18
    Create a file 'open_win.rexx' in sys:arexx/

    Quote:


    /*
    Small script that will open Ambient window of 'ARG' directory
    */

    arg dir
    parse var dir

    address value AMBIENT

    SCANDIR dir SHOWALL 'MODE=ICON'
    LOADURI dir NEW

    exit



    Then create a 'go' in s:

    Quote:


    .key Dir/M
    .bra {
    .ket }
    run >NIL: rx sys:arexx/open_win.rexx {Dir}



    Add 'S' flag to the go file by typing: 'protect s:go +s'

    Now you just have to type 'go [dir]' to open dir in ambient.

    NOTE: this script will work with older Ambient as well as newer (daily builds) Ambient executables.

    Leo.

    [ Edited by Leo on 2006/3/8 23:03 ]
    Nothing hurts a project more than developers not taking the time to let their community know what is going on.
  • »09.03.06 - 00:02
    Profile Visit Website
  • Fab
  • MorphOS Developer
    Fab
    Posts: 1331 from 2003/6/16
    To be a little more precise, and with ambient > 1.42, the command template is :

    LoadURI URI/U,NEW=NEWWIN/S,RELOAD/S,FORCE/S,BROWSER/N,VIEWID/N

    - to open a path :

    LoadURI file://path?mode=<mode>&top=<value>&left=<value>&width=<value>&height=<value>

    mode can be "icons", "all", "thumbs" for the different iconview submodes, or "list" for list mode.
    left and top can take -1 as special value, so that window opens under the mouse.


    - to open device list :

    LoadURI devices://?[same arguments, see above]


    NEWWIN argument isn't needed from shell.
    You can reuse a given view if you specify a correct VIEWID. You can retrieve view list with "ViewList STEM" command.
    BROWSER will allow you to decide if you want browser mode or not for this window.
    ...


    SCANDIR was the old command used in ambient < 1.40 and is not supported anymore.




    [ Edited by Fab on 2006/3/9 0:41 ]
  • »09.03.06 - 00:36
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    GK_LKA
    Posts: 481 from 2004/3/28
    From: Hungary
    Thanks a lot, it works. :)
    [ GK / LKA Team ]
  • »09.03.06 - 07:05
    Profile Visit Website