Hi,
I want to write a Python script that controls and automates a Windows
GUI computation program.
My problem is that I do not know how to quit the Windows GUI program
gracefully with a command (program's or Python) in Cygwin. 'kill' or
CTRL-C command in Cygwin does not finish it gracefully, meaning that
some outputs do not come out normally. The only thing I know is to
click 'File-Exit' menu, but
this requires a manual intervention that prevents scripting.
Is there a way to quit a Windows GUI program gracefully with Python
under Cygwin, of course, after the program finishes
normal execution?
Thanks,
KB 4 5743
Send the active program an alt-f4. I do this through shell.send keys.
Hope this was of help.
KB wrote: Hi,
I want to write a Python script that controls and automates a Windows GUI computation program.
My problem is that I do not know how to quit the Windows GUI program gracefully with a command (program's or Python) in Cygwin. 'kill' or CTRL-C command in Cygwin does not finish it gracefully, meaning that some outputs do not come out normally. The only thing I know is to click 'File-Exit' menu, but this requires a manual intervention that prevents scripting.
Is there a way to quit a Windows GUI program gracefully with Python under Cygwin, of course, after the program finishes normal execution?
Thanks,
KB
Thanks.
After I confirmed 'Alt-F4' would terminate and close a win32
application running independently,
I installed 'SendKeys' module and tested with the following code under
both Cygwin and Python Windows
import os, SendKeys
os.system('prog ram datafile')
SendKeys.SendKe ys("""
{PAUSE 0.25}
%{F4}
""")
What happened was that the 'program' ran correctly, but it stayed, not
closing the window
under Cygwin and Python Windows. So it seems to me that this does not
work.
One more thing: How do I control the pause time if I do not know the
execution
time of an application?
Thanks in advance.
KB
On Fri, Aug 12, 2005 at 03:07:02AM -0700, KB wrote: After I confirmed 'Alt-F4' would terminate and close a win32 application running independently, I installed 'SendKeys' module and tested with the following code under both Cygwin and Python Windows
If you installed the SendKeys binary, then it will not work with Cygwin
Python since it is a Windows Python shared extension module. It may be
possible to port SendKeys to Cygwin. Unfortunately, this may not solve
your problem... :,(
Jason
--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6
Of course, I downloaded the source of 'SendKeys' and installed it under
both Cygwin and Python Windows with
$ python setup.py install
although this did not help me.
KB This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Noah |
last post by:
Does anyone have a function to convert back and forth between
NT style paths and POSIX style? It seems trivial, but
I want to make sure I don't overlook some obscure detail.
Is it a simple matter of translating / and \ characters?
FYI, I need a Python function that does what cygpath does so that
I can run a script on either NT or UNIX or Cygwin.
I want my config files use one style of path.
Yours,
|
by: David Isal |
last post by:
hi all,
i'm new to python and i'm trying to build a python extension on win98,
written in c++, with cygwin.
but i keep having the same error message, and i didnt't find much
resources on the web about it:
>g++ -I/cygdrive/c/python22/include -c demomodule.cpp -o demomodule.o
In file included from /cygdrive/c/python22/include/Python.h:62,
from demomodule.cpp:1:
/cygdrive/c/python22/include/pyport.h:480:2: #error "LONG_BIT definition
|
by: Vamsi Mudrageda |
last post by:
I am kind of new to Python, and after trying and using wxPython, I found
it kind of lacking in easy-to-read documentation, speed at loading, and
GUI response-time.
So I am looking for an another GUI toolkit that is cross-platform for
Python, and am leaning toward PyQt (PyGTK is kind of dull looking in
comparison). Unfortunately, although TrollTech says Qt is
cross-platform, its license strategy has me a bit confused. So here is
to...
|
by: Jonathan Polley |
last post by:
I have one account on a WindowsXP machine that refuses to run IDLE (or
any other python script that uses Tk). Other people can login to that
PC and IDLE runs just fine, so it is not an installation issue. When
the person who has the problem logs into another PC the problem follows
them. Any ideas as to what might me wrong?
This is the traceback from IDLE:
C:\Python20\Tools\idle>..\..\python.exe idle.py
Traceback (most recent call...
|
by: barney |
last post by:
I'm trying to write to an existing file under windows XP (home). The
files are in 'My Music' which I think may be treated in some special
way under XP. The relevant python code is as follows:
os.chdir(dir)
os.chmod(filename, 0744)
print "Okay to write = "+str(os.access(filename, os.W_OK))
afile = file(filename, 'r+b')
When I run this I get the following console output:
| |
by: Abby |
last post by:
I'm now using Cygwin as my compiler for C code. I use Dev-c++ as my
editor.
The reason why I chose Cygwin compiler instead of the compiler that
came with Dev-C++ is that I believe it uses the same environment as in
Linux, so that I don't have to write different sourcecode for both OS.
Eventhough, I don't understand about Linux much, and I'm still a
beginner in programming, I still have to make my program compatible
with both OS (Windows...
|
by: noahmd |
last post by:
Okay, once-upon-a-time I tried to start programming by learning C. At
the time I was younger and didn't really understand all that C had to
offer. I eventually moved over to Microsoft's Visual Basic. It was
nice to be able to design a visual application with no effort (too bad
I didn't really learn the ins and outs of programming)
Long story short, I want to get back into programming, and Python looks
like a good choice for me to...
|
by: mzdude |
last post by:
I've just started playing with Python. Installed 2.5 on Windows XP
system. I'm working through some of the examples in Programming Python
3ed by Mark Lutz. Given the following example when the Quit All button
action is assigned to root.quit the windows aren't dismissed or
destroyed. The application appears to terminate, but the windows
remain. When the action is assigned to root.destroy, the windows are
closed. Questions:
1) Which way is...
|
by: Larry Hale |
last post by:
I've heard tell of a Python binding for libmagic (file(1) *nixy
command; see http://darwinsys.com/file/). Generally, has anybody
built this and worked with it under Windows?
The only thing I've been able to find is the python-magic module at
http://hupp.org/adam/hg/python-magic/.
Is this "THE" python-magic module. (It seems to be to me, but
obviously I don't know. :)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |