<html><head></head><body><div class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div dir="ltr" data-setdir="false">hello,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">i'm writing a hopefully simple script that I can point at a folder of jpegs, and have it make a page per pic with an image frame on it, with one of the jpegs in.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">this is what I've got so far:<br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">------------------------------<br></div><div dir="ltr" data-setdir="false"><div dir="ltr" data-setdir="false">
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';">import os</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';">import glob</span></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monospace';"><br></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monospace';"><br></p>
<div style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';">os.chdir('/imagefolder')</span></div><br><div style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';">os.scandir('<span><span style=" font-family:'Monospace';">/imagefolder</span></span>')</span></div>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monospace';"><br></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Monospace';"><br></p> <div>pics = glob.glob('*.jpg')<br><br>for p in pics:<br></div><div><span style=" font-family:'Monospace';">newPage(1)</span></div>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';"> createImage(0, 0, 90,90,["pic{picname}".format(picname = p)])</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';"> </span></p></div><div><br></div></div><div dir="ltr" data-setdir="false">-----------------<br></div><div dir="ltr" data-setdir="false">at the moment it doesn't seem to work as I was expecting in scribus, I adapted it for general python, the string formatting does what i'd expected (appends "pic" onto the filename, I was planning to name the imageframes like this):<br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">-----------<br></div><div dir="ltr" data-setdir="false"><div dir="ltr" data-setdir="false">import os<br>import glob<br><br><br><div>os.chdir(' <span>/imagefolder'</span>)</div><br><div dir="ltr" data-setdir="false">os.scandir('/imagefolder')</div><br><br>pics = glob.glob('*.jpg')<br><br>for p in pics:<br> print(p) <br> print("pic{picname}".format(picname = p))</div><div>---------------------</div><div><br></div><div><br></div><div dir="ltr" data-setdir="false">the bit where I create new pages also only works under certain circumstances<br></div><div><br></div><div dir="ltr" data-setdir="false"><div><br>for p in pics:<br><div><span style=" font-family:'Monospace';">newPage(1)</span></div></div><div><br></div></div><div dir="ltr" data-setdir="false">sometimes it makes 19 new pages, other times it makes 1, other times it doesn't make any, it doesn't work at all when I use my createImage line, but I did manage to create one image frame when I gave it a hardcoded name<br></div><div><br></div><div dir="ltr" data-setdir="false"><div><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';"> createImage(0, 0, 90,90,["pic{picname}".format(picname = p)])</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';"> </span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><span style=" font-family:'Monospace';"> </span></p><div><br><div><br></div><div dir="ltr" data-setdir="false">any ideas? I was planning to follow this with a loadImage<br></div></div></div><div><br></div><div dir="ltr" data-setdir="false">this is in 1.5.6.1<br></div><div><br></div><div dir="ltr" data-setdir="false">cheers :)<br></div></div></div></div></body></html>