Forum Moderators: Lobo3433, Staff Forum Coordinators: Anim8dtoon
Poser Python Scripting F.A.Q (Last Updated: 2026 Mar 27 4:38 pm)
Thanks gishzida,
That problem solved ! .... I found out my IP Address via ipconfig and subbed it into the UDPServer script.
I've now got a little console that pops up and allows me to run PRPC and then go off and run something else. Problem now is that I can't get any of the python windows to sit on top of the Poser window, which means that I have to minimize the Poser window each time.
The other thing is that I tried firing up PPMaster.py, but this didn't seem to do anything.
So, by and large, I'm still in the dark with regards to these tools.
Any further help / clarification / enlightenment appreciated.
regards,
Andrew
Phil, thanks, that's nifty but doesn't quite suit me.
Its a bit quicker using P3DO Explorer, because while (say) M4 character is loading up, I can go and look for (say) the M4 morph injections. Furthermore, the P3DO Explorer interface lends itself better for me to go to the next file to load up.
With your script, however, I have to wait for M4 to load up before loading up the next file.
So, if I can use ADP's script to get around the P7 problem of only being able to run one python script at a time, then I'll be set up well :)
regards,
Andrew
Mathman, note that there's a workaround to the inability to run Python scripts while Prcp is running in P3dO itself.
In P3dO Tools meny you should have a "Run Pyhton Script..." command.
It is easy enough to use since it will default to the latest opened Python script directory.
As Dizzi said starting Prpc automatically would be the solution, I intend to work on this as soon as P3dO 2.2 is out.
Also if there's a Port address collision while using Prpc, you may modify the default Port used by P3dO in Option dialog (plugins tab). But you have to modify the Prpc script manually to reflect that change. P-mail me if you need any assistance for this.
Yarp
www.senosoft.com
Yarp - author of P3DO Organizer for Poser
Thanks, yarp. I didn't know you could do this. In the event of a port address conflict, what would you change it to ?
Dizzi - I have been trying to avoid the scenario of closing prpc, obviously it becomes annoying to close it and re-open it every time I wanted to run another python script. Also, I don't know what you mean when you say "hotkey the prpc script" ??
Actually, it works without hotkeying, too. Doing it for a few years already:
Copy PRPC-Link to clipboard (so less chance of really ugly things happening if another application steals focus), focus Poser Window, Sendkeys.
But hotkeys make it of course easier (no clipboard action needed).
For those interested (delays from various user tests):
With hotkeys:
SetForegroundWindow(poserHandle);
System.Threading.Thread.Sleep(100);
SendKeys.SendWait(shortcutcode);
Without hotkeys:
Clipboard.SetText(filename);
SendKeys.Flush();
SetForegroundWindow(poserHandle);
System.Threading.Thread.Sleep(100);
SendKeys.SendWait("%f{UP}{UP}{UP}{UP}{UP}{UP}{ENTER}"); //ALT+f, LEFT ARROW, DOWN ARROW
SendKeys.Flush();
System.Threading.Thread.Sleep(500); //another delay need for VISTA
SendKeys.Flush();
SendKeys.SendWait("^v{ENTER}");
Thanks for the code I will give it a try this morning.
The hotkey stuff is only working with P7 (there was no script menu in P6).
I was aware of the technic you describe above, but I hadn't give it a try. I was looking for an internal solution by trying to communicate directly with Poser Python dll.
But I have done nothing so far, so I should better stop thinking about reinventing the wheel.
Just a suggestion, you could replace the first sleep with a while loop. Something like:
nTicksOld = GetTickCount();
do {
if (GetForeGroundWindow()==poserHandle)
break;
nTicks = GetTickCount();
} while (nTicks-nTicksOld<100);
But Vista is a real pain and the only solution for the other sleep is to get rid of it ;)
Yarp - author of P3DO Organizer for Poser
mathman, I will p-mail it to you. After all, this is thank to you that I gave it a look.
Overflow ? Thanks didn't knew that. One should carrefuly read the Msdn for each and every function and I've been using that one rather intensively. Clear now.
Frankly, I don't like to use Sleep because I've got the feeling I'm wasting the CPU. I agree that Sleeping 100 miliseconds is not a big deal It's just me.
So the code is safe like this and waiting up to 1s (in case the system hangs):
DWORD dwTicksOld = GetTickCount();
DWORD dwTicks;
do {
if (GetForeGroundWindow()==poserHandle)
break;
dwTicks = GetTickCount();
} while (dwTicks>dwTicksOld && dwTicks-dwTicksOld<1000)
Yarp - author of P3DO Organizer for Poser
You're right, a 1ms Sleep is a good thing. btw There was a bug because of this (should have been dwTicks>=dwTicksOld instead of dwTicks>dwTicksOld).
Actually, the call to GetForeGroundWindow has a cost too, so the Loop iterate only about 20 times in 100ms on my Vista computer.
Yarp - author of P3DO Organizer for Poser
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Hi all,
I have visited ADP's website, and noticed a pair of Python scripts packaged together. They are UDPServer and PPMaster.
If I understand the description correctly, these look like the answer to my prayers. I use PRPC in Poser 7 so that I can load up my characters, poses, lights etc from P3DO Explorer (mainly because I absolutely DESPISE the Poser Library with a passion). I've become used to this, and find this arrangement to be quite comfortable.
The drawback of this is that I can't run any other python script as long as this one is running.
This setup (UDPServer) looks as if it could possibly fix this problem, however I have read the description on ADP's page and still don't know how to get this setup running correctly.
At the moment, when I run UDPServer.py from within Poser, I get the following error messages :
*Traceback (most recent call last):
File "C:Program Filese frontierPoser 7RuntimePythonposerScriptsScriptsMenuADPUDPserver.py", line 617, in ?
app=UDPApp(root,ip="192.168.0.198")
File "C:Program Filese frontierPoser 7RuntimePythonposerScriptsScriptsMenuADPUDPserver.py", line 462, in init
self.udp=poserUDP(IP=ip,portIn=portIn,portOut=portOut)
File "C:Program Filese frontierPoser 7RuntimePythonposerScriptsScriptsMenuADPUDPserver.py", line 87, in init
self.conIn.bind((self.IP,self.portIn))
File "", line 1, in bind
socket.error: (10049, "Can't assign requested address")
Any help appreciated (I need a bit of hand-holding here, as my Python know-how isn't too great).
Many thanks and regards,
Andrew