473,769 Members | 7,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open a file with default handler app?

Hi, I searched for this on google and in this group, but my awesome
google-fu powers failed me. Is there a way to open any file using
default program that'd open it? In other words, to do the same action
as double-clicking in windows explorer? And secondly, is there a way
to do the same thing for linux that'd work across all desktop
environments and distributions, or at least in all major ones? What
I'm trying to do here is to have records (or items) in my app where
you could attach any kind of file and open it from there by clicking
'open'. Then it would go and do something like os.system("laun ch %s" %
filename). So any way to do this except for keeping your own
dictionary of file types and relevant apps? thx, -ak
Mar 12 '08 #1
2 2426
On Mar 11, 9:24*pm, andrei....@gmai l.com wrote:
Hi, I searched for this on google and in this group, but my awesome
google-fu powers failed me. Is there a way to open any file using
default program that'd open it? In other words, to do the same action
as double-clicking in windows explorer? And secondly, is there a way
to do the same thing for linux that'd work across all desktop
environments and distributions, or at least in all major ones? What
I'm trying to do here is to have records (or items) in my app where
you could attach any kind of file and open it from there by clicking
'open'. Then it would go and do something like os.system("laun ch %s" %
filename). So any way to do this except for keeping your own
dictionary of file types and relevant apps? thx, -ak
Hey there,
I've had to do the same things for a program that I'm writing. The
following command should do the trick:

os.startfile("y ourfilehere")

from the os module. Hope this helps!
Mar 12 '08 #2
On Mar 11, 11:50*pm, Wubbul...@gmail .com wrote:
>
Hey there,
I've had to do the same things for a program that I'm writing. The
following command should do the trick:

os.startfile("y ourfilehere")

from the os module. Hope this helps!
That's perfect, thanks a ton++!
Mar 13 '08 #3

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

Similar topics

29
5026
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the window properly but does not pass the parameter. (this is part of a coldfusion template) <a href="##"
2
4100
by: Julia Baresch | last post by:
Hi everyone, As some of you may know, we've been having trouble with an unrecognized database format error. Today I installed an unfinished project on the workstation of one of my users. It's a query by form in which she enters the criteria of the record she wants in an unbound form, and it pulls only that record and switches to the entry form so she can enter data. I had noticed it was faster than find or filter, so I offered it to...
2
9844
by: JM | last post by:
Hi I have been trying to open Excel 2003 but I am having rotten luck. Just can't see to get it working. I looked at this article... http://www.codeproject.com/csharp/csharp_excel.asp?print=true Anyone have any ideas?
6
2404
by: Shimon Sim | last post by:
Hi 1) Is it possible to force browser to open image in default windows application? That is what specifies in Folder Options for jpg extension. 2) Also if the 1) is possible is it possible to send few jpg files at the same time. The problem that I am facing is that the client needs to print some files that are saved on the server. Usually before printing user needs to resize them. It would be the best if image opens right away in the...
18
3349
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to the image. The desired behavior is that when the pop-up is invoked, I want the underlying window to stay put. I don't have this problem when I run the code on my local computer but I do have it when I run the code on geocities.
1
6509
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
1
1862
by: Arno R | last post by:
Hi all, I asked the same question two days ago. Only answer (from Lyle) was a CDO-workaround. I Googled and Googled for answers and I see again that I am not the only one struggling with this issue. Lots of hits yes, but lots and lots of these questions with no answer at all... One 'final' solution is about deleting a regkey, that also in my case does not exist... Question again: While trying to send mail from Access a client sees the...
3
2546
by: LordHog | last post by:
Hello, How would I go about finding the default handler, let's say a text file (*.txt), then launch the default handler with the file as an argument? I had found how to launch an external program, but I do not know how I would find the default handler to a file type. Any help is greatly appreciated. Code to launch application: ProcessStartInfo pInfo = new ProcessStartInfo();
2
12731
by: LayneMitch via WebmasterKB.com | last post by:
Hello. I posted this earlier with the full code of the JavaScript file I'm trying to open. I'm posting this again, because the file is not the problem. I seem to be having a 'windows' problem w/ Window Script Host. While this is more of a computer support based problem, I was hoping that someone had any knowledge on how to resolve this situation. The error message I'm getting is:
0
9589
marktang
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...
0
9423
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,...
0
10216
Oralloy
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...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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 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...
1
7413
isladogs
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...
0
6675
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();...
1
3965
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
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.