Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How do I write a little script file that will change a value in some source then compile the source for me?

I'm using CFDG (context free art), and have to write the code for each frame, saving each picture with a consecutive filename...is there any way I could write a small script that will:

change one value in the source by increment of 0.1

compile source into an appropriately-named consecutive .png file (this is usually done from the command line. The command I'll use for the first frame is:

cfdg source.cfdg -o 001.png

The file source.cfdg is where I want to change the variable, and the 001.png should be going up by one for each change.

I greatly appreciate any help in this

Update:

Thank you adaviel!

That snippet of code Looks like it might be useful, I don't suppose you know where I could find a more in-depth description of how to tweak that sort of code to my needs?

2 Answers

Relevance
  • 10 years ago
    Favorite Answer

    you could write a loop in bash to increment the filename, and use sed or awk to modify the source.

    Or using a scripting language like Perl or Python to modify or create the source on the fly andcall cfdg

    something like

    for ($i=1;$i<50;$i++) {

    $I = sprintf("%3.3d",$i) ;

    open (OUT,">source.cdfg") or die ;

    print OUT<<EOT;

    blah

    blah $i foo

    blah

    EOT

    close(OUT) ;

    system("cfdg source.cfdg -o $I.png")

    }

    so you basically create source.cfg using computed values, constants etc. then call cfdg to compile it each time

    Source(s): do that kind of thing a lot
  • reny
    Lv 4
    5 years ago

    for the reason that there's no enter contained in this methodology this methodology purely outputs "hi worldwide!" and exits this methodology . you have 2 techniques of seeing the output a million. contain conio code #include79abd8cf35895c56cc4d955c5355dbe #include4a937338bba85f4ad274b24c2ae465e int substantial() { cout<<"hi worldwide!"; getch(); return 0; } the above code will watch for a character till now it exits this methodology and exits as aoon as you press any key. 2. you additionally can see the output straight away . After executing this methodology goto report then click dos shell this could open a dos cmd with the output form go out to go out the dos shell

Still have questions? Get your answers by asking now.