Re: export sites/pages to PDF

2008-08-12 Thread jvdb
Hi Stef!

Thanks for your answer, but i forgot to mention that i have to run
this on unix/linux.


On Aug 12, 9:06 pm, Stef Mientki <[EMAIL PROTECTED]> wrote:
> jvdb wrote:
> > Hi all,
>
> > My employer is asking for a solution that outputs the content of urls
> > to pdf. It must be the content as seen within the browser.
> > Can someone help me on this? It must be able to export several kind of
> > pages with all kind of content (javascript, etc.)
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> pdfCreator does the job.
>
> cheers,
> Stef

--
http://mail.python.org/mailman/listinfo/python-list


export sites/pages to PDF

2008-08-12 Thread jvdb
Hi all,

My employer is asking for a solution that outputs the content of urls
to pdf. It must be the content as seen within the browser.
Can someone help me on this? It must be able to export several kind of
pages with all kind of content (javascript, etc.)
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to hide a program?

2007-06-21 Thread jvdb
Hi all,

thanks very much! it was indeed how i compiled to .exe
After using the windows= , my issue was solved. Thanks to all who took
the time on helping me.

Jeroen

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to hide a program?

2007-06-20 Thread jvdb
On 20 jun, 17:05, Larry Bates <[EMAIL PROTECTED]> wrote:
> jvdb wrote:
> > Hi all,
>
> > I've created a program that receives files and opens the corresponding
> > program (for example adobe acrobat). However, when started, i would
> > like to see nothing of the running program. I only want to see the
> > program that will be opened.
> > Is it possible to start a program 'hidden' or minimized to at least
> > the system tray? And, if yes., could some one help me on this?
>
> > Thanks already!
>
> > Jeroen
>
> You can do this with:
>
> import win32process
>
> STARTUPINFO=win32process.STARTUPINFO()
> STARTUPINFO.dwX=0
> STARTUPINFO.dwY=0
> STARTUPINFO.dwXSize=800
> STARTUPINFO.dwYSize=600
> execute_target="enter program to run here"
> commandLine=None
> processAttributes=None
> threadAttributes=None
> bInheritHandles=0
> dwCreationFlags=0
> currentDirectory=None
> #
> # Start the program
> #
> win32process.CreateProcess(execute_target,
>commandLine,
>processAttributes,
>threadAttributes,
>bInheritHandles,
>dwCreationFlags,
>newEnvironment,
>currentDirectory,
>STARTUPINFO)
>
> -Larry Bates

Hi Larry,

The thing is, i don't want to see anything of my program, just the
launched program.
I already have the program working. But when i create an executable of
it with py2exe and start it, i don't want to see that it is running,
perhaps just in the systemtray. That is my problem.

thanks!
Jeroen

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to hide a program?

2007-06-20 Thread jvdb
On 20 jun, 15:59, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> jvdb wrote:
> > Hi all,
>
> > I've created a program that receives files and opens the corresponding
> > program (for example adobe acrobat). However, when started, i would
> > like to see nothing of the running program. I only want to see the
> > program that will be opened.
> > Is it possible to start a program 'hidden' or minimized to at least
> > the system tray? And, if yes., could some one help me on this?
>
> I'm not exactly sure what you  mean here, but I guess you want the
> command-window suppressed. You can do so by naming your scripts *.pyw,
> which will invoke pythonw.exe instead. That has no command-window.
>
> Diez

Hi Diez,

I forgot to mention that i have created a Windows executable of the
script.
What i want is to run the application minimized in the system tray or
totally hidden.

regards,
Jeroen

-- 
http://mail.python.org/mailman/listinfo/python-list


How to hide a program?

2007-06-20 Thread jvdb
Hi all,

I've created a program that receives files and opens the corresponding
program (for example adobe acrobat). However, when started, i would
like to see nothing of the running program. I only want to see the
program that will be opened.
Is it possible to start a program 'hidden' or minimized to at least
the system tray? And, if yes., could some one help me on this?

Thanks already!

Jeroen

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to do reading of binary files?

2007-06-08 Thread jvdb
On 8 jun, 15:19, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> In <[EMAIL PROTECTED]>, Diez B. Roggisch wrote:
>
>
>
> > jvdb schrieb:
> >> True. But there is another issue attached to the one i wrote.
> >> When i know how much this occurs, i know the amount of pages in the
> >> file. After that i would like to be able to extract a given amount of
> >> data:
> >> file x contains 20 <0C>. then for example i would like to extract from
> >> instance 5 to instance 12 from the file.
> >> The reason why i want to do this: The 0C stands for a pagebreak in PCL
> >> language. This way i would be absle to extract a certain amount of
> >> pages from the file.
>
> > And? Finding the respective indices by using
>
> > last_needle_position = 0
> > positions = []
> > while last_needle_position != -1:
> >  last_needle_position = contents.find(needle, last_needle_position+1)
> >  if last_needle_position != -1:
> >  positions.append(last_needle_position)
>
> > will find all the pagepbreaks. then just slice contents appropriatly.
> > Did you read the python tutorial?
>
> Maybe splitting at '\x0c', selecting/slicing the wanted pages and joining
> them again is enough, depending of the size of the files and memory of
> course.
>
> One problem I see is that '\x0c' may not always be the page end.  It may
> occur in "rastered image" data too I guess.
>
> Ciao,
> Marc 'BlackJack' Rintsch

Hi,

your last comment is also something i have noticed. There are a number
of occasions where this will happen. I also have to deal with this.
I will dive into this on monday, after this hot weekend.

cheers,
Jeroen

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to do reading of binary files?

2007-06-08 Thread jvdb
On 8 jun, 14:07, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> jvdb schrieb:
..
> What has the searching to do with the reading? 10MB easily fit into the
> main memory of a decent PC, so just do
>
> contents = open("file").read() # yes I know I should close the file...
>
> print contents.find('\x0c')
>
> Diez

True. But there is another issue attached to the one i wrote.
When i know how much this occurs, i know the amount of pages in the
file. After that i would like to be able to extract a given amount of
data:
file x contains 20 <0C>. then for example i would like to extract from
instance 5 to instance 12 from the file.
The reason why i want to do this: The 0C stands for a pagebreak in PCL
language. This way i would be absle to extract a certain amount of
pages from the file.



-- 
http://mail.python.org/mailman/listinfo/python-list


how to do reading of binary files?

2007-06-08 Thread jvdb
Hi all,

I need some help on the following issue. I can't seem to solve it.

I have a binary (pcl) file.
In this file i want to search for specific codes (like <0C>). I have
tried to solve it by reading the file character by character, but this
is very slow. Especially when it comes to files which are large
(>10MB) this is consuming quite some time.
Does anyone has a hint/clue/solution on this?

thanks already!

Jeroen

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help needed on config files

2007-01-31 Thread jvdb
Ok, with all your help and very useful hints, i managed to solve it!
thanks!
Now my program loops through the config file, and deletes the files
older than 7 days with a specified extension.
Here's my program:
#this project removes old log files

import os, time
from ConfigParser import ConfigParser
now=time.time()

cfg = ConfigParser()
cfg.read("projects.cfg")

#loop through the config file
for proj in cfg.sections():
print ""
#get the path where file files should be
path = cfg.items(proj)[1][1]
#get the filetype
ftype = cfg.items(proj)[0][1]
print "project: %s, path to old logfiles: %s" % (proj, path)
dirList=os.listdir(path)
# Now check if the file is not a dir and then check if the file is
older than 7 days
for fname in dirList:
if fname.endswith(ftype):
pad = path+"\\"+fname
if os.stat(pad).st_mtime < now - 7 * 86400:
if os.path.isfile(pad):
os.remove(pad)
print "The file %s is deleted" % (fname)



===
#projects.cfg
[ebiz_factuur]
dir=c:\customer\ebiz_factuur
type=.log
[test]
dir=c:\temp
type=.txt

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help needed on config files

2007-01-31 Thread jvdb
Yes! That does the trick, thanks, both of you!

-- 
http://mail.python.org/mailman/listinfo/python-list


Help needed on config files

2007-01-31 Thread jvdb
Hi there,

I am quite new on python programming and need some help on solving my
problem..

I have to make a (python) program which deletes files from
directories. I don't think deleting, etc. is the problem. The problem
is that the directories where i have to delete them are 'dynamic'/
subject to change. So what i thought is to make a config file
containing an identifier (useful for myself) and there the directory.
something like:
[PROJECTx]

[PROJECTy]


I have already seen that there are sorts of modules where you can read
a config file, but only when you know the key.. Can someone help me
out on this? The configfile can be altered in time (as there are more
projects coming where i have to delete files on a scheduled basis).

This is a good learning project for me, but i really don't see how to
solve this.

-- 
http://mail.python.org/mailman/listinfo/python-list