 |
|
BaselScript |
Beschreibung
Eine Datei in eine andere Datei umschreiben
rewrite file=name to=name [from=name][ to_directory=name] [section= name]
or
rewrite from_file=name to_file=name [from_directory=name] [to_directory=name] [section= name]
section=name - for editing of current record
if #_skip_record == 1 then current record will be skipped
Beispiel:
// source file
file name=person record=(#name,#vorname,#city,#street, #birthday) directory= #_directory_files
// target file
file name=person2 record=(#vorname,#name,#city,#street) directory= #_directory_files
// command
rewrite from_file=person to_file=person2
Beispielscript:
scene =1 name = restructurisation
section init
#t = "rewrite the file example_person.csv to person2 and rename the file person2 to the file new_person"
end section
form
tile=text name=title1 x=10 y=340 w=780 h=300 text =#t gravity=center
tile=button name=#button_start x=100 y=600 text = "Start" section = but_start
end form
section but_start
call scene = 2
end section
end scene
---------------------------------------------------------------------------
scene=2 name="rewrite and rename" bgcolor = gray
section init
// source file
file name=example_person.csv record=(#name,#vorname,#city,#street,#birthday)
// target file
file name=person2 record=(#vorname,#name,#city,#street,#birthday, #tel)
#exist = $exist_file("/APPDIR/files",example_person.csv)
if #exist == 1
rewrite file=example_person.csv to_file=person2 from_directory = "/APPDIR/files" to_directory = "/APPDIR/files"
rename file=person2 to_file=new_person directory = "/APPDIR/files"
message "process is done"
else
message "file example_person.csv no exist"
endif
end section
--------------------------------------------
// if street contains "66" the skip this record
section edit
if $contains(#street,"66")
#_skip_record=1
endif
end section
--------------------------------------------
section back
call script=empty
end section
end scene 2