|
-
July 18th, 2006, 09:15 PM
#1
Automatic Naming
Hello guys, I'm creating a screenshot utility program which obviously takes screenshots. Anyways, I wanted to integrate a feature where one would specify a prefix, and then a number would be appended. For example, if my prefix were screen, and it was the third screen shot I took, it'd save the file as screen03, or something similar, I believe you get the point.
Anyways, I already know how to save and what not, I was just wondering if you guys had an idea as to how I'd accomplish this. I was thinking about doing some type of FileExists method (Is there one already?), and then I'd check if the first shot existed, if it did, then iterate through until the last one didn't exist, then I'd save it as that. I don't know if you guys understand my approach here, if you don't it's okay, but if you do, I'd be greatful to hear your comments.
Here's a rough, 'pseudo-code' visualization:
Code:
string file = "pic";
int num = 1;
while (true)
{
if (FileExists((file + num.ToString()) == true)
{
savefileas(file + num.ToString());
break;
}
}
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
|