|
-
December 28th, 2009, 11:05 PM
#2
Re: I need some ideas for an algorithym
Renaming all the pages in a book seems to be a bit tedious to me. I would suggest that you pull up 2 images, and then ask where the "Middle" is in a text box. You can display the images in 2 picture boxes. And the 2 images would be displayed just for verification. So lets say your book has 10 pages. You would display pages 5 and 6, just so you can see which one you want to stop the first set of renaming. You put 5 in the textbox, then rename image01 through image05 as page1, page3, page 5, page7, page9. Then starting at 6, page 2, page4, page6, page8, page10.
Lastly, put a TextBox on the screen for the last image number (textbox2).
To rename the files, I think you can do.
Name "c:\images\image01.jpg" As "c:\images\page01.jpg"
You will need 2 loops.
Code:
For I = 1 to cint(textbox1.text)
InFileName = "C:\images\image" + format(I,"00") + ".jpg"
OutFileName = "C:\images\page" + format((I - 1) * 2 + 1,"00") + ".jpg"
Name InFileName As OutFileName
Next I
Now rename 6-10
Code:
Start = CINT(textbox1.text) + 1 ' 5 + 1
For I = Start to cint(textbox2.text)
InFileName = "C:\images\image" + format(I,"00") + ".jpg"
OutFileName = "C:\images\page" + format((I - Start) * 2 + 2,"00") + ".jpg"
Name InFileName As OutFileName
Next I
I Just wrote the code here and have not tested any but I think it should work.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|