opening a Tool with a macro and switching back to UE?

opening a Tool with a macro and switching back to UE?

19
Basic UserBasic User
19

    Dec 20, 2006#1

    I use the "RunTool" command within a UE-macro to open Excel automatically to manipulate some data there. Excel opens correctly, but when I want to switch back to UE, I just see a white window (busy?).
    I have to end Excel to see the UE window again.

    How to work parallel with this 2 programms when Excel opened by a macro-call?

    6,687586
    Grand MasterGrand Master
    6,687586

      Dec 22, 2006#2

      Hm, I don't have any problem to start Excel from with UltraEdit.

      First to launch an application independent which program is currently running is best done by creating a shortcut on your Windows desktop or in your Windows start menu and specify a hotkey in the properties of the shortcut.

      I have never understood why there are keyboards with special keys and drivers to start the email program or the Internet browser when I can start my email program with Ctrl+Alt+M (or AltGr+M), my Opera with AltGr+O, my IE6 with AltGr+I, my Total Commander with AltGr+T, my UltraEdit with AltGr+U, my UEStudio with AltGr+D, my IrfanView with AltGr+V, my WinRar with AltGr+R, etc.

      But if you really want to start Excel with the current CSV file from within UltraEdit, that is no problem with the correct tool options.

      I have tested it with following tool settings with UE v12.20b. These settings are needed for all Windows GUI applications!

      Tab Command
      Menu Item Name: Start Excel
      Command Line: C:\Program Files\Microsoft Office\Office11\Excel.exe "%f"
      Working Directory: %p
      Toolbar bitmap/icon (file path): C:\Program Files\Microsoft Office\Office11\Excel.bmp

      Tab Options
      Program Type: Windows program selected
      Save Active File: checked
      Save all files first: not checked

      Tab Output
      Command Output (DOS Commands): Append to Existing selected
      Show DOS Box: not checked
      Capture Output: not checked
      Replace selected text with: No Replace selected

      Attention: Never use double quotes around %p in the working directory field even when the current file path can contain a space. But always use double quotes around %f at the command line. Double quotes around the full file name of the EXE and the bitmap/icon are optional. See help for the Tool configuration dialog for a detailed description of available and case-sensitive % parameters and what is the difference between %F and "%f".

      I used IrfanView to extract the 16x16 icon from Excel.exe (I use small toolbar icons) and modified with a graphic program slightly the color of pixel 0 in top left corner (red value +1) and saved it with 16 colors (4 colors counted). See my post at Colourless Icons for an explanation for the reason of the modification of pixel 0 of the Excel icon.
      Best regards from an UC/UE/UES for Windows user from Austria

      19
      Basic UserBasic User
      19

        Dec 22, 2006#3

        Well, the problem is just when calling the tool from WITHIN A MACRO by "RunTool Excel". When opening the tool from the UE-Menu-icon, everthing works fine (I can work with Excel and UE parallel).

        Of course I could start excel manually too, but it's a little bit more comfort when starting automatically.

        6,687586
        Grand MasterGrand Master
        6,687586

          Jan 13, 2007#4

          I have an idea which of course I have not tested. Try following:


          Tab Command
          Menu Item Name: Start Excel
          Command Line: start "Excel" "C:\Program Files\Microsoft Office\Office11\Excel.exe" "%f"
          Working Directory: %p
          Toolbar bitmap/icon (file path): C:\Program Files\Microsoft Office\Office11\Excel.bmp

          Tab Options
          Program Type: Dos program selected
          Save Active File: checked
          Save all files first: not checked

          Tab Output
          Command Output (DOS Commands): Append to Existing selected
          Show DOS Box: checked
          Capture Output: not checked
          Replace selected text with: No Replace selected


          If this really works, try it also with Show DOS Box: not checked
          Best regards from an UC/UE/UES for Windows user from Austria

          19
          Basic UserBasic User
          19

            Jan 14, 2007#5

            Hey Mofi!

            you're such a UE-Guru!!! :lol:

            It really works now. The reason is the use of

            Code: Select all

            start "Excel"
            in the command line in front of the path to excel.exe
            What's that start command for, I've no idea, is it a DOS-command?

            The thing works even without DOS-window but not when trying to set Program Type to "Windows"

            6,687586
            Grand MasterGrand Master
            6,687586

              Jan 14, 2007#6

              start is a Windows standard command like copy and dir. Since NT4 it is in cmd.exe like copy and dir. (In Win9x start is start.exe in Windows subdirectory Command.)

              So it is a DOS or better a 32 bit console application. Its task is to run/start a Windows GUI application from within a batch file mainly with the /wait parameter (= interpretation of the batch file halted until started GUI application has terminated).

              Because it looks like the RunTool command always waits until the started tool terminates, I thought to start Excel with the start command without parameter /wait could be a solution because then the tool is a DOS (correctly 32 bit console application). start itself starts Excel, but does not wait for the termination of Excel and so immediately terminates itself. UltraEdit detects the termination of start and continues with the macro.

              If you want more infos about command start, open a console window (run cmd.exe for example) and enter start /? to get the help for this command.
              Best regards from an UC/UE/UES for Windows user from Austria