473,508 Members | 2,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple loops. Please help. Desperate.

I have had this post up here when i was trying to figure out how to
make leading zeros and have been able to fudge that to work. I am now
have trouble getting the loop that makes the folders to start fresh
after the .jpg section of the move images code. this will be
essential to make the whole thing work. Please help. Even if you
just write out the solution. I am beggin. I am desperate. Please
help.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>File transfer</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>

<body>
<table width="75%" border="0">
<tr>
<td>
<script language='javascript'>

folder = window.prompt('starting folder','default');
picnumber = window.prompt('pictures taken?','default');
f2 = parseFloat(folder);
p2 = parseFloat(picnumber);
/*adds the amount of photos taken to the starting folder number to
ensure proper amount of folders are present and tells user what the
starting folder and end folders are*/

varAdd = f2+p2-1;
varImg = p2;
var9 = '000';
var99 = '00';
var999 = '0';
var9999 = '0000';
document.write('Starting folder is <b>',f2,'</b><br>');
document.write('Ending folder should be <b>' + varAdd +
'</b><br><br>');

/*Commands used to bring system to standard for file transfer*/

document.write('cd..<br>')
document.write('cd documents and settings\\christopher
neu\\desktop<br>')
document.write('mkdir transfer<br>')
document.write('cd transfer<br>')

/*copies files from smartmedia to transfer folder*/

document.write('copy d:\\dcim\\100_fuji\\*.jpg<br>')

/*calculates and writes proper amount of folders in the transfer
folder via the "mkdir" command to properly transfer files*/

for (count1=f2;count1<=varAdd;count1++)
if (count1 <=9)
document.write('mkdir',var9999 + count1 +'<br>');
else if (count1 <=99)
document.write('mkdir',var9 + count1 +'<br>');
else if (count1 <=999)
document.write('mkdir',var99 + count1 +'<br>');
else if (count1 <=9999)
document.write('mkdir',var999 + count1 +'<br>');
else
document.write('mkdir' + count1 +'<br>');
/*moves pictures into proper folders. This is where the problem is.
I need to put the count that produced the folders after .jpg and have
it start fresh and continue till the move images count is done.
Perhaps this can be done with a function but i can not figure it out.
I can not figure out functions at all actually. :)*/

for (count=1;count<=varImg;count++)
if (count <=9)
document.write('move dscf',var9 + count +'.jpg <br>');
else if (count <=99)
document.write('move dscf',var99 + count +'.jpg <br>');
else if (count <=999)
document.write('move dscf',var999 + count +'.jpg <br>');
else
document.write('move dscf' + count +'.jpg <br>');

</script>
</td>
</tr>
</table>
</body>
</html>
Jul 20 '05 #1
5 1769
"Tank" <is*******@yahoo.com> wrote in message
news:99**************************@posting.google.c om...
I have had this post up here when i was trying to figure out how to
make leading zeros and have been able to fudge that to work. I am now
have trouble getting the loop that makes the folders to start fresh
after the .jpg section of the move images code. this will be
essential to make the whole thing work. Please help. Even if you
just write out the solution. I am beggin. I am desperate. Please
help.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>File transfer</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>

<body>
<table width="75%" border="0">
<tr>
<td>
<script language='javascript'>

folder = window.prompt('starting folder','default');
picnumber = window.prompt('pictures taken?','default');
f2 = parseFloat(folder);
p2 = parseFloat(picnumber);
/*adds the amount of photos taken to the starting folder number to
ensure proper amount of folders are present and tells user what the
starting folder and end folders are*/

varAdd = f2+p2-1;
varImg = p2;
var9 = '000';
var99 = '00';
var999 = '0';
var9999 = '0000';
document.write('Starting folder is <b>',f2,'</b><br>');
document.write('Ending folder should be <b>' + varAdd +
'</b><br><br>');

/*Commands used to bring system to standard for file transfer*/

document.write('cd..<br>')
document.write('cd documents and settings\\christopher
neu\\desktop<br>')
document.write('mkdir transfer<br>')
document.write('cd transfer<br>')

/*copies files from smartmedia to transfer folder*/

document.write('copy d:\\dcim\\100_fuji\\*.jpg<br>')

/*calculates and writes proper amount of folders in the transfer
folder via the "mkdir" command to properly transfer files*/

for (count1=f2;count1<=varAdd;count1++)
if (count1 <=9)
document.write('mkdir',var9999 + count1 +'<br>');
else if (count1 <=99)
document.write('mkdir',var9 + count1 +'<br>');
else if (count1 <=999)
document.write('mkdir',var99 + count1 +'<br>');
else if (count1 <=9999)
document.write('mkdir',var999 + count1 +'<br>');
else
document.write('mkdir' + count1 +'<br>');
/*moves pictures into proper folders. This is where the problem is.
I need to put the count that produced the folders after .jpg and have
it start fresh and continue till the move images count is done.
Perhaps this can be done with a function but i can not figure it out.
I can not figure out functions at all actually. :)*/

for (count=1;count<=varImg;count++)
if (count <=9)
document.write('move dscf',var9 + count +'.jpg <br>');
else if (count <=99)
document.write('move dscf',var99 + count +'.jpg <br>');
else if (count <=999)
document.write('move dscf',var999 + count +'.jpg <br>');
else
document.write('move dscf' + count +'.jpg <br>');

</script>
</td>
</tr>
</table>
</body>
</html>


Running your code generates a page with:

Starting folder is 2
Ending folder should be 4

cd..
cd documents and settings\christopherneu\desktop
mkdir transfer
cd transfer
copy d:\dcim\100_fuji\*.jpg
mkdir00002
mkdir00003
mkdir00004
move dscf0001.jpg
move dscf0002.jpg
move dscf0003.jpg

Note that there is no space between "mkdir" and the "0000" prefix folders.
Also, you may want "cd\" instead of "cd..".
What are you trying to do?
Is it to create a batch file that will copy images?
If so, why are you using HTML?
I would suggest using WSH (Windows Script Host)
written in either JavaScript or VBScript.
Start with a clear statement of the task; such as:

I want to first copy all JPG images from
d:\dcim\100_fuji\
into a user specified range of subfolders under
c:\documents and settings\christopherneu\desktop\transfer\
etc.
Jul 20 '05 #2


Thanks for the response.

if you do not mind readin a minute i will explain the background of the
script to better help understand the result.

Here is the scenario:

Where i work we have many roving photographers. each of these
photographers has a memory card that can hold x number of photos. When
they take a photo of someone they give them a numbered card. The
photographer copies 1 image to one folder and then 2nd image to second
folder and so forth. These folders have the same number as the
corresponding card the customer recieved.

The customer then can go to a kiosk and enter card number onto the
screen. The corresponding folder is accessed and the photo is shown.
The problem with this is if the photographer messes up and puts a
picture in the wrong folder then the whole system is thrown off and we
have to try to find the problem and fix it. if they do it twice then we
are really up the creek.

The script i wrote is my attempt to remove the human factor. The reason
it is javascript in html is because that is the only thing that i have
any remote experience in.

You said it exactly.

I want to first copy all JPG images from
d:\dcim\100_fuji\
into the folder
c:\documents and settings\christopherneu\desktop\transfer\

Then create user definde subfolders within
c:\documents and settings\christopherneu\desktop\transfer\

then move lowest numbered image into lowest numbered subfolder within
c:\documents and settings\christopherneu\desktop\transfer\

The only constant in this whole little mess is the image name.
dscf0001.jpg being the lowest and going up from there.

once the javascript finishes the photographer will just copy the text
and paste it in the command prompt. The instructions should go from
there.

here is the code with the changes you suggested. I kew about them but
forgot to do it. Thanks for reminding me! :) Thanks in advance for
any help you can provide.

Chris
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>File transfer</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>

<body>
<table width="75%" border="0">
<tr>
<td>
<script language='javascript'>

folder = window.prompt('starting folder','default');
picnumber = window.prompt('pictures taken?','default');
f2 = parseFloat(folder);
p2 = parseFloat(picnumber);
/*adds the amount of photos taken to the starting folder number to
ensure proper amount of folders are present and tells user what the
starting folder and end folders are*/

varAdd = f2+p2-1;
varImg = p2;
var9 = '000';
var99 = '00';
var999 = '0';
var9999 = '0000';
document.write('Starting folder is <b>',f2,'</b><br>');
document.write('Ending folder should be <b>' + varAdd +
'</b><br><br>');

/*Commands used to bring system to standard for file transfer*/

document.write('cd\\<br>')
document.write('cd documents and settings\\christopher
neu\\desktop<br>')
document.write('mkdir transfer<br>')
document.write('cd transfer<br>')

/*copies files from smartmedia to transfer folder*/

document.write('copy d:\\dcim\\100_fuji\\*.jpg<br>')

/*calculates and writes proper amount of folders in the transfer
folder via the "mkdir" command to properly transfer files*/

for (count1=f2;count1<=varAdd;count1++)
if (count1 <=9)
document.write('mkdir ',var9999 + count1 +'<br>');
else if (count1 <=99)
document.write('mkdir ',var9 + count1 +'<br>');
else if (count1 <=999)
document.write('mkdir ',var99 + count1 +'<br>');
else if (count1 <=9999)
document.write('mkdir ',var999 + count1 +'<br>');
else
document.write('mkdir ' + count1 +'<br>');
/*moves pictures into proper folders. This is where the problem is.
I need to put the count that produced the folders after .jpg and have
it start fresh and continue till the move images count is done.
Perhaps this can be done with a function but i can not figure it out.
I can not figure out functions at all actually. :)*/

for (count=1;count<=varImg;count++)
if (count <=9)
document.write('move dscf',var9 + count +'.jpg <br>');
else if (count <=99)
document.write('move dscf',var99 + count +'.jpg <br>');
else if (count <=999)
document.write('move dscf',var999 + count +'.jpg <br>');
else
document.write('move dscf' + count +'.jpg <br>');

</script>
</td>
</tr>
</table>
</body>
</html>

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
"Christopher N" <is*******@yahoo.com> wrote in message
news:40*********************@news.frii.net...


Thanks for the response.

if you do not mind readin a minute i will explain the background of the
script to better help understand the result.

Here is the scenario:

Where i work we have many roving photographers. each of these
photographers has a memory card that can hold x number of photos. When
they take a photo of someone they give them a numbered card. The
photographer copies 1 image to one folder and then 2nd image to second
folder and so forth. These folders have the same number as the
corresponding card the customer recieved.

The customer then can go to a kiosk and enter card number onto the
screen. The corresponding folder is accessed and the photo is shown.
The problem with this is if the photographer messes up and puts a
picture in the wrong folder then the whole system is thrown off and we
have to try to find the problem and fix it. if they do it twice then we
are really up the creek.

The script i wrote is my attempt to remove the human factor. The reason
it is javascript in html is because that is the only thing that i have
any remote experience in.

You said it exactly.

I want to first copy all JPG images from
d:\dcim\100_fuji\
into the folder
c:\documents and settings\christopherneu\desktop\transfer\

Then create user definde subfolders within
c:\documents and settings\christopherneu\desktop\transfer\

then move lowest numbered image into lowest numbered subfolder within
c:\documents and settings\christopherneu\desktop\transfer\

The only constant in this whole little mess is the image name.
dscf0001.jpg being the lowest and going up from there.

once the javascript finishes the photographer will just copy the text
and paste it in the command prompt. The instructions should go from
there.

here is the code with the changes you suggested. I kew about them but
forgot to do it. Thanks for reminding me! :) Thanks in advance for
any help you can provide.

Chris

How are the image names assigned? I have a Sony digital camera that burns
images directly to a mini-CD and it sequences the pictures starting with
"DSC00001.jpg". Thus, all pictures taken with this camera will have a
unique image name even when I change CD's. In your case, i\It sounds like
each photographer could take a picture with the same image number; for
example, "dscf0001.jpg".

Would you give an example of 2 pictures taken by 2 photographers.
Here's an example for the first photographer; what about the second:

Photographer #1
cd\documents and settings\christopherneu\desktop\transfer
mkdir 0001
copy d:\dcim\100_fuji\dscf0001.jpg 0001
mkdir 0002
copy d:\dcim\100_fuji\dscf0002.jpg 0002

Is "christopherneu" the name of a photographer?

Also, do you want to use "copy" or "move"; that is, shopuld the pictures be
deleted from the memory card?

I'd probably suggest using an HTA (HTML for Applications) approach. The
commands can be constructed and executed within it eliminating the need for
cut-and-paste.
Jul 20 '05 #4
"McKirahan" <Ne**@McKirahan.com> wrote in message news:<mkkWb.3140$yE5.18005@attbi_s54>...
"Christopher N" <is*******@yahoo.com> wrote in message
news:40*********************@news.frii.net...


Thanks for the response.

if you do not mind readin a minute i will explain the background of the
script to better help understand the result.

Here is the scenario:

Where i work we have many roving photographers. each of these
photographers has a memory card that can hold x number of photos. When
they take a photo of someone they give them a numbered card. The
photographer copies 1 image to one folder and then 2nd image to second
folder and so forth. These folders have the same number as the
corresponding card the customer recieved.

The customer then can go to a kiosk and enter card number onto the
screen. The corresponding folder is accessed and the photo is shown.
The problem with this is if the photographer messes up and puts a
picture in the wrong folder then the whole system is thrown off and we
have to try to find the problem and fix it. if they do it twice then we
are really up the creek.

The script i wrote is my attempt to remove the human factor. The reason
it is javascript in html is because that is the only thing that i have
any remote experience in.

You said it exactly.

I want to first copy all JPG images from
d:\dcim\100_fuji\
into the folder
c:\documents and settings\christopherneu\desktop\transfer\

Then create user definde subfolders within
c:\documents and settings\christopherneu\desktop\transfer\

then move lowest numbered image into lowest numbered subfolder within
c:\documents and settings\christopherneu\desktop\transfer\

The only constant in this whole little mess is the image name.
dscf0001.jpg being the lowest and going up from there.

once the javascript finishes the photographer will just copy the text
and paste it in the command prompt. The instructions should go from
there.

here is the code with the changes you suggested. I kew about them but
forgot to do it. Thanks for reminding me! :) Thanks in advance for
any help you can provide.

Chris

How are the image names assigned? I have a Sony digital camera that burns
images directly to a mini-CD and it sequences the pictures starting with
"DSC00001.jpg". Thus, all pictures taken with this camera will have a
unique image name even when I change CD's. In your case, i\It sounds like
each photographer could take a picture with the same image number; for
example, "dscf0001.jpg".


That is correct. each photographer starts from dscf0001.jpg each
time. this is because after uploading thier pictures they reformat
the card in the camera. That restarts the camera count.
Would you give an example of 2 pictures taken by 2 photographers.
Here's an example for the first photographer; what about the second:

Photographer #1
cd\documents and settings\christopherneu\desktop\transfer
mkdir 0001
copy d:\dcim\100_fuji\dscf0001.jpg 0001
mkdir 0002
copy d:\dcim\100_fuji\dscf0002.jpg 0002
It would be almost exactly the same for the second photographer. the
only change is the final folder number that each image is moved into.
Is "christopherneu" the name of a photographer?
Thats me. I figure i will be guinea pig. You know... Lead from the
fron not the rear.

Also, do you want to use "copy" or "move"; that is, shopuld the pictures be
deleted from the memory card?
Does not matter. Does not matter at all. The cards will get wiped
when they are put back in the camera. So wether move, cut, or copy is
moved doesnt really matter.
I'd probably suggest using an HTA (HTML for Applications) approach. The
commands can be constructed and executed within it eliminating the need for
cut-and-paste.


Once I get the thing working i am gonna try about a million different
ways to do it. What programs do i use for hta? will just a text
editor work?

Thanks for putting up my ignorance on these matters. I have spent
many many many hours trying to pull this off and still come up empty
handed.
Jul 20 '05 #5

"Tank" <is*******@yahoo.com> wrote in message
news:99**************************@posting.google.c om...
... each photographer starts from dscf0001.jpg each time.
Would you give an example of 2 pictures taken by 2 photographers.
Here's an example for the first photographer; what about the second:

Photographer #1
cd\documents and settings\christopherneu\desktop\transfer
mkdir 0001
copy d:\dcim\100_fuji\dscf0001.jpg 0001
mkdir 0002
copy d:\dcim\100_fuji\dscf0002.jpg 0002

It would be almost exactly the same for the second photographer. the
only change is the final folder number that each image is moved into.


This is what's confusing: if two photographers each take one picture with
different cameras then the image names are the same -- according to your
"spec", wouldn't they go in the same folder? If not what am I missing?
Perhaps, I just need a more concise "spec" that discusses this situation.
Is "christopherneu" the name of a photographer?


Thats me. I figure i will be guinea pig. You know... Lead from the
fron not the rear.


I was thinking that each photographer would create folders under his/her own
name... but I guess not.
Once I get the thing working i am gonna try about a million different
ways to do it. What programs do i use for hta? will just a text
editor work?


HTAs are basically HTML pages that allow you to do stuff like read and write
files and execute commands such as "mkdir" and "copy". Any text editor can
be used. Here is a simple HTA that makes a new directory and copies a file
to it; watch for word-wrap.
<html>
<HTA:APPLICATION ID="MakeCopy"
APPLICATIONNAME="MakeCopyHTA">
<head>
<title>MakeCopy.hta</title>
<script type="text/vbscript">
Option Explicit
Const cHTA = "MakeCopy.hta"

Sub MakeCopy()
Dim strDIR
strDIR = "C:\Temp\MakeCopy." & DatePart("s",Time)
Dim strFIL
strFIL = "C:\config.sys"
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDIR) Then
objFSO.DeleteFolder(strDIR)
End If
objFSO.CreateFolder(strDIR)
objFSO.CopyFile strFIL, strDIR & Mid(strFIL,InStr(strFIL,"\"))
Set objFSO = Nothing
MsgBox strDIR & " created!",vbInformation,cHTA
End Sub
</script>
</head>
<body>
<form>
<input type="button" value="MakeCopy" onclick="MakeCopy()">
</form>
</body>
</html>

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2555
by: James | last post by:
Please help - getting very desperate! Sun, 12 October 2003 05:39 I have PHPDEV 4.2.3 from Firepages.com.au as the upgrade to 4.3.0 did not work. I also had an abortive download from PHP.NET as...
16
3905
by: Thomas G. Marshall | last post by:
This message is sent to these newsgroups because they are no longer valid: comp.lang.java comp.lang.java.api comp.lang.java.bugs comp.lang.java.misc comp.lang.java.setup comp.lang.java.tech
1
4654
by: Knocked Wood | last post by:
Hi, I looked around and can't find anything on this at all and can not get it to work for IE. I'm trying to loop multiple sounds on a game, with three unique variables, when a link is clicked....
1
1600
by: Kelly Olsen | last post by:
Can someone please help me with the following: I have different forms that are all linked together however when I enter data into each, each form shows up as a seperate record. I want them all...
5
440
by: john | last post by:
Hello, I am trying to send 2^19 data to USB2.0. I am reading the file "all_sines" and loading it into an array called "string1". Then, in a for loop I copied it into the USB data array...
32
14762
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
4
2441
by: Matt Ratliff | last post by:
Hello, I would appreciate any assistance you have with the following problem: I have (as an example) an array of values as follows: arrayvalues=new Array("0001","0003","0005") where each is the...
2
2701
by: jennk | last post by:
i am working in Access 97, our database tables are linked from ODBCsqlsvr (not even sure what that means). i have a table where each record has a unique customer and their order information. there...
1
1329
by: AinJul Rose | last post by:
Hi, I'm in desperate need of help. My exam is in 2 days and I dont understand anything covering the logical operations and Loops. The format for my exam is simply to convert a few things into C...
0
7331
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7391
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5056
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3204
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1564
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
424
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.