home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************
- * This ARexx program demonstrates how to communicate with other
- * applications (in this case AmigaDOS!) and bring the results
- * back to Scala using Scala Lingo.
- *
- * The program displays a list of all files in the current
- * directory,
- *
- * You may also specify a directory name:
- *
- * 1> rx Dir:scala Work:Scala/Backgrounds
- *
- * Depending on your harddisk setup, you might have to change the
- * assignment of "picture_file = ..." below.
- **********************************************************************/
-
- /* trace results */
-
- parse arg dir
-
- picture_file = ":Scala/Backgrounds/Texture002" /* Background picture */
-
- tmpfile1 = "ram:scdir1.tmp" /* Temporary file #1 */
- tmpfile2 = "ram:scdir2.tmp" /* Temporary file #2 */
-
- pagenum = 0
-
- prepare_page() /* Set up a new page, but don't display yet... */
-
-
- address command /* Talk to DOS */
- /* Use AmigaDOS "LIST" to obtain a list of files. The list is placed
- in a temporary file in RAM */
- 'list >' tmpfile1 ' ' dir ' quick nohead'
- 'sort' tmpfile1 tmpfile2
-
- /* Read and display all filenames in the list */
- if open(file,tmpfile2,'Read') then do
- do while ~eof(file)
- name = readln(file) /* Get next filename */
- address 'rexx_InfoChannel' /* Talk to ScalaPlayer */
- if length(name) > 0 then
- text x y '"'||name||'"' /* Write text */
- y = y + 20
- if y > 380 then do
- y = 80
- x = x + 210
- if x = 230 then do
- textwipe bob south easeout speed 10
- end
- if x = 440 then do
- textwipe bob west easeout speed 10
- end
- if x >= 630 then do /* Filled up a page? */
- show /* Yes: display the page */
- prepare_page() /* Set up the next page */
- end
- end
- end
- close(file)
- /* Delete the temporary file from RAM: */
- address command
- 'delete ' tmpfile1 tmpfile2
- end
-
- /* All filenames are processed; we have set up a page wich is now
- ready to be displayed */
- address 'rexx_InfoChannel' /* Talk to ScalaPlayer again... */
- show /* Show the page! */
- continue
- exit /* and exit! */
-
-
- /*
- * Subroutine:
- * Set up a new page with background picture, heading, page number.
- * The page is not displayed until a "SHOW" command is issued.
- */
- prepare_page:
- pagenum = pagenum + 1
- address 'rexx_InfoChannel' /* Talk to ScalaPlayer */
- picture picture_file /* Use background IFF picture */
- wipe curtain speed 10
- font "franklin.font" 23 /* Select font */
- color 9 0 0 0 0 0 0 /* Set text colors */
- style 0 3 4 3 6 2 1 29 4 1 20 0 5 2 /* Set text style parameters */
- attributes underline shadow /* Draw text with underline and shadow */
- /* Display heading */
- textwipe dump
- text 20 40 '"Directory: "'
- if length(dir) > 0 then
- text 160 40 dir
- else
- text 160 40 '"(Current Directory)"'
- text 530 40 '"' || '(Page' pagenum || ')"'
- font "franklin.font" 18
- style 0 3 4 3 6 2 1 14 2 1 20 0 5 2
- color 1 0 0 0 0 0 0
- 'pause -1' /* Show page until mouse click */
- /* Turn off underline but keep shadow */
- attributes shadow
- x = 20
- y = 80
- textwipe bob east easeout speed 10
- return 1
-