473,396 Members | 1,987 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,396 software developers and data experts.

Using win32ui.CreateFileDialog() to get the name of a file.

Hello.
I'm writing a program that creates a series of batch operations to
convert movies to be used on iPodLinux. The programs that do the
encoding and conversions are seperate from mine and all mine does is
use os.system() to call the program.

However, it needs to get an input file and an output file. Originally
I was using just raw input, but I got adventuresome and decided to try
win32ui.CreateFileDialog(). But this will only open or save a file and
its output will be either 1 or a failure. How might I go about using
it to get the _file name_ of a file.
For example.
Box appears asking user to find a file they want. They double click on
the file. Let's call it C:\Video.avi
Then another dialog box appears asking them where to save it. They
save it at C:\iPodVideo.avi.

Now the Python program extracts the name of these files and then uses
os.system() to run:
mencoder.exe -[parameters] C:\Video.avi -o C:\iPodVideo.avi

Note that I'm not actually inputting the contents of the file, I'm just
passing the file name along.

How might I do this? Thanks.

Nov 22 '05 #1
4 3608
Joey C. wrote:
Hello.
I'm writing a program that creates a series of batch operations to
convert movies to be used on iPodLinux. The programs that do the
encoding and conversions are seperate from mine and all mine does is
use os.system() to call the program.

However, it needs to get an input file and an output file. Originally
I was using just raw input, but I got adventuresome and decided to try
win32ui.CreateFileDialog(). But this will only open or save a file and
its output will be either 1 or a failure. How might I go about using
it to get the _file name_ of a file.
For example.
Box appears asking user to find a file they want. They double click on
the file. Let's call it C:\Video.avi
Then another dialog box appears asking them where to save it. They
save it at C:\iPodVideo.avi.

Now the Python program extracts the name of these files and then uses
os.system() to run:
mencoder.exe -[parameters] C:\Video.avi -o C:\iPodVideo.avi

Note that I'm not actually inputting the contents of the file, I'm just
passing the file name along.

How might I do this? Thanks.

After you've had the user interact with the dialog you should call its
GetFileName() method. The interactive interpreter can be useful in
finding things like this out (though many details of objects can remain
hidden in the Windows environment):
dir(d) ['GetFileExt', 'GetFileName', 'GetFileTitle', 'GetPathName',
'GetPathNames', 'GetReadOnlyPref', 'SetOFNInitialDir', 'SetOFNTitle'] d.Show()


regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Nov 22 '05 #2
Joey C. wrote:
Hello.
I'm writing a program that creates a series of batch operations to
convert movies to be used on iPodLinux. The programs that do the
encoding and conversions are seperate from mine and all mine does is
use os.system() to call the program.

However, it needs to get an input file and an output file. Originally
I was using just raw input, but I got adventuresome and decided to try
win32ui.CreateFileDialog(). But this will only open or save a file and
its output will be either 1 or a failure. How might I go about using
it to get the _file name_ of a file.
For example.
Box appears asking user to find a file they want. They double click on
the file. Let's call it C:\Video.avi
Then another dialog box appears asking them where to save it. They
save it at C:\iPodVideo.avi.

Now the Python program extracts the name of these files and then uses
os.system() to run:
mencoder.exe -[parameters] C:\Video.avi -o C:\iPodVideo.avi

Note that I'm not actually inputting the contents of the file, I'm just
passing the file name along.

How might I do this? Thanks.

After you've had the user interact with the dialog you should call its
GetFileName() method. The interactive interpreter can be useful in
finding things like this out (though many details of objects can remain
hidden in the Windows environment):
dir(d) ['GetFileExt', 'GetFileName', 'GetFileTitle', 'GetPathName',
'GetPathNames', 'GetReadOnlyPref', 'SetOFNInitialDir', 'SetOFNTitle'] d.Show()


regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Nov 22 '05 #3
Okay, thank you. This worked very well.

Nov 22 '05 #4
Okay, thank you. This worked very well.

Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Me Mine | last post by:
i, I have trying to code a small console app that will allow a user to select a window and then create a screen capture of the window. I haven't been able to figure out how to do the screen...
1
by: Serge Guay | last post by:
I have been trying to print a text file to my printer but the most I have been able to do is print one line. I have been using the following commands. dc = win32ui.CreateDC()...
1
by: EricP | last post by:
I get the following error when I run this script to open a file dialog. I've searched the web and news groups for this issue and have not found any references. I get the same behavior when I run...
2
by: Darcy Kahle | last post by:
I am trying to do some advanced printing in python using the win32ui module, and have run into an issue. I need to print a page landscape. As I could not determine how to specify the orientation...
3
by: MsKitty | last post by:
My client is used to clicking on the script name on her PC and getting a windows command line box which it runs in. Not fancy but did the job until recently... Now it can take up to 4 minutes...
1
by: Chris Lambacher | last post by:
Hi, This question has come up a few times on the list with no one giving a public answer. How do you use CreatePrintDialog from win32ui? About a year ago someone posted that: dlg =...
8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
0
by: Joey C. | last post by:
Hello. I'm writing a program that creates a series of batch operations to convert movies to be used on iPodLinux. The programs that do the encoding and conversions are seperate from mine and all...
3
by: robert | last post by:
As soon as I install wxPython on a Py2.3.5, my win32ui / win32gui apps freak out. buttons in dialogs are magically pressed. backgrounds of dialogs are colored wrong... this is with current...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.