Dopus and MorphOS Do they they mix?
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    osco
    Posts: 680 from 2009/10/21
    From: Boston, USA
    800 Text files with the extension .ps in Ram: Wish to open/read/process..Arexx/ write them to a new file with the extension .txt

    Is the a short and clear scripting to do this..
    Does Dopus have a way?
    Does MorphOS hav a way?

    Heading to the manuals
    :-D
    Mac Mini 1.5GHz, 1G, 250G Drive, Apple Cinema Display, MorphOS 3.1 registered, MacOS 10 PowerBook (5,8) 1.67Hz, 2G, 80G Drive,........Waiting
    PowerBook (5,8) 1.67Hz, 2G, 40G MorphOS 3.1 unregisterd
  • »24.04.10 - 13:14
    Profile
  • HAK
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 225 from 2003/2/24
    From: Austria, Vienna
    Hi osco,

    Since you intend to process every file with AREXX, maybe it's easier to do the file selection within the script itself.

    Or you just do a
    list ram:#?.ps lformat "foo.rexx *"%s%s*"" to ram:bar.bat
    This one gives you a batch file ("bar.bat") in RAM:. If you execute it, for every file it starts an AREXX script ("foo.rexx") with the name of the original file as parameter - though you still have to do the renaming and saving in the AREXX script itself.


    Bye HAK
  • »25.04.10 - 22:40
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    osco
    Posts: 680 from 2009/10/21
    From: Boston, USA
    Ram Disk:> list ram:#?.ps lformat "foo.rexx*%s%s to ram:bar.bat
    argument line invalid or too long

    Did I miss_typo?
    Yes I DID. Cut and paste produced "bar.bat" in ram: :-D

    [ Edited by osco on 2010/4/26 11:25 ]
    Mac Mini 1.5GHz, 1G, 250G Drive, Apple Cinema Display, MorphOS 3.1 registered, MacOS 10 PowerBook (5,8) 1.67Hz, 2G, 80G Drive,........Waiting
    PowerBook (5,8) 1.67Hz, 2G, 40G MorphOS 3.1 unregisterd
  • »26.04.10 - 01:56
    Profile
  • Paladin of the Pegasos
    Paladin of the Pegasos
    jcmarcos
    Posts: 1178 from 2003/3/13
    From: Pinto, Madrid ...
    Hey osco, you are confusing the "format" command with a nice option of the "list" command. the "lformat" option changes the way the list of files is written. So you can make the "list" commsnd output whatever you need, such as prepending any text to each file name, in order to build a batch file for executing the same command for each file.

    Where's that AmigaDOS online manual...?
  • »26.04.10 - 07:33
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    osco
    Posts: 680 from 2009/10/21
    From: Boston, USA
    Osco scurrying to DOS MANUAL .Where's that AmigaDOS online manual...? There it is !!
    DOS MANUAL
    'LIST' HAS 16 options and the last one shown is "LFORMAT"

    LFORMATt = "Text"
    The option causes the text in "Text" to be displayed.
    Entering %s serves as a place holder for the actual file name.
    Entering a second %s causes the fillename to be displayed a second time.
    Entering three %s causes the first one....
    Entering four %s causes...

    Ram:> Help List produced The LFORMAT option modifies the output of List and can be used as
    a quick method of generating script files. When using LFORMAT,
    specify an output format string; this string is output for each file
    or directory normally listed. It can contain any text you specify,
    plus the usual List output information. When LFORMAT is specified,
    the QUICK and NOHEAD options are automatically selected.
    To save the output, you must redirect it to a file by using
    the > operator or specifying a TO file.

    The available substitution operators are:

    %A Prints file attributes (protection bits).
    %B Prints size of file in blocks.
    %C Prints any comments attached to the file.
    %D Prints the date associated with the file.
    %E Prints just the file extension.
    %K Prints the file key block number.
    %L Prints the length of the file in bytes.
    %M Prints the file name only, omitting any extension.
    %N Prints the name of the file.
    %P Prints the file parent path.
    %S Superseded by %N and %P; still functional.
    %T Prints the time associated with the file.
    You can put a length specifier and/or a justification specifier
    between the percent sign (%) and the field specifier.
    To specify left justification, place a minus sign (-)
    before the length specifier. Otherwise, the information
    displayed is right justified.

    NOTE: The default output of the LIST command uses the following specification:
    %-24 %7L %A %D %T

    Ram Disk:>

    [ Edited by osco on 2010/4/26 11:31 ]
    Mac Mini 1.5GHz, 1G, 250G Drive, Apple Cinema Display, MorphOS 3.1 registered, MacOS 10 PowerBook (5,8) 1.67Hz, 2G, 80G Drive,........Waiting
    PowerBook (5,8) 1.67Hz, 2G, 40G MorphOS 3.1 unregisterd
  • »26.04.10 - 12:32
    Profile
  • Paladin of the Pegasos
    Paladin of the Pegasos
    jcmarcos
    Posts: 1178 from 2003/3/13
    From: Pinto, Madrid ...
    Quote:

    osco wrote:

    Where's that AmigaDOS online manual...? There it is !!


    I expected a link... The thig is, I seem to recall that, once, somebody put an AmigaDOS manual on line. Perhaps it's my mind playing tricks on me. But google found this, albeit warped sometime six years ago, by "archive.org":

    http://web.archive.org/web/20040521011858/www.nethkin.com/bmori/amiga/dos2.html

    Hey! I've found it BEFORE ANREAS WOLF! Is the world tumbling or what? :-D

    You can also enjoy this on the lovely "pagetable.com" site...
  • »26.04.10 - 14:34
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    osco
    Posts: 680 from 2009/10/21
    From: Boston, USA
    Help is THE inline help tool for MorphOS Shell.

    Features:

    .FULL documentation of 111 shell commands
    .Small howto on the Shell arguments
    .Many examples included
    .Search by name or domain
    .Localization support
    Aminet HELP.lha
    Mac Mini 1.5GHz, 1G, 250G Drive, Apple Cinema Display, MorphOS 3.1 registered, MacOS 10 PowerBook (5,8) 1.67Hz, 2G, 80G Drive,........Waiting
    PowerBook (5,8) 1.67Hz, 2G, 40G MorphOS 3.1 unregisterd
  • »26.04.10 - 18:08
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    osco
    Posts: 680 from 2009/10/21
    From: Boston, USA
    "if you execute it, for every file it starts an AREXX script ("foo.rexx") with the name of the original file as parameter - though you still have to do the renaming and saving in the AREXX script itself."

    :-D Have bar.bat in Ram: Thank-you! How do you execute it? Made a "Say " script and named it foo.rexx...It read all the lines in the batch file fine Now how do you execute the line?
    foo.rexx "ram:200905021015wv300en.ps"

    Below is the process script
    options results
    arg sourcefile

    if open(input,"Ram:200905021015wv300en.ps", R) then do
    if ~open(output,"Ram:200905021015wv300en.txt", W) then call error

    Do until eof(input)
    line=readln( input)
    if pos('(',line) =1 then writeln(output, line) /* line begins with '(' at POS 1 */
    end
    close(input)
    close(output)
    end

    EXIT

    ERROR:

    SAY "ERROR"

    EXIT


    [ Edited by osco on 2010/4/26 15:58 ]
    Mac Mini 1.5GHz, 1G, 250G Drive, Apple Cinema Display, MorphOS 3.1 registered, MacOS 10 PowerBook (5,8) 1.67Hz, 2G, 80G Drive,........Waiting
    PowerBook (5,8) 1.67Hz, 2G, 40G MorphOS 3.1 unregisterd
  • »26.04.10 - 18:23
    Profile
  • HAK
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 225 from 2003/2/24
    From: Austria, Vienna
    Hi osco,

    Sorry for the missing " which gave you the error in the first place, but you found out yourself as I can see.

    Not sure, whether I made myself clear with the "if you execute it,..." line.
    What I ment was, that after the execution of the list command, you get a batch file, that might look like

    foo.rexx "ram:file001.ps"
    foo.rexx "ram:file002.ps"
    foo.rexx "ram:file003.ps"

    if you have the files file001.ps, file002.ps and file003.ps in your RAM: disk when executing it.

    Now you can just enter "execute bar.bat" and the shell will execute each line as if you have typed it into the shell directly.

    In the AREXX script itself, you have to use "parse arg ..." to get the name of the file - albeit with the surrounding ".

    Your AREXX script would look like the following
    --- cut here ---
    /* $VER: foo.rexx 1.0 (27.04.2010) */
    OPTIONS RESULTS

    /* places argument into sourcename variable */
    PARSE ARG sourcename

    /* removes surrounding " */
    sourcename = strip(sourcename, 'B', '"')

    /* removes "ps" extension and adds "txt" extension instead */
    targetname = left(sourcename, length(sourcename) - 2)||"txt"

    /* main program */
    if open(input,sourcename, R) then do
    if ~open(output,targetname, W) then call error

    Do until eof(input)
    line=readln( input)
    if pos('(',line) =1 then writeln(output, line) /* line begins with '(' at POS 1 */
    end
    close(input)
    close(output)
    end

    EXIT

    ERROR:

    SAY "ERROR"

    EXIT
    --- cut here ---

    Hope I made myself clear and didn't include some more typos in the upper listing.


    Bye HAK
  • »26.04.10 - 22:52
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    osco
    Posts: 680 from 2009/10/21
    From: Boston, USA
    Love Arexx and women too :) why there all different but still attractive
    OPTIONS RESULTS


    IF OPEN(input,"Ram:bar.bat", R) THEN DO

    DO UNTIL EOF(input)

    line=READLN(input)
    SAY line
    SAY SUBSTR(line,11,26)
    SAY SUBSTR(line,11,24)'txt'
    infile=SUBSTR(line,11,26)
    outfile=SUBSTR(line,11,24)'txt'
    SAY infile
    SAY outfile
    IF OPEN(input1,infile, R) THEN DO
    IF ~OPEN(output,outfile,W) THEN CALL ERROR

    DO UNTIL EOF(input1)
    line1=READLN( input1)
    IF POS('(',line1) =1 THEN WRITELN(output, line1) /* line begins with '(' at POS 1 */
    END


    CLOSE(input1)
    CLOSE(output)



    END

    EXIT

    ERROR:
    SAY "ERROR"

    EXIT
    The script only returns one output file..the first one...i am not initializing the first loop correctly? :-?
    Mac Mini 1.5GHz, 1G, 250G Drive, Apple Cinema Display, MorphOS 3.1 registered, MacOS 10 PowerBook (5,8) 1.67Hz, 2G, 80G Drive,........Waiting
    PowerBook (5,8) 1.67Hz, 2G, 40G MorphOS 3.1 unregisterd
  • »27.04.10 - 01:09
    Profile
  • HAK
  • Order of the Butterfly
    Order of the Butterfly
    Posts: 225 from 2003/2/24
    From: Austria, Vienna
    Hi osco,

    Loop is initialized correct, however you're missing several "END"s - one for the "IF OPEN(input.." line and one for the "DO UNTIL EOF(inp.." line - that's why the program thinks it has finished already.

    Just add them at the right place which would be:
    --- cut here ---
    CLOSE(input1)
    CLOSE(output)

    END /* That's the END for the "DO UNTIL EOF..." line
    END /* That's the END for the "IF OPEN(inp.." line

    END

    EXIT
    --- cut here ---

    Using indention in the source would make such pitfalls more visible.


    Bye HAK
  • »27.04.10 - 16:25
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    osco
    Posts: 680 from 2009/10/21
    From: Boston, USA
    To HAK..Tears of JOY!!! I was in the wilderness when I got your first post.. Lformat..from the ".bat" file to sitting with a cup coffee seeing the Arexx batch process the data base.. Magic and your mercy

    Hope with sucess a trip to Austria :) It's breen awhile! skiing at ZellAmZee

    [ Edited by osco on 2010/4/27 15:46 ]
    Mac Mini 1.5GHz, 1G, 250G Drive, Apple Cinema Display, MorphOS 3.1 registered, MacOS 10 PowerBook (5,8) 1.67Hz, 2G, 80G Drive,........Waiting
    PowerBook (5,8) 1.67Hz, 2G, 40G MorphOS 3.1 unregisterd
  • »27.04.10 - 18:43
    Profile