Forum: Poser Python Scripting


Subject: Using sockets or pipes to talk with external apps

tromnek opened this issue on Nov 27, 2004 ยท 9 posts


tromnek posted Sat, 27 November 2004 at 7:32 PM

I just wrote a little script to assist in the following. View my library folders with and external application (like P3dO Explorer) and copy the filenames to the system clipboard. Then I click on a button from my python script to load that library file in poser. Read the attached script for more details. It would be even better to create a socket in poser-python. Then had a dll that creates a 'send to' in windows right-click context menu, sending the pathname directly to the poser-python socket. Any thoughts/suggestions?

ockham posted Sun, 28 November 2004 at 2:24 PM

Nice piece of work! Sockets or pipes would be interesting. Even more interesting would be a direct route into Poser itself, to do the many actions that aren't available through the Python API. I think Hogsoft may have a partial solution to this...?

My python page
My ShareCG freebies


tromnek posted Mon, 29 November 2004 at 10:24 PM

The socket stuff turned out to be rather trivial. You will need to have the standard python interpeter installed to use my 'Send To' implementation. Read the attached script for more info.

bushi posted Tue, 30 November 2004 at 12:52 PM

That looks pretty cool. I've never tried using sockets in Python but I'll file this one away for future reference. Just as an aside, if you have any problems with your timer call-back running smoothly, you might want to change this: scene.ProcessSomeEvents(1) to this: scene.ProcessSomeEvents() It isn't documented anywhere but the event processor will apparently service all queued events if it is called without a specific number passed. I've used this in most of my scripts and it really helps to keep them from hanging.


hogwarden posted Wed, 01 December 2004 at 6:53 AM

Partial indeed... P4PyE doesn't get right into the guts of Poser unfortunately. This is clever stuff! And nearly cross platform, too... all except the clipboard. I don't really understand how your send-to thing works... I don't have the Python interpreter installed. (which will be the case with most folks:) Doesn't the script also have to be running, too? There's a better (ed. another!) way to get the "send-to" working, and gets the line into the main explorer right-click menu not in the "send-to" part, too. Add a registry key (not sure if this can be done through Python) "HKEY_CLASSES_ROOT/cr2/shell/Open file in Poser" Then add another one "HKEY_CLASSES_ROOT/cr2/shell/Open file in Poser/command". To this one, add a path and args to this key to launch a stub app which comminicates the request to the Python script through the socket then closes. Of course, an entry will have to be added for each Poser file type. If the stub app is writen in C or Delphi or is compiled to run without the Python standalone then all the better. H:))


tromnek posted Wed, 01 December 2004 at 11:09 PM

Attached Link: http://www.mort.net/users/krm/dist/poser/SockBridge02.zip

Bushi, thanks for the tip, I'll experiment. Hogwarden, I found a utility that will load the python dll that ships with poser 5 so you don't need the full python package. See the url for a zip archive to implement this. I think think that having the stub written in python is better than C or Delphi because then people can alter the python code for the stub and the app with the stock poser installation. I did make file associations (Explorer->Tools->FolderOptions->FileTypes) for some of the extensions, however P3dO Explorer sends all associated files (.png, pz2 and rsr) when you 'open'. My main purpose is to use P3dO in the (un)split associates mode. thanks all. please report any difficulties, edits or suggestions. ken

PhilC posted Sat, 04 December 2004 at 11:04 PM

Neat stuff. Thank you for posting.

philc_agatha_white_on_black.jpg


an0malaus posted Sun, 16 January 2005 at 12:27 AM

[watch and learn]



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


tromnek posted Sat, 22 January 2005 at 1:15 PM

Attached Link: http://www.renderosity.com/messages.ez?ForumID=12390&Form.ShowMessage=2088638

I've moved forward on this idea. Just posted a new thread here, looking for more feedback. You folks are great. Thanks for the help.