gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] write documents


From: Sebastian Hilbert
Subject: Re: [Gnumed-devel] write documents
Date: Mon, 25 Apr 2011 22:14:53 +0200
User-agent: KMail/1.13.6 (Linux/2.6.38.2-19-default; KDE/4.6.0; i686; ; )

Am Donnerstag, 21. April 2011, 16:21:08 schrieben Sie:
> On Wed, Apr 20, 2011 at 07:34:22PM +0200, Hilbert, Sebastian wrote:
> > I will work on gm-print_doc.bat and PrintFile.exe tonight and see what I
> > can come up with. My guess is that since gm-print_doc.sh is called and
> > that fails it bails out before it gets to the point where it imports the
> > pdf into gnumed
> 
> While that's not quite the problem this perhaps would be a
> problem if it came that far.
> 
> I just discovered this in the Python docs:
> 
> os.startfile(path[, operation])¶    Start a file with its
> associated application.    When operation is not specified
> or 'open', this acts like double-clicking the file in
> Windows Explorer, or giving the file name as an argument to
> the start command    from the interactive command shell: the
> file is opened with whatever application (if any) its
> extension is associated.    When another operation is given,
> it must be a “command verb” that specifies what should
> be done with the file. Common verbs documented by Microsoft
> are 'print' and    'edit' (to be used on files) as well as
> 'explore' and 'find' (to be used on directories).
> startfile() returns as soon as the associated application is
> launched. There is no option to wait for the application to
> close, and no way to retrieve the    application’s exit
> status. The path parameter is relative to the current
> directory. If you want to use an absolute path, make sure
> the first character is not a slash    ('/'); the underlying
> Win32 ShellExecute() function doesn’t work if it is. Use
> the os.path.normpath() function to ensure that the path is
> properly encoded for Win32.    Availability: Windows.    New
> in version 2.0.   New in version 2.5: The operation parameter.
> 
> Given that it should be possible to create a small Python
> application "print.py" like this:
> 
>       import os
>       import os.path
> 
>       the_file = os.path.normpath(the_file)
>       try:
>               os.startfile(the_file, 'print')
>       except AttributeError:
>               print "not on Windows"
> 
> which supposedly would invoke the application Windows is
> configured to print a certain file type with.
> 
> Please test this and report back. If that works I'll include
> the above with GNUmed directly.


It does open the associated application and tries to print the file. So this 
is one way to do it. 

Still looking into PrintFile since it can watch for files appearing in a 
directory and print these.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]