Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: How to run a program with ! / winexec minimized


From   Roy Wada <[email protected]>
To   <[email protected]>
Subject   st: How to run a program with ! / winexec minimized
Date   Thu, 29 Nov 2007 01:35:34 -0800

A modified version of -shellout- (one of the programs associated with
-outreg2-) will accomplish this task. I have been meaning to get this
one done.

*! shellout 1.1 Nov2007
*! by [email protected]
*! originally written to accompany -outreg2-
*
* version history
* 1.0   Oct2005	beta
* 1.1   Nov2007	opens an application without document name
*		opens a document with or without "using"

program define shellout
version 8.2

syntax [anything] [using/]
* does the shelling
if "`c(os)'"=="Windows" {
	if "`using'"~="" {
		winexec cmd /c start ""  "`using'"
	}
	else {
		cap winexec `anything'
		if _rc==193 {
			winexec cmd /c start ""  "`anything'"
		}
		if _rc==601 {
			noi di in yel "Cannot find `anything'. Make sure typed the name correctly, and then try again."
		}
	}
}
else {
	di "{opt shellout} probably will not work with `c(os)'"
	shell `using'
}
end


EXAMPLES:
shellout wsestata.exe
shellout using tom.xml
shellout tom.xml
shellout yumyum.do

The first line will open another Stata.
The second line will open a document named tom.xml in Excel.
The third line will do the same thing without invoking the "using" syntax.
The fourth line is the equivalent of -do yummy- in another Stata executable.

I'll get a copy to Kit B. to have it uploaded to SSC.

Roy


> Date: Wed, 28 Nov 2007 12:10:54 -0200 (BRT)
> From: [email protected]
> Subject: st: How to run a program with ! / winexec minimized
>
> Dear list,
>
> Looking at previous messages, I found out other Stata user with the same
> problem as mine.
>
> I would like to invoke a shell from Stata without a visible
> window for the shell.
>
> According to Alan Riley, this would be possible by setting $S_SHELL
> temporarily to contain the name of the executable.
>
> Hence, would it be possible to you to show me how to do that and then set
> Stata as it was by default?
>
> If any newer solution is already available, I will be grateful for any help.
>
>
>
> All the best,
>
> Tiago
> *







_________________________________________________________________
Connect and share in new ways with Windows Live.
http://www.windowslive.com/connect.html?ocid=TXT_TAGLM_Wave2_newways_112007
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index