how can I launching external programs?

Discussion of Common Lisp

how can I launching external programs?

Postby Wolfgang Tsafack » Thu Nov 05, 2009 11:33 am

Hi,

First of all, I want to point out, that I am not a native englisch speaker. Please don't worry about my englisch. I am currently try to improve it.
I am now writing my bachleor thesis in computer sciences at the university of applied schiences of Trier/Germany. I am programming with Lisp on
Lispworks personnal edition 5.0.0.1. I recentliy have a big problem, so that it is no more possible continiuing work on the project. That's the reason
of my post here. I'll be very happy if somebody can help me solve the problem.

My problem:

I want to convert a lot of text-files (stored in a directory) into jpg-image-files. I recently discover that when opening a txt-file with the
IrfanView-programm, this is show like an image, so that the only thing I had to do, was to stored it with the extension .jpg.
So I want to write a lisp-code (one or many function(s)/...), that make this automaticaly: That mean ivoke a thing that can automaticaly launch the IrfanView-programm, read an stored file from it.

1. Open the directory
2. for each file:
2.1. open this file with IrfanView
2.2. stored it as an .jpg image

can anybody tell me how can I do that? or perhaps give me some usefull informations?

Thanks a lot for your answer
Wolfgang Tsafack
 
Posts: 12
Joined: Thu Nov 05, 2009 11:09 am

Re: how can I launching external programs?

Postby Ramarren » Sat Nov 07, 2009 2:00 am

Use convert command line utility from ImageMagick, calling it with system:call-system.
Ramarren
 
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland

Re: how can I launching external programs?

Postby Wolfgang Tsafack » Sat Nov 07, 2009 2:46 am

@Ramarren
Hello. I think ImageMagik is not a free software. I want to use IrfanView.
However I know how tu open the file with (sys:call-system '("i_view" "myFile.txt")), I hoppe it's correct.
But I don't know how to store it as jpg-image!!

Please have you got au code for me? or another helpful link?

Thanks for answer
Wolfgang Tsafack
 
Posts: 12
Joined: Thu Nov 05, 2009 11:09 am

Re: how can I launching external programs?

Postby Ramarren » Sat Nov 07, 2009 2:54 am

Wolfgang Tsafack wrote:Hello. I think ImageMagik is not a free software. I want to use IrfanView.


Um, what?

ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may freely use, copy, modify, and distribute. Its license is compatible with the GPL. It runs on all major operating systems.


It is right there on the home page.

For that matter:
IrfanView is a very fast, small, compact and innovative FREEWARE (for non-commercial use) graphic viewer for Windows 9x, ME, NT, 2000, XP, 2003 , 2008, Vista, Windows 7.


So it's exactly the other way around.
Ramarren
 
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland

Re: how can I launching external programs?

Postby Wolfgang Tsafack » Sat Nov 07, 2009 3:54 am

Thank you very much Rammaren,

I think I will use ImageMagick! I didn't know that. This software is not very used by us.

But what about the question to save it as jpg-image? after call call-system function?
I don't have any idea?

Thanks
Wolfgang Tsafack
 
Posts: 12
Joined: Thu Nov 05, 2009 11:09 am

Re: how can I launching external programs?

Postby Ramarren » Sat Nov 07, 2009 4:02 am

Wolfgang Tsafack wrote:But what about the question to save it as jpg-image? after call call-system function?
I don't have any idea?


As far as I can tell IrfanView is not designed to be externally scriptable, therefore it is not possible to do this with a programming language. That is why I recommended a command line utility, which can be just called with
Code: Select all
(system:call-system "convert txt:example-text-file example-text-file.jpg")


Do note that using jpg format for text rasterization is not a good idea due to compression artefacts. A png or even gif would be much better.
Ramarren
 
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland

Re: how can I launching external programs?

Postby Wolfgang Tsafack » Sat Nov 07, 2009 5:57 am

@Remarren

thanks a lot for your help. That is right with the jpg option! But for my work it is not more important. However I'll make it wiht gif extension.

I'll want to clear somme point in the calling of
(system:call-system "convert txt:example-text-file example-text-file.jpg"):

1. I suppose that the files have to be given with their hole Pfad: for example "C:/dir/subdir/file.txt"
2. txt:example-text-file means that the file is a txt file, how it's if my text-file allready have an .txt extension? Do I allways need to add text: before that file?
3. Must example-text-file.jpg have the same pathname like the first txt to be store in the same directory?

I know I ask a lot, but I need this informations.

thanks al lot again!!!
Wolfgang Tsafack
 
Posts: 12
Joined: Thu Nov 05, 2009 11:09 am

Re: how can I launching external programs?

Postby gugamilare » Sat Nov 07, 2009 9:19 am

Wolfgang Tsafack wrote:@Ramarren
Hello. I think ImageMagik is not a free software. I want to use IrfanView.


I think you are using the term "free" as in "free beer", because IrfanView (nor Lispworks) is not free (as in freedom) software.

Just to note, you are probably not allowed to sell or even distribute software compiled with Lispworks (someone correct me if I am wrong about "distribute"), though you can always distribute the source code and tell people to compile it themselves.
gugamilare
 
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil

Re: how can I launching external programs?

Postby Wolfgang Tsafack » Sat Nov 07, 2009 12:18 pm

@Ramarren

When try tu run this peace of code on Lispworks 5.0.1, I saw the shell fastly showing wiht a lot of thinks inside. But I didn't any image file on my computer.
I search the file Belege-txt/20060629-10-14-56.jpg, but not one. Where did the file was stored? I don't have any idea.
That was what I want to do, have the image file stored in the same directory wiht the text file.

Code: Select all
(sys:call-system "convert txt:D:/LispWorks/AA/Belege-txt/Belege-txt/20060629-10-14-56.txt
                  D:/LispWorks/AA/Belege-txt/Belege-txt/20060629-10-14-56.jpg")
Wolfgang Tsafack
 
Posts: 12
Joined: Thu Nov 05, 2009 11:09 am

Re: how can I launching external programs?

Postby sinnatagg » Sat Nov 07, 2009 12:21 pm

gugamilare wrote:Just to note, you are probably not allowed to sell or even distribute software compiled with Lispworks (someone correct me if I am wrong about "distribute"), though you can always distribute the source code and tell people to compile it themselves.


You're wrong. A Lispworks application or library built with the delivery runtime can be distributed with no additional runtime licensing.

http://www.lispworks.com/products/runtimes.html

Maybe you're thinking of Franz' Allegro CL ?

-a
sinnatagg
 
Posts: 28
Joined: Tue Apr 21, 2009 3:04 am

Next

Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 2 guests