Go to:  Davar site entry | Site contents | Site index | Personal Computer | PowerBASIC | Text bottom

DSC2REN  PowerBASIC  Procedure

         

DSC2REN procedure (external program executable from the DOS command prompt) converts DESCRIPT.ION file of photo images' directory that was created by RENPHOT and maintained by ACDSee. The result of conversion is REN-LFN.BAT file that could be run in Windows Command session (not DOS!) to rename 8.3 photo image files into LFNs generated from DESCRIPT.ION file.

Direct dependencies:

COMPRES$ Compress character string
TRANS$ Translate character string symbols
PRNTCLR Print colored text to screen



 DSC2REN  Source  Program                                                              Debugging examples

      ' DSC2REN(1.1)  Convert DESCRIPT.ION into Rename BAT   06/17/2005-07/14/2005
      ' --------------------------------------------------------------------------
      ' Copyright (C) 2005 by Vladimir Veytsel                       www.davar.net

      ' Type ---------------------------------------------------------------------

      '    Procedure

      ' Parameters ---------------------------------------------------------------

      '    None - just run it in the current directory of DESCRIPT.ION file created
      '    by RENPHOT and maintained by ACDSee.  As a result the REN-LFN.BAT file
      '    will be generated in the same directory.  Then run REN-LFN.BAT in Windows
      '    Command session (not DOS!) to rename 8.3 photo image files into LFNs
      '    generated from DESCRIPT.ION file.

      '    Notes:

      '     - Program is designed to work on combined directories intended for data
      '       exchange.  Combine them using ACDSee or 4DOS COPY command to handle
      '       DESCRIPT.ION files.

      '     - To have a way back a REN-8-3.BAT file gets generated in the current
      '       directory.  It can be used to reverse LFNs to the original 8.3 names.

      '     - The situation when more than one picture was taken in the span of
      '       only one minute is taken care of.

      ' Example ------------------------------------------------------------------

      '  - Directory DESCRIPT.ION File

      '    04211011.JPG Sun 04/21/2002 10:11  Harriman State Park, NY
      '    04231927.JPG Tue 04/23/2002 19:27  Park Ave, NYC
      '    04271658.JPG Sat 04/27/2002 16:58  Ridgewood, NJ
      '    04271659.JPG Sat 04/27/2002 16:59  Ridgewood, NJ
      '    04271660.JPG Sat 04/27/2002 16:59  Ridgewood, NJ
      '    04271661.JPG Sat 04/27/2002 16:59  Ridgewood, NJ
      '    05012343.JPG Wed 05/01/2002 23:43  Ridgewood, NJ

      '  - Generated REN-LFN.BAT File

      '    REN 04211011.JPG 2002-04-21_Sun_10-11_Harriman_State_Park_NY.jpg
      '    REN 04231927.JPG 2002-04-23_Tue_19-27_Park_Ave_NYC.jpg
      '    REN 04271658.JPG 2002-04-27_Sat_16-58_Ridgewood_NJ.jpg
      '    REN 04271659.JPG 2002-04-27_Sat_16-59_Ridgewood_NJ.jpg
      '    REN 04271660.JPG 2002-04-27_Sat_16-59_1_Ridgewood_NJ.jpg
      '    REN 04271661.JPG 2002-04-27_Sat_16-59_2_Ridgewood_NJ.jpg
      '    REN 05012343.JPG 2002-05-01_Wed_23-43_Ridgewood_NJ.jpg

      '  - Generated REN-8-3.BAT File

      '    REN 2002-04-21_Sun_10-11_Harriman_State_Park_NY.jpg 04211011.JPG
      '    REN 2002-04-23_Tue_19-27_Park_Ave_NYC.jpg 04231927.JPG
      '    REN 2002-04-27_Sat_16-58_Ridgewood_NJ.jpg 04271658.JPG
      '    REN 2002-04-27_Sat_16-59_Ridgewood_NJ.jpg 04271659.JPG
      '    REN 2002-04-27_Sat_16-59_1_Ridgewood_NJ.jpg 04271660.JPG
      '    REN 2002-04-27_Sat_16-59_2_Ridgewood_NJ.jpg 04271661.JPG
      '    REN 2002-05-01_Wed_23-43_Ridgewood_NJ.jpg 05012343.JPG

      ' External SubProgram Library ----------------------------------------------

           $LINK "MODULE.PBL"

      ' External Functions -------------------------------------------------------

           DECLARE FUNCTION COMPRES$(Strng$,Chars$)
           DECLARE FUNCTION TRANS$  (Strng$,Source$,Target$)

      ' External Routine ---------------------------------------------------------

           DECLARE SUB PRNTCLR(Text$)

      ' Start Procedure ----------------------------------------------------------

           DEFINT A-Z  ' All defaulted variables are integer

      ' Open Data Files ----------------------------------------------------------

           IF (LEN(DIR$("DESCRIPT.ION"))=0) THEN
              CALL PRNTCLR("%R%DSC2REN(1.1)  File %M%DESCRIPT.ION %R%doesn't exist in current dir - %M%program stopped%D%")
              STOP
           END IF

           OPEN "DESCRIPT.ION" FOR  INPUT AS #1
           OPEN "REN-LFN.BAT"  FOR OUTPUT AS #2
           OPEN "REN-8-3.BAT"  FOR OUTPUT AS #3

      ' Convert DESCRIPT.ION into Rename BAT Files -------------------------------

           WHILE NOT EOF(1)
                 LINE INPUT #1,Descr.Line$

      '          ----+----1----+----2----+----3----+----4----+---
      '          04231927.JPG Tue 04/23/2002 19:27  Park Ave, NYC

                 Name.8.3$=LEFT$(Descr.Line$,12)
                 DoW$     = MID$(Descr.Line$,14,3)
                 Year$    = MID$(Descr.Line$,24,4)
                 Month$   = MID$(Descr.Line$,18,2)
                 Day$     = MID$(Descr.Line$,21,2)
                 Hour$    = MID$(Descr.Line$,29,2)
                 Minute$  = MID$(Descr.Line$,32,2)
                 Comment$ = MID$(Descr.Line$,36)

                 Comment$=TRANS$(COMPRES$(TRANS$(Comment$,".,:;","    ")," ")," ","_")

                 Date.Time$=Year$+"-"+Month$+"-"+Day$+"_"+DoW$+"_"+Hour$+"-"+Minute$
                 IF (Date.Time$=Prev.Date.Time$) THEN
                    Counter=Counter+1
                    Modifier$="_"+LTRIM$(STR$(Counter))
                 ELSE
                    Counter=0
                    Modifier$=""
                 END IF
                 Prev.Date.Time$=Date.Time$

                 Name.LFN$=Date.Time$+Modifier$+"_"+Comment$+".jpg"

                 PRINT #2,"REN ";Name.8.3$;" ";Name.LFN$
                 PRINT #3,"REN ";Name.LFN$;" ";Name.8.3$
           WEND

      ' Finish Program -----------------------------------------------------------

           CALL PRNTCLR("%W%Run %G%REN-LFN.BAT %W%in Windows Command session (%Y%not DOS!%W%) to rename image files%D%")

           CLOSE
           END
  
         

 DSC2REN  Debugging  Examples                                                                             Source program
         

Below there are two debugging examples of failed and successful DSC2REN program execution along with DESCRIPT.ION file example and two *.BAT files generated from it.

         

   THU  7-14-05 18:46  C:\> PBE DSC2REN
   DSC2REN(1.1)  File DESCRIPT.ION doesn't exist in current dir - program stopped
        
      
         

   THU  7-14-05 18:48  C:\> PBE DSC2REN
   Run REN-LFN.BAT in Windows Command session (not DOS!) to rename image files
        
      
         

   FILE:  C:\PBASIC\DESCRIPT.ION
   ----------------------------------------------------------
   04211011.JPG Sun 04/21/2002 10:11  Harriman State Park, NY
   04231927.JPG Tue 04/23/2002 19:27  Park Ave, NYC
   04271658.JPG Sat 04/27/2002 16:58  Ridgewood, NJ
   04271659.JPG Sat 04/27/2002 16:59  Ridgewood, NJ
   04271660.JPG Sat 04/27/2002 16:59  Ridgewood, NJ
   04271661.JPG Sat 04/27/2002 16:59  Ridgewood, NJ
   05012343.JPG Wed 05/01/2002 23:43  Ridgewood, NJ
        
      
         

   FILE:  C:\PBASIC\REN-LFN.BAT
   ----------------------------------------------------------------
   REN 04211011.JPG 2002-04-21_Sun_10-11_Harriman_State_Park_NY.jpg
   REN 04231927.JPG 2002-04-23_Tue_19-27_Park_Ave_NYC.jpg
   REN 04271658.JPG 2002-04-27_Sat_16-58_Ridgewood_NJ.jpg
   REN 04271659.JPG 2002-04-27_Sat_16-59_Ridgewood_NJ.jpg
   REN 04271660.JPG 2002-04-27_Sat_16-59_1_Ridgewood_NJ.jpg
   REN 04271661.JPG 2002-04-27_Sat_16-59_2_Ridgewood_NJ.jpg
   REN 05012343.JPG 2002-05-01_Wed_23-43_Ridgewood_NJ.jpg
        
      
         

   FILE:  C:\PBASIC\REN-8-3.BAT
   ----------------------------------------------------------------
   REN 2002-04-21_Sun_10-11_Harriman_State_Park_NY.jpg 04211011.JPG
   REN 2002-04-23_Tue_19-27_Park_Ave_NYC.jpg 04231927.JPG
   REN 2002-04-27_Sat_16-58_Ridgewood_NJ.jpg 04271658.JPG
   REN 2002-04-27_Sat_16-59_Ridgewood_NJ.jpg 04271659.JPG
   REN 2002-04-27_Sat_16-59_1_Ridgewood_NJ.jpg 04271660.JPG
   REN 2002-04-27_Sat_16-59_2_Ridgewood_NJ.jpg 04271661.JPG
   REN 2002-05-01_Wed_23-43_Ridgewood_NJ.jpg 05012343.JPG
        
      

         

View [and save] DSC2REN.BAS text       Download DSC2REN.EXE file
(Use [Back] button or [Alt]+[CL] to return here from the viewed text)
Copyright © 2005 by
Go to:  Davar site entry | Site contents | Site index | Personal Computer | PowerBASIC | Text top
1