473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

message getting displayed in another window when invoked

I am invoking a cygwin session by the following code

Expand|Select|Wrap|Line Numbers
  1. from win32com.client import *
  2.  
  3. a = Dispatch("Wscript.Shell")
  4.  
  5. a.Run("C:/cygwin/cygwin.bat");  
  6.  
  7. a.SendKeys ("cd D:/temp/code" + "{Enter}")
  8.  
  9. a.SendKeys ("ls -lrt?" + "{Enter}")
  10.  
  11.  
Scenario: If another window namely NOTEPAD is invoked during the course of the script execution

Expected result: The entire script (commands) should be executed in the cygwin window regardless of any external application.

Result obtained: The current command executed is copied into the invoked window rather than at the cygwin prompt (i.e "ls -lrt" command is issued in the Notepad window.)

Thus what i intended to happen at cygwin prompt didnt happen completely.

How do i ensure that the command that i am issuing is executed in the window where in i need it. Why does this happen and How do i handle this situation?

Kindly guide me accordingly.

Thanks
BK
Nov 22 '06 #1
2 1245
bartonc
6,596 Expert 4TB
It seems to me that much depends on how you do this:

Scenario: If another window namely NOTEPAD is invoked during the course of the script execution
Help us help you by supplying a little more info. Thanks.
Nov 22 '06 #2
The problem i am facing is it that during the course of the execution of the script, if knowingly or unknowingly any text editor is opened, the remaining command inside the "a.SendKeys" command is displayed there.

I have no clue why is such a thing happening.

Expand|Select|Wrap|Line Numbers
  1. a.Run("C:/cygwin/cygwin.bat");   #invokes the cygwin session
  2. a.SendKeys ("cd D:/temp/code" + "{Enter}") #executes the cd command 
  3.  
now when i invoke a text editor (knowingly or unknowingly) the remaining command in the code below is printed in the editor.

Expand|Select|Wrap|Line Numbers
  1. a.SendKeys ("ls -lrt?" + "{Enter}")
  2.  
I just want the commands to be executed in the cygwin prompt which is invoked as shown in the code section of the 1st post. But when a text editor is invoked the issue persists.

Is it something to do with handling with active window or something?

i hope i am able to convey the problem i am facing.

Thanks,
Badri
Nov 28 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
9
by: Ksenia Marasanova | last post by:
Hi, I have a little problem with encoding. Was hoping maybe anyone can help me to solve it. There is some amount of data in a database (PG) that must be inserted into Excel sheet and emailed....
16
by: Chris Maloof | last post by:
Hello, Does anyone know how I can read the ASCII text from a console window (from another application) in WinXP? It doesn't sound like a major operation, but although I can find the window via...
9
by: Justin Koivisto | last post by:
Is there a way to create an alert-like message box that uses a custom image? Basically, I want to replace the default ! image with something else. -- Justin Koivisto - spam@koivi.com PHP...
3
by: Andrew Baker | last post by:
OK this has me perplexed, puzzled and bamboozled! I have a remoting service which I displayed a message box in. I then wondered what would happen if a client made a call to the service while the...
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
1
by: Robin Dindayal | last post by:
Does anyone know how I can print a fully rendered .aspx to the server's printer? I know that, if I wanted to print to the client's printer it would be easy (ie. use javascript's window.print()). ...
3
by: Xero | last post by:
Hello. I'm using Visual Basic .NET. How can I make a window inactive when another windows is being displayed? For instance, if the user clicks a menu item, a button or whatever, a new window...
0
by: Guilherme Polo | last post by:
On Thu, Aug 28, 2008 at 10:29 AM, <dudeja.rajat@gmail.comwrote: It is good to post a short code sample that demonstrates the problem, but it has to run by itself at least. tkMessageBox...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.