2 file loops

Discuss RoboTask here
Post Reply
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

2 file loops

Post by steph@vds »

Hi,I'm trying to create a task that stores a filename from a file in a source folder to rename another file in a target folder with that filename.Of course there is exactly the same number of file in these two folders.The problem is that every time the File Loop of the source folder is executed (to store the filename), the File Loop of the target folder (nested in the previous File Loop) restarts from the beginning and store the filename of the very first file.Here is my task (I've inserted "Show {SOURCEFILE}" and "Show {TARGETFILE}" to simplify):;*******************************;* RoboTask Task file          *;* Do not edit in text editor! *;******************************* [Root]ActionAfterRun=INTEGER|0Actions=FOLDERAutomat=INTEGER|-1CatID=INTEGER|1799408172ContinueOnError=INTEGER|0ExternalName=STRING|"Task6"Hide=INTEGER|0ID=INTEGER|1674956621Name=STRING|"Copier noms fichiers"Priority=INTEGER|3RunOnClose=INTEGER|0RunOnStartup=INTEGER|0ToLog=INTEGER|3[Actions]Action1=FOLDERAction2=FOLDERAction3=FOLDERAction4=FOLDERAction5=FOLDERAction6=FOLDERAction7=FOLDERAction8=FOLDER[Actions\Action1]ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"Enabled=INTEGER|-1Name=STRING|"Dossier Source ?"Params=FOLDER[Actions\Action1\Params]caption=STRING|"Dossier Source ?"default=STRING|"None"filter=STRING|"Text files|*.txt|All files|*.*|"folder=STRING|"C:\Documents and Settings\Steph\Mes documents\00_ADMINISTRATIF\04_SCANS EN COURS\SECU\Copie de FEUILLES DE SOINS"variable=STRING|"DOSSIERSOURCE"[Actions\Action2]ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"Enabled=INTEGER|-1Name=STRING|"Dossier Cible ?"Params=FOLDER[Actions\Action2\Params]caption=STRING|"Dossier Cible ?"default=STRING|"None"filter=STRING|"Text files|*.txt|All files|*.*|"folder=STRING|"C:\Documents and Settings\Steph\Mes documents\00_ADMINISTRATIF\04_SCANS EN COURS\SECU\2009-01-200001"variable=STRING|"DOSSIERCIBLE"[Actions\Action3]ActionID=STRING|"A_LOOP_FILE"Enabled=INTEGER|-1Name=STRING|"File Loop Fichier Source"Params=FOLDER[Actions\Action3\Params]createmode=STRING|"1"date1=STRING|"20090120"date2=STRING|"20090120"destvar=STRING|"FICHIERSOURCE"DuringDays=STRING|"1"DuringMonths=STRING|"1"exclude=STRING|"*.db"file0=STRING|"{dossiersource}\*.*"filecount=STRING|"1"OlderDays=STRING|"1"OlderMonths=STRING|"1"savesize=STRING|"0"searchkind=STRING|"0"subdirs=STRING|"1"timesize=STRING|"0"WithoutPath=STRING|"1"[Actions\Action4]ActionID=STRING|"A_DIALOG_MESSAGE"Enabled=INTEGER|-1Name=STRING|"Show ""{FICHIERSOURCE}"""Params=FOLDER[Actions\Action4\Params]icon=STRING|"1"msg0=STRING|"{FICHIERSOURCE}"msgcount=STRING|"1"playsound=STRING|"0"showmessage=STRING|"1"[Actions\Action5]ActionID=STRING|"A_LOOP_FILE"Enabled=INTEGER|-1Name=STRING|"File Loop Fichier Cible"Params=FOLDER[Actions\Action5\Params]createmode=STRING|"1"date1=STRING|"20090120"date2=STRING|"20090120"destvar=STRING|"FICHIERCIBLE"DuringDays=STRING|"1"DuringMonths=STRING|"1"exclude=STRING|"*.db"file0=STRING|"{dossiercible}\*.*"filecount=STRING|"1"OlderDays=STRING|"1"OlderMonths=STRING|"1"savesize=STRING|"0"searchkind=STRING|"0"subdirs=STRING|"1"timesize=STRING|"0"WithoutPath=STRING|"1"[Actions\Action6]ActionID=STRING|"A_DIALOG_MESSAGE"Enabled=INTEGER|-1Name=STRING|"Show ""{FICHIERCIBLE}"""Params=FOLDER[Actions\Action6\Params]icon=STRING|"1"msg0=STRING|"{FICHIERCIBLE}"msgcount=STRING|"1"playsound=STRING|"0"showmessage=STRING|"1"[Actions\Action7]ActionID=STRING|"A_LOOP_END"Enabled=INTEGER|-1Name=STRING|"End Loop"[Actions\Action8]ActionID=STRING|"A_LOOP_END"Enabled=INTEGER|-1Name=STRING|"End Loop"
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

2 file loops

Post by Oleg »

Wait a minute...
- You have two folders: SOUR and DEST
- You want to rename files in SOUR, also you want to rename file in DEST with same file name

Is this correct?

If so, you doesn't need second loop (in DEST folder). Of course, the nested loop will be proceed completely for each file in first loop.

See my edition of the task below:
;*******************************
;* RoboTask Task file         &n bsp;*
;* Do not edit in text editor! *
;*******************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1076699455
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task760"
Hide=INTEGER|0
ID=INTEGER|1674956621
LogOnAsUser=INTEGER|1
Name=STRING|"Copier noms fichiers (my edition)"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER

[Actions\Action1]
ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"
Enabled=INTEGER|-1
Name=STRING|"Dossier Source ?"
Params=FOLDER

[Actions\Action1\Params]
caption=STRING|"Dossier Source ?"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
folder=STRING|"C:\Documents and Settings\Steph\Mes documents\00_ADMINISTRATIF\04_SCANS EN COURS\SECU\Copie de FEUILLES DE SOINS"
variable=STRING|"DOSSIERSOURCE"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_BROWSEFOLDERS"
Enabled=INTEGER|-1
Name=STRING|"Dossier Cible ?"
Params=FOLDER

[Actions\Action2\Params]
caption=STRING|"Dossier Cible ?"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
folder=STRING|"C:\Documents and Settings\Steph\Mes documents\00_ADMINISTRATIF\04_SCANS EN COURS\SECU\2009-01-200001"
variable=STRING|"DOSSIERCIBLE"

[Actions\Action3]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop Fichier Source"
Params=FOLDER

[Actions\Action3\Params]
createmode=STRING|"1"
date1=STRING|"20090120"
date2=STRING|"20090120"
destvar=STRING|"FICHIERSOURCE"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
exclude=STRING|"*.db"
file0=STRING|"{dossiersource}\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"1"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Rename file in source folder:"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"Rename file in source folder:"
msg1=STRING|"{dossiersource}\{FICHIERSOURCE}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Rename file in destination folder:"""
Params=FOLDER

[Actions\Action5\Params]
icon=STRING|"1"
msg0=STRING|"Rename file in destination folder:"
msg1=STRING|"{DOSSIERCIBLE}\{FICHIERSOURCE}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

2 file loops

Post by steph@vds »

Hi Oleg,I'm glad to see that you always reply so quickly !I've 172 files in my source folder.I've also 172 files in my destination folder. It's the same documents but with some updates, corrections...I want to rename the new files (in the destination folder) with the filenames of the old files (in the source folder).The first new file has to be be renamed with the first old filename.The second new file has to be renamed with the second old filename....The 172th new file has to be renamed with the 172th old filename.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

2 file loops

Post by Oleg »

You can't compare files by sequence number. You MUST compare them only by names, because you can't garantee that files are kept in the same sequence in both folders.

Windows explorer shows the sorted list of files by default, but this doesn't mean that files are written in the same sequence on disk.
Post Reply