OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Macro and python

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Satsuki
General User
General User


Joined: 28 Oct 2009
Posts: 11

PostPosted: Wed Oct 28, 2009 3:52 pm    Post subject: Macro and python Reply with quote

I have a macro and I need linker with external python code. ¿It is possible?
Back to top
View user's profile Send private message
QuazzieEvil
Super User
Super User


Joined: 17 Jan 2007
Posts: 599
Location: Houston, TX

PostPosted: Thu Oct 29, 2009 4:54 am    Post subject: Reply with quote

does the code have anything to do with python/pyUNO? or just good ol' python?

If just a regular python module you are trying to execute, you can use the Shell(...) command to execute it (assumption is that you are using OOo Basic).

example:



Code:

python="C:\Python23\python.exe" 'SOME PYTHON LOCATION
myMod="some_mod.py"
cmd=python & " " & myMod
Shell(cmd)


_________________
Free Docs @ http://www.baseprogramming.com/resources.html
Book @ lulu.com http://www.lulu.com/content/2455551
Back to top
View user's profile Send private message Visit poster's website
Satsuki
General User
General User


Joined: 28 Oct 2009
Posts: 11

PostPosted: Thu Oct 29, 2009 11:34 am    Post subject: Reply with quote

The code doesn't haven anything to do with python/pyUNO

I created a client and server in python. A server receive a parameter, make a consult to google research and retrieve the result to client.
Now, I have send info from openoffice to server. The problem is make socket in openoffice, so I think program anythings using OOo basic and then send a parameter to python client (client.py isn't part of openoffice).

¿Can I do this?

I program in Ubuntu.
Thanks
Back to top
View user's profile Send private message
Satsuki
General User
General User


Joined: 28 Oct 2009
Posts: 11

PostPosted: Tue Nov 03, 2009 8:16 am    Post subject: Reply with quote

¿And the code to Ubuntu?
Back to top
View user's profile Send private message
dickkniep
General User
General User


Joined: 01 Mar 2004
Posts: 29

PostPosted: Wed Nov 04, 2009 3:09 am    Post subject: Pyuno under Ubuntu Reply with quote

This is quite easy. The good guys of Ubuntu have compiled python against the same libs as OO. Consequently you can just use the system Python in you pyuno code.

So if you want to execute an external python module, just import the module and execute as you are used to do
Back to top
View user's profile Send private message Visit poster's website
Satsuki
General User
General User


Joined: 28 Oct 2009
Posts: 11

PostPosted: Thu Nov 05, 2009 2:41 pm    Post subject: Reply with quote

¿Any example to import the module and execute?
I use macro basic and module or script python.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group