POV-Ray : Newsgroups : povray.newusers : Shell-out to OS? Server Time
25 Dec 2024 13:36:04 EST (-0500)
  Shell-out to OS? (Message 1 to 10 of 10)  
From: How Camp
Subject: Shell-out to OS?
Date: 15 Oct 2002 15:01:53
Message: <3dac6621$1@news.povray.org>
This should be simple...

I have an INI file I'm using for my scene, and I've added the following two
lines:

Pre_Scene_Command=foobar
Pre_Scene_Return=F


However, while the other settings in the INI file are read, nothing seems to
happen with these two lines.  My naive understanding is that POV-Ray should
attempt to shell to the OS with the command listed in Pre-Scene_Command, and
when the program is finished, continue.

However, I can run the above two lines, exactly as they appear, and I do not
seem to generate an error message (as I would expect, since I have no
program named 'foobar').  It also won't start an existing executable if I
supply the proper name, instead.

So my question is two-fold:

1) What silly mistake is preventing me from understanding the proper use of
these keywords.
2) What is the syntax to include in the INI file that allows an executable
to run prior to parsing my scene?

- How


Post a reply to this message

From: hughes, b 
Subject: Re: Shell-out to OS?
Date: 15 Oct 2002 15:58:03
Message: <3dac734b@news.povray.org>
"How Camp" <kro### [at] hotmailcom> wrote in message
news:3dac6621$1@news.povray.org...
>
> Pre_Scene_Command=foobar
> Pre_Scene_Return=F
>
> However, while the other settings in the INI file are read, nothing seems
to
> happen with these two lines.
>
> So my question is two-fold:
>
> 1) What silly mistake is preventing me from understanding the proper use
of
> these keywords.
> 2) What is the syntax to include in the INI file that allows an executable
> to run prior to parsing my scene?

Check for paths. For example, you should be able to call up Windows
Notepad.exe but not a C:\Nowhere\Nopad.exe, so I think as long as there's a
valid path (and PATH variable is set) then it should work okay.

Been a long time since I used INI for that. To use DOS commands you have to
run the command-line interpreter, which might be either command.com or
cmd.com.

Pre_Scene_Return=F should signify to POV that if a shell-out program/action
fails that POV aborts also. You'd need to be sure that causes an error code
though or it wouldn't have an effect, I believe.


Post a reply to this message

From: hughes, b 
Subject: Re: Shell-out to OS?
Date: 15 Oct 2002 16:05:00
Message: <3dac74ec$1@news.povray.org>
Sorry, I meant cmd.exe not cmd.com... anyway, that's the idea. You ought to
be able to run things either in DOS or Windows. I don't know about the other
OS platforms.


Post a reply to this message

From: How Camp
Subject: Re: Shell-out to OS?
Date: 15 Oct 2002 16:12:00
Message: <3dac7690@news.povray.org>
"hughes, b." <omn### [at] charternet> wrote in message
news:3dac734b@news.povray.org...

> Check for paths. For example, you should be able to call up Windows
> Notepad.exe but not a C:\Nowhere\Nopad.exe, so I think as long as there's
a
> valid path (and PATH variable is set) then it should work okay.

Hmm.  So I tried the following INI setting (on win2k):

Pre_Scene_Command=c:\WINNT\system32\notepad.exe

I've also checked the I/O options to make sure that 'disable starting other
programs' is not checked.

Alas, notepad.exe is not started, as I would expect.

> Pre_Scene_Return=F should signify to POV that if a shell-out
program/action
> fails that POV aborts also. You'd need to be sure that causes an error
code
> though or it wouldn't have an effect, I believe.

Really?  So, the output from the shell program must somehow generate the
proper error code for POV to understand?  The manual talks about returning a
non-zero codes, but not what they should be (other than POV generating 0, 1,
or 2 itself).

- How


Post a reply to this message

From: Philippe Lhoste
Subject: Re: Shell-out to OS?
Date: 17 Oct 2002 09:18:51
Message: <Xns92AA9B8C8870EPhiLho@204.213.191.226>
"How Camp" <kro### [at] hotmailcom> wrote in
news:3dac7690@news.povray.org: 

> Hmm.  So I tried the following INI setting (on win2k):
> 
> Pre_Scene_Command=c:\WINNT\system32\notepad.exe
> 
> I've also checked the I/O options to make sure that 'disable starting
> other programs' is not checked.
> 
> Alas, notepad.exe is not started, as I would expect.

I tried on WinNT4 the following line:
Pre_Scene_Command=D:\Programmes\USons\MicroWav.exe 
D:\Programmes\USons\BELL.WAV

where MicroWav is a small program that play a wav file and exit.

I hear the sound before the scene rendering... So basically, it is working 
fine, you should check your settings, etc.

OK, to be sure, I also tried:
Pre_Scene_Command=D:\Programmes\USons\Tom's MIDI Player.exe 
D:\Programmes\USons\Addams Family.mid

where Tom's MIDI Player as a GUI. Same here, I didn't even had to put 
quotes around the path which has spaces...

I have put the first command as Post_Scene_Command and the second one as 
is, and it still works... Of course, you have to close the GUI before the 
rendering goes.

> Really?  So, the output from the shell program must somehow generate
> the proper error code for POV to understand?  The manual talks about
> returning a non-zero codes, but not what they should be (other than
> POV generating 0, 1, or 2 itself).

In Dos lingo, the error code is called errorlevel. That's a code returned 
(return n in main() or exit(n) elsewhere, or Windows API equivalent: 
ExitProcess(n)) by any well behaved program.

By tradition, or standards, 0 means OK, no problem, any other values mean 
there is a problem, the value usually carrying some information, depending 
on the program itself. No standard here.

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/


Post a reply to this message

From: Warp
Subject: Re: Shell-out to OS?
Date: 17 Oct 2002 10:50:53
Message: <3daece4d@news.povray.org>
Have you checked that the security permissions permit executing
pre/post-scene commands?

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: How Camp
Subject: Re: Shell-out to OS?
Date: 17 Oct 2002 16:05:32
Message: <3daf180c$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3daece4d@news.povray.org...
>   Have you checked that the security permissions permit executing
> pre/post-scene commands?
>
> --
> #macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb
M()}}
> N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
> N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  -
Warp -

Er, yes.  As explained in my last post:

>I've also checked the I/O options to make sure that 'disable starting other
>programs' is not checked.

>Alas, notepad.exe is not started, as I would expect.

It doesn't seem to make a difference.


Post a reply to this message

From: How Camp
Subject: Re: Shell-out to OS?
Date: 17 Oct 2002 16:21:27
Message: <3daf1bc7$1@news.povray.org>
"Philippe Lhoste" <Phi### [at] GMXnet> wrote in message
news:Xns### [at] 204213191226...
>
> I tried on WinNT4 the following line:
> Pre_Scene_Command=D:\Programmes\USons\MicroWav.exe
> D:\Programmes\USons\BELL.WAV
>
> I hear the sound before the scene rendering... So basically, it is working
> fine, you should check your settings, etc.
>

Hmm.  I must be doing something very silly.  I've tried this on a win2k
machine, and now on my win98 machine, neither of which seem to function.
Here's my exact .INI file:

---

[Shell Test]
Width=320
Height=240
Antialias=Off

 Pre_Scene_Command=c:\windows\notepad.exe
 Pre_Scene_Return=F

---

So, I select the .INI file (clicking on the INI button and 'set, but don't
render'), and render my scene.  The scene file consists of nothing more than
the basic scene template - and it immediately renders without attempting to
load notepad.exe.

At first, I figured I had forgotten to allow POV the proper permissions to
shell to an external program (just as Warp wondered).  I have 'no
restrictions' set in the 'options --> Script I/O Restrictions' menu, as well
as 'Permit read/write in current directory' checked.  The 'disable starting
other programs' is NOT checked.

...Are there other settings I may have overlooked?


> I have put the first command as Post_Scene_Command and the second one as
> is, and it still works... Of course, you have to close the GUI before the
> rendering goes.

And this is the behavior I had hoped for.  So, once I find my mistake, I'll
be a happy camper.  Sorry for the newbie trouble.

- How


Post a reply to this message

From: Philippe Lhoste
Subject: Re: Shell-out to OS?
Date: 18 Oct 2002 06:46:50
Message: <Xns92AB81C6AB144PhiLho@204.213.191.226>
"How Camp" <kro### [at] hotmailcom> wrote in
news:3daf1bc7$1@news.povray.org: 

> Hmm.  I must be doing something very silly.  I've tried this on a
> win2k machine, and now on my win98 machine, neither of which seem to
> function. Here's my exact .INI file:
> 
> ---
> 
> [Shell Test]
> Width=320
> Height=240
> Antialias=Off
> 
>  Pre_Scene_Command=c:\windows\notepad.exe
>  Pre_Scene_Return=F
> 
> ---

I see several problems (after trying out, I am not very familiar with 
these .ini files, but I am familiar with debugging processes :-)

Let's see...
1) When I use your .ini file as given (just replacing Notepad call), I get 
this error in the Messages pane:
Warning: Never found section '' in file 'E:\_PhiLho\Images\POV-
Ray\sources\LuaLogo.ini'.
Command Line Error: Problem with command line or INI file.
Returned from renderer with error status

So I removed the section [Shell Test] which obviously is not only 
necessary, but seems to be interfering... POV-Ray's .ini files are not 
exactly Windows' .ini files, as stated in the manual. See also example 
.ini files in the scenes\portfolio directory.

2) After removing this section, I got another error. Snipped from the 
messages:
...
Parsing Options
  Input file: OBJECT.POV (compatible to version 3.5)
...
POV-Ray is creating another process
  D:\Programmes\USons\MicroWav.exe D:\Programmes\USons\BELL.WAV

Possible Scene File Parser Initialization Error: Could not find file 
'OBJECT.POV'
Scene File Parser Initialization Error: Cannot open input file.

Returned from renderer with error status

Obviously, POV-Ray tries to render the default scene OBJECT.POV...
You must add a line like: Input_File_Name=<Your Scene>.pov 

After adding it, I heard the sound... Well, almost, I cheated...
I disabled the Pre_Scene_Return=F line.
If I put it back, the program is no longer executed. ?!? A bug?

Oooh, if I put the Return line *before* the Command one, it works!
A quick browse of the manual shows nothing on this behavior...

Oh, well, at least you should be able to do what you wanted now :-)

-- 
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/


Post a reply to this message

From: How Camp
Subject: Re: Shell-out to OS?
Date: 21 Oct 2002 13:03:29
Message: <3db43361$1@news.povray.org>
"Philippe Lhoste" <Phi### [at] GMXnet> wrote in message
news:Xns### [at] 204213191226...
>
> I see several problems (after trying out, I am not very familiar with
> these .ini files, but I am familiar with debugging processes :-)
>
> Let's see...
> 1) When I use your .ini file as given (just replacing Notepad call), I get
> this error in the Messages pane:
> Warning: Never found section '' in file 'E:\_PhiLho\Images\POV-
> Ray\sources\LuaLogo.ini'.
> Command Line Error: Problem with command line or INI file.
> Returned from renderer with error status
>
> So I removed the section [Shell Test] which obviously is not only
> necessary, but seems to be interfering... POV-Ray's .ini files are not
> exactly Windows' .ini files, as stated in the manual. See also example
> .ini files in the scenes\portfolio directory.
>

Hmm, I don't see any of these errors you're referring to.  I agree, the need
for [...] is not necessary, but sure makes life easier when you're doing
test renders at various qualities, etc.

Since this works in other INI files (without shelling), I don't think this
is the problem.

> 2) After removing this section, I got another error. Snipped from the
> messages:

> ...

>
> After adding it, I heard the sound... Well, almost, I cheated...
> I disabled the Pre_Scene_Return=F line.
> If I put it back, the program is no longer executed. ?!? A bug?
>
> Oooh, if I put the Return line *before* the Command one, it works!
> A quick browse of the manual shows nothing on this behavior...
>

This appears to be the problem.  I can use this INI file:

[TestIt]
Pre_Scene_Return=F
Pre_Scene_Command=notepad.exe


...But not this one:

[TestIt]
Pre_Scene_Command=notepad.exe
Pre_Scene_Return=F


Strange.  As you also pointed out, it doesn't appear in the docs anywhere.
But if you either leave out the Pre_Scene_Return line, or include it prior
to the Pre_Scene_Command line, things work fine.  You can even use the [...]
headers, too.

> Oh, well, at least you should be able to do what you wanted now :-)

Finally, yes.  Thanks for the help!

- How


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.