Problem with running script from command line in DOS batch file

Problem with running script from command line in DOS batch file

2
NewbieNewbie
2

    Aug 13, 2009#1

    Hi!

    I'm facing some issues and maybe a bug related to the use of the command line with UE.
    • To open a file and position the cursor on a specific line, I need to enclose the *whole* command into quotes if the filename or/and the path contains spaces.

      Examples :

      Code: Select all

      uedit32 "c:\first dir\second dir\file.txt/10"
      works. But

      Code: Select all

      uedit32 "c:\first dir\second dir\file.txt"/10
      doesn't work (well, it opens the file, but I get an annoying error message).

      It sounds more logical to me to use the second syntax, as the command line options should not be enclosed by quotes.
    • I also tried to use a script as described in Run a macro or script from the command line with no luck :-(

      I also tried zillions of quotes combinations, unsuccessfully. And even a very simple :

      Code: Select all

      uedit32 c:\temp.txt /s="c:\testOutputUE.js"
      or

      Code: Select all

      uedit32 c:\temp.txt /s=c:\testOutputUE.js
      doesn't work for me - It is *very* similar to one of the examples of the webpage mentioned above.
    Did I miss something?

    Thanks and regards

    6,686585
    Grand MasterGrand Master
    6,686585

      Aug 14, 2009#2

      You must use "c:\first dir\second dir\file.txt/10" because the argument is filename/line number as documented in help of UltraEdit. When an argument contains spaces you have to enclose it in spaces so that Windows passes this argument as one string to the called application.

      Second your command line to call UltraEdit and execute the script surely works, but only when no UltraEdit is currently open or when configuration setting Allow multiple instances is enabled.

      Use uedit32 /fni c:\temp.txt /s="c:\testOutputUE.js" and starting UltraEdit with loading the file and executing the script always works, independent if one or more instances of UltraEdit are already open and independent of the configuration settings. For details why /fni must be used see Always get error message when running a macro/script via command line parameter.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Aug 14, 2009#3

        Hi Grand Master Mofi ;-)

        Thanks for your prompt reply and the complete explanations.

        A final question : Is there an easy way to send text to the output window with the command line? For now, the only way I found was to use a temporary text file and a script to copy its content to the output window - not very efficient, to say the least. Is there a "/o "Blahblah"" hidden feature ? ;-)

        Actually, I wanted to use UE as a "helper editor" for my own program that requires editing (it works), and displaying an output status.

        Thanks and regards

        6,686585
        Grand MasterGrand Master
        6,686585

          Aug 14, 2009#4

          I don't know about a method to call UltraEdit and tell UE to load the content of a file to its output window. You could write an email with the request for an enhancement of the command line parameters to be able to specify for example /ow,1="file to show in output window" on the command line. ,1 would be an optional parameter for UEStudio which has 4 output windows and therefore it would be good if on the command line the number 1-4 for the output window to use could be specified too.

          A quick method to get content of a file into the output window is to configure a user tool with the command line type "name of the file", specify to capture the output of this DOS user tool to the output window in the tool options, and write a script or macro which simply just calls this user tool. Of course that requires also the usage of /s= or /m= and therefore requires /fni.

          To make the file name variable, the user tool could have the command line type "%f", the file with the content for the output window is specified as file to open in UltraEdit and the macro/script closes this file after executing the tool.

          The last variant I can suggest is to use a fixed file name and a macro is created which calls the user tool and then closes the file with the definite name. This macro having the code

          IfNameIs "Name of file with content for output window without path and extension"
          RunTool "case-sensitive name of the tool"
          CloseFile NoSave
          EndIf


          is configured to be executed on every file load. Now it would be possible to just call uedit32.exe with the file and it should be loaded into the output window. That would work without /m, /s and /fni and therefore also when UltraEdit is already running.

          Maybe there is an interface for applications using UltraEdit as editor to write something directly to its output window. If there is such an interface, it is not documented public. Contact IDM support by email and ask if such an interface exist. UltraEdit is used in some other applications as editor.
          Best regards from an UC/UE/UES for Windows user from Austria