Announcement

Collapse
No announcement yet.

Why doesnt my script work?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Why doesnt my script work?

    I am just getting started try to use InfranView 4.38 to modify photos for a website (http://fanac.org) that I support. I am using Regina Rexx under Windows XP. I don't know why the following command failed to work as expected:

    @START /MAX "C:\PROGRAM FILES\IRFANVIEW\I_VIEW32.EXE" f:\fanac\newstuff\work\dsc10.jpg /info=f:\fanac\newstuff\nbrooks\deepsouth\iview.wrk /cmdexit

    The selected photo displayed and InfranView returned a "0" but nothing else happened, iview.wrk was not created and InfranView was not automatically closed.

    I tried various other combinations, iview.wrk without the drive & path, /cmdext first, but with no joy...

    I'm sure that I'm doing something dumb, it wouldn't be the first time, but I don't know what it is.

    #2
    I don't use scripts much. My first guess would be that it doesn't like the period in iview.wrk, so try iviewwork or "f:\fanac\newstuff\nbrooks\deepsouths\iview.wr k"

    You see — even the forum doesn't like the period in the folder name !
    Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      The "iview.wrk" in "f:\fanac\newstuff\nbrooks\deepsouth\iview.wrk " is the file name not a folder name.

      But what the hey, I just tried that, both ways, still no joy.

      Comment


        #4
        OK, that was a bit strange. I got rid of the START and invoked InfranView directly and it did what I expected it to do in the first place.

        Comment


          #5
          Afraid you have discovered one of the problems that Command line scripts have had ever since FAT32 file structures were introduced with Windows95.
          The Command line interpreter only treats a file name inside quote marks as an executable file if it is the first thing on the line.

          So "FILENAME.EXE" works but START "FILENAME.EXE" does not
          START FILENAME.EXE works but START FILE NAME.EXE does not because that is read as START FILE because of the space in the name.

          The workaround for a file name with a space in it is to use a feature introduced way back then to provide compatibility with the old 8.3 filenames that existed before FAT32 and NTFS files were invented. 8.3 filenames were allowed a maximum of 8 characters in the name and 3 in the suffix, with no spaces. The feature allows you to use PROGRA~1 in place of PROGRAM FILES. PROGRA~1 is interpreted as the 1st occurrence in the folder of a file starting PROGRA...

          So, if you need to use START function then START C:\PROGRA~1\IRFANVIEW\I_VIEW32.EXE ... is what you want.

          Note that I am only using upper case for clarity. Lower case is quite OK or a mixture
          Also that everything else in the line after that is passed to Irfanview as Arguments and that takes care of quotes and spaces, so you do not need to bother too much after you have persuaded the Command line interpreter to recognise the executable file correctly.
          Last edited by Mij; 23.10.2014, 09:49 PM. Reason: Clarification re PROGRAM~1

          Comment


            #6
            As I said above, "I'm sure that I'm doing something dumb...". When you generate an OS command using Rexx you should enclose the command in quotes, for example, the line:

            if Ext = 'JPG' then '@START /MAX' value('VIEWER',, POOL) File

            in a different program, works just fine, so I probably forgot the quotes and the START was overkill in the first place...

            What I cannot see, however, is why

            %VIEWER% f:\fanac\newstuff\nbrooks\deepsouth\d10.jpg /info=f:\fanac\newstuff\nbrooks\deepsouth\iview.wrk /cmdexit

            does what I expected and

            %VIEWER% f:\fanac\newstuff\nbrooks\deepsouth\d10.jpg /resize=(750,0) /aspectratio /cmdexit

            doesn't. The lines above were cut and pasted from the trace output of the following line of code:

            '%VIEWER%' lower(Source Options)

            Note that the single quotes do not show up in the Rexx trace.

            Thanks for the information. I'm migrating the support for a couple of websites from an old, tired, and slow PC running eCS to a newer and faster PC running XP with plans to upgrade to lasted Windows in the near (?) future so your help is greatly appreciated.

            Comment


              #7
              I am getting confused here. My reply was about Command lines which are executed by the Windows program cmd.exe
              What are generally known as "Batch files" that end with suffix .bat or .cmd are executed as a series of Command lines.
              There are (or at least were) some Scripting programs that generated .bat files for you, but having read about it I see that Rexx is not one of those.

              As I understand it Rexx includes an embedded form of the Windows program Wscript.exe. I am familiar with Wscript.exe because I use Visual Basic Script (suffix .vbs) that employ Wscript.exe as a shell program. My confusion came from your example containing the START function (or something similar) which is a valid command in Batch scripts but does not exist in Visual Basic Scripts.

              In Batch files command lines commencing with START launch the executable program that follows on the line and then immediately continue with the next command line.
              Lines without START, launch the executable as a sub-routine and then wait for that program to close before continuing with the next command line.

              The Wscript.exe method Shell.run caters for both cases (and more) depending on values of the variables listed after it.

              That appears to be of no concern though now since you have apparently sorted out the syntax that works for you.
              I have dealt with the issue you report in #6 in your other post " Why doesn't my script work -Part 2" where we are not talking about Rexx scripts.

              Do you belong to a forum that specialises in Rexx? If so I think you will have to find some method of identifying what are Irfanview issues and what are Rexx, or you may be lucky enough to find someone familiar with both who can help you.
              Last edited by Mij; 23.10.2014, 09:53 PM.

              Comment


                #8
                Thank you. Your answer to "Part 2" solved my problem.

                Comment

                Working...
                X