All,

Since I didn't get a reply here that gave me the results I wanted, I went to ... "Newsgroups:comp.lang.tcl" ... and submitted my question there. A David Gravereaux sent me a reply to use a utility that he created to solve my problem. I could NOT use that utility because it was for a later version of TCL than what I am currently using.

Below is the reply I sent to the "Newsgroups:comp.lang.tcl" to solve my problem.

Mark

[snippet]

I downloaded the utility that David Gravereaux told me to use, however, it was for a later version of TCL than what I am currently using. I am currently using TclPro1.1 version 8.0 (patchlevel 8.0.4). I was too close to delivery of my product to download and use a newer version of TCL to use his utility. (I did NOT have enough time to make sure everything still worked with my product on a newer version of TCL ... you just NEVER know, it is better to do a complete checkout of your product to be sure your product works before delivering than not doing a complete checkout on a newer verion of TCL) .

I solved the problem by launching the executable from the file manager. Set the window property features that I wanted to the window that is launched by my tcl program. The KEY piece to getting the results I wanted was :

 

When the "Apply Properties" window appears after you select the "OK" button from the properties window, select the following radio button :

"Save properties for future windows with same title"

then select the "OK" button in that window.

 

In my TCL program I used the following command and got the results that I desired.

exec cmd.exe /c Shortcut_to_junk.lnk &

I have attached a WORD document (Window_property_settings.doc) to this reply which contains snapshots of the windows that shows the steps I took to get the results I wanted.

Mark Jarmus
[snippet]


Brian Griffin <bgriffin@model.com>
10/03/2003 07:37 AM MST

To: tcl-win@lists.sourceforge.net
cc: Mark A Jarmus <majarmus@raytheon.com>
bcc:
Subject: Re: [WINTCL] cmd.exe error


Try removing the cmd.exe /c part from the exec command.  On Windows, you
can exec any file and Windows will use the registered application for
the given extension.  For example "exec letter.doc" will open MSWord on
the file letter.doc.

-Brian

Mark A Jarmus wrote:

> Brian,
>
> No, I had not tried that before you told me to do so ...
>
> I did do that in my TCL program and now I don't get the error ('File
> name' is not recognized as an internal or external command, operable
> program or batch file), and the shortcut runs the ".exe" file. Thanks
> for helping me get rid of the error I was getting, however, the
> results are NOT what I want. The resulting window has the attributes
> of the ".exe" file and NOT the shortcut.
>
> I have attached two files to this email as an example of what I am
> trying to do ...
>
> 1) junk.exe - a very simple compiled "c" program
>
> 2) Shortcut_to_junk - shortcut to the executable
>
> When you double click file 1) a window comes up with white text on a
> black background.
>
> When you double click file 2) a window comes up with red text on a
> yellow background.
>
> In my sample TCL program I now have :
>
> a) exec cmd.exe /c junk.exe &
>
> b) exec cmd.exe /c Shortcut_to_junk.lnk &
>
> Both a) and b) launch a window with white text on a black background.
> I want b) to act like 2) ... meaning I expected to get a window with
> red text on a yellow background, however, I get a window with white
> text on a black background ... which is 1) and NOT 2).
>
> How can I get the shortcut attributes rather than the attributes of
> the ".exe" file of the window that is launched by b) in my TCL program???
>
> TIA,
>
> Mark
>
> Brian Griffin <bgriffin@model.com>
> 10/02/2003 05:01 PM MST
>
> To: Mark A Jarmus <majarmus@raytheon.com>
> cc: tcl-win@lists.sourceforge.net
> bcc:
> Subject: Re: [WINTCL] cmd.exe error
>
>
> Have you tried:
>
>       exec shortcut_to_my_file.lnk  &
>
> ?
> -Brian
>
> Mark A Jarmus wrote:
>
> >
> >
> >
> >All,
> >
> >I am working on a PC WINDOWS system (OS WIN 2000) and trying to exec a
> >shortcut to an executable file from my TCL program. I get the following
> >error :
> >
> >'File name' is not recognized as an internal or external command,
> operable
> >program or batch file
> >
> >The executable that I am trying to run was given to me by someone else (I
> >don't have control of the source code to the executable I am trying
> to run)
> >which I am running within my TCL application. If I exec the
> executable file
> >within my TCL program it runs fine, however I have created a shortcut to
> >the executable so that I can control various attibutes (foreground color,
> >background color, width of window, height of window, etc.) of the window
> >that is launched when the executable is running.
> >
> >1) exec cmd.exe /k my_file.exe &
> >or
> >2) exec cmd.exe /c my_file.exe &
> >
> >When I run either of the above two commands from the console and from
> >within my TCL program, both of these launch the executable file (namely,
> >"my_file.exe") in the background, however, I can't preset the
> attributes of
> >the window that appears before it appears on the CRT ... which is
> something
> >I want to do.
> >
> >A) exec cmd.exe /c shortcut_to_my_file &
> >
> >When I run the above command from the console I get the error message I
> >listed above (namely, 'File name' is not recognized as an internal or
> >external command, operable program or batch file). When I run the above
> >command from within my TCL program ... nothing "appears" to happen ...
> >meaning ... I don't get any TCL error messages and I don't see the window
> >appear on the CRT as I do when I run from the console.
> >
> >
> >Can anyone tell me how I can call or execute a "SHORTCUT" to an
> executable
> >from within my TCL program???
> >
> >Any help you can provide will be greatly appreciated.
> >
> >TIA,
> >Mark
> >
> >
> >
> >
> >-------------------------------------------------------
> >This sf.net email is sponsored by:ThinkGeek
> >Welcome to geek heaven.
> >http://thinkgeek.com/sf
> >_______________________________________________
> >Tcl-win mailing list
> >Tcl-win@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/tcl-win
> >
> >
> >
>
> --
> -------------------------------------------------------------
> --                 Model Technology Inc.                   --
> -- 8005 SW Boeckman Road                  503.685.7000 tel --
> -- Wilsonville, OR 97070 USA              503.685.0921 fax --
> -------------------------------------------------------------
> -- Technical support ............ mailto:support@model.com --
> -- Sales and marketing info ....... mailto:sales@model.com --
> -- Licensing .................... mailto:license@model.com --
> -- Home Page ........................ http://www.model.com --
> -- AIM ........................................ bgriffin42 --
> -------------------------------------------------------------
>

--
-------------------------------------------------------------
--                 Model Technology Inc.                   --
-- 8005 SW Boeckman Road                  503.685.7000 tel --
-- Wilsonville, OR 97070 USA              503.685.0921 fax --
-------------------------------------------------------------
-- Technical support ............ mailto:support@model.com --
-- Sales and marketing info ....... mailto:sales@model.com --
-- Licensing .................... mailto:license@model.com --
-- Home Page ........................ http://www.model.com --
-- AIM ........................................ bgriffin42 --
-------------------------------------------------------------