Command line run macro doesn't exit

Command line run macro doesn't exit

2
NewbieNewbie
2

    Feb 28, 2007#1

    I have the following macro:

    Code: Select all

    InsertMode
    ColumnModeOff
    HexOff
    UnixReOff
    Find MatchCase PreserveCase "^p^p"
    Replace All "<P>"
    Find MatchCase PreserveCase "^p"
    Replace All " "
    "<BODY>
    "
    InsertMode
    Clipboard 9
    CopyFilePath
    Top
    Paste 
    Find Up Select "."
    Delete
    ".html"
    SelectToTop
    Cut 
    SaveAs "^c"
    ClearClipboard
    Clipboard 0
    RunTool "Mobigen"
    (It turns a Gutenberg .txt format ebook into (very) rough HTML, and then runs an external tool to turn the generated html into a .mobi Mobipocket ebook)

    This works pretty well as a macro, but I want to run it from a batch file:

    Code: Select all

    "c:\Program Files\UltraEdit\uedit32.exe" %1 
            /M,E="D:\eBooks\Gutenberg\mobigen\txt2html2mobi.MAC"
    The problem I'm getting is that Uedit does not exit after running the macro, as directed by the E parameter, plus also it only works at all if Uedit is not already running in the background.

    When I try to tackle the latter problem first with a custom .ini, containing a multipleinstances=1 line:

    Code: Select all

    "c:\Program Files\UltraEdit\uedit32.exe" %1 
           /i=D:\eBooks\Gutenberg\mobigen\UEini.ini 
           /M,E="D:\eBooks\Gutenberg\mobigen\txt2html2mobi.MAC"
    That seems to work, although it had me going for a little while as the Tool configuration is also in the ini and thus initially missing.

    That did provide some useful diagnostics, though: With the tool definition gone, obviously it didn't make the mobi file (although, IMHO, tool-not-found should NOT fail silent, but whatever), but it *did* exit as it ought to. Can anyone figure out why it doesn't exit after calling the external tool? It's not just if it's in the last line, either, I just modified the macro to put a test string into the file after the mobigen line, and that works, but still results in not doing the Exit upon completion.

    6,687587
    Grand MasterGrand Master
    6,687587

      Mar 01, 2007#2

      First PreserveCase is twice useless in your macro.

      Second is "Mobigen" a Windows GUI application or a 32 bit console application?

      If it is a Windows GUI application maybe it is better to run it from within the batch file after UltraEdit has done it's job and not from within UltraEdit, if that is possible.

      See opening a Tool with a macro and switching back to UE? for further details. Maybe using

      start "UltraEdit" /wait "c:\Program Files\UltraEdit\uedit32.exe" %1 ...
      start "Mobigen" /wait ...

      is the better solution.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Mar 01, 2007#3

        Mofi wrote:First PreserveCase is twice useless in your macro.
        All right, it's gone. My macro skills are about at the level of "record and playback" plus "stea^H^H^H^Hloan code from forum posts", and I didn't mess with the bit that I simply recorded (well, not much, I did clean up some extraneous stuff about loading files etc).
        Second is "Mobigen" a Windows GUI application or a 32 bit console application?
        If it is a Windows GUI application maybe it is better to run it from within the batch file after UltraEdit has done it's job and not from within UltraEdit, if that is possible.
        It's CLI, but running it from the batch file would be a possibility.
        See opening a Tool with a macro and switching back to UE? for further details. Maybe using

        start "UltraEdit" /wait "c:\Program Files\UltraEdit\uedit32.exe" %1 ...
        start "Mobigen" /wait ...

        is the better solution.
        The main reason I tried to go with it running from UE was a) because it's just, like, less hacky, but more importantly, 2), What I'm doing is leaving the txt which is the batch file parameter alone, generating a file with the same name except extension .html, and then running the mobigen.exe on the .html file. In addition, I'd like to be able to drag and drop a .txt file onto the .bat icon, which gives you a fixed commandline for the bat (batchfile name plus the filename (in quotes if it has spaces) as %1). Thus to be able to call the mobigen.exe with the .html file, I'd have to use DOS batch language to add the .html[1], which is problematic mainly because of the quotes/longfilename issue.

        Anyway, the thing is, the whole thing works as designed, except that apparently UE loses the "and close afterwards" functionality of the command line parameter simply because I run a Tool. I think this is probably a bug, rather than a feature, unless I'm missing something.

        [1] I just now decided to go with the full original filename plus html, ie stuff.txt.html, rather than stuff.html.

        6,687587
        Grand MasterGrand Master
        6,687587

          Mar 03, 2007#4

          JJanssen wrote:I just now decided to go with the full original filename plus html, ie stuff.txt.html, rather than stuff.html.
          This is a solution. But better would be to use for Mobigen %~dpn1.html instead of %1.html.

          That info is from the page Batch File Command Reference for Windows 2000 - Variables.
          Best regards from an UC/UE/UES for Windows user from Austria