home *** CD-ROM | disk | FTP | other *** search
- /* Progress-Bar v1.00 [04-May-1995] for Directory Opus 5.
- By Leo Davidson (P0T-NOoDLE/Gods'Gift Utilities)
- This ARexx script will add a progress bar (like when deleting files)
- to external commands which are run on all the selected files in a
- lister.
-
- Call as:
- ------------------------------------------------------------------------------
- ARexx PBar.dopus5 {p} <AmigaDOS command to do for each selected file>
- ------------------------------------------------------------------------------
- The "Do All Files" switch MUST be turned OFF!!!
- Insert "!!f!!" where you would like the full path to the selected file.
-
- e.g.
- ------------------------------------------------------------------------------
- ARexx DOpus5:ARexx/PBar.dopus5 {p} C:PackIt !!f!! CRUNCH
- ------------------------------------------------------------------------------
-
- TO DO:
- ------
-
- - The user should also be able to specify the "Doing all files..." message.
- - ONLY DIRS and ONLY FILES options.
- - Perhaps propper support for all the {} type codes, not just {f}.
- */
-
- /*-- Setup ------------------------------------------------------------------*/
- options results /* Start talking to DOpus */
- signal on syntax;signal on error;signal on ioerr
- PARSE ARG DOpusPort UserCommand
- If DOpusPort~="" THEN Address value DOpusPort
-
- lister query source /* Get lister and set busy */
- Lister_Handle = RESULT
- If Lister_Handle = "RESULT" THEN EXIT
- lister set Lister_Handle busy 1
-
- lister query Lister_Handle numselentries /* Get info about selected */
- Lister_NumSelEnt = RESULT /* entries & path to them */
- lister query Lister_Handle path
- Lister_Path = Strip(RESULT,"B",'"')
-
- If Lister_NumSelEnt = "RESULT" | Lister_Path = "RESULT" Then Do
- lister set Lister_Handle busy 0
- EXIT
- END
-
- /*-- The Progress Bar ---------------------------------------------------------
- A progress bar will display how many of the selected files have been done.
- This means the max-number argument is Lister_NumSelEnt.
- For each selected entry, the "Do i..." loop updates the progress bar,
- builds and executes the user-defined command, and then de-selects.
- -----------------------------------------------------------------------------*/
- lister set Lister_Handle progress Lister_NumSelEnt "Doing all files..."
-
- Do i=1 to Lister_NumSelEnt
- lister query Lister_Handle firstsel
- Temp_Name = Strip(RESULT,"B",'"')
- lister set Lister_Handle progress name Temp_Name
- lister select Lister_Handle Temp_Name 0
- lister set Lister_Handle progress count i
- lister query Lister_Handle abort
- IF 1=RESULT THEN BREAK /* If they aborted, break the loop */
-
- Temp_Exec = Upper(UserCommand)
- Do While Index(Temp_Exec,"!!F!!") ~= 0
- Temp_Pos = Index(Temp_Exec,"!!F!!")
- Temp_Exec = Left(Temp_Exec,Temp_Pos-1)||'"'||Lister_Path||Temp_Name||'"'||Right(Temp_Exec,Length(Temp_Exec)-(Temp_Pos+4))
- END
- Address Command Temp_Exec
- END
-
- /*-- Restore the Lister for normal use --------------------------------------*/
- syntax:;error:;ioerr: /* In case of error, jump here */
- lister clear Lister_Handle progress
- lister refresh Lister_Handle
- lister set Lister_Handle busy 0
-
- EXIT
-