We have a script that works to copy a file. I would like to patch something like this in to make it copy a second file. How can I make "2toname" out of "toname"? Something like
file.filename_parse(filename,"n") -> "???" Toname can be about anything anywhere, and 2toname should be a reliable result.
original script
file.filename_parse(filename,"n") -> "???" Toname can be about anything anywhere, and 2toname should be a reliable result.
Code:
b_tbl=table.open("rip.dbf") query.order = "str(RIPNO, 5, 0)" query.filter = "Dchanged>yesterday" query.options = "I" b_tbl.query_create() copy.set = "" copy.db = 2toname copy.dd = .F. copy.delete_o_dd = .T. copy.records = .T. copy.fields = 4 copy.field1 = "Rip->Location" copy.field2 = "Rip->Contents" copy.field3 = "Rip->RipNo" copy.field4 = "Rip->Dchanged" b_tbl.copy() b_tbl.close() ui_msg_box("Status", " All done!")
Code:
ON ERROR GOTO error_handler toname = ui_get_file("Copy Accessions TO:","Tables(*.DBF)","","N") IF toname = "" THEN END END IF DIM SHARED fromdate as D DIM SHARED varC_result as C ok_button_label = "&OK" cancel_button_label = "&Cancel" varC_result = ui_dlg_box("Backup",<<%dlg% {region} Backup entries since ...?:| [%DATE;P=popup.calendar(dtoc(fromdate));I=popup.calendar%.40fromdate!fromdate_*]; {endregion}; {line=1,0}; {region} <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL> {endregion}; %dlg%,<<%code% if left(a_dlg_button,9) = "fromdate_" then if a_dlg_button = "fromdate_killfocus" then fromdate = ctod(dtoc(fromdate)) end if a_dlg_button = "" end if %code%) yesterday=fromdate-1 ' msgbox("",dtoc(yesterday)) a_tbl=table.open("gen_log.dbf") query.order = "str(IDNO, 5, 0)" query.filter = "Dchanged>yesterday" query.options = "I" a_tbl.query_create() copy.set = "" copy.db = toname copy.dd = .F. copy.delete_o_dd = .T. copy.records = .T. copy.fields = 11 copy.field1 = "Gen_Log->Date" copy.field2 = "Gen_Log->Descriptn" copy.field3 = "Gen_Log->Cat_No" copy.field4 = "Gen_Log->Donor" copy.field5 = "Gen_Log->Dispose" copy.field6 = "Gen_Log->Rip" copy.field7 = "Gen_Log->Next_Db" copy.field8 = "Gen_Log->Dchanged" copy.field9 = "Gen_Log->Idno" copy.field10 = "Gen_Log->Flood" copy.field11 = "Gen_Log->Long_Name" a_tbl.copy() a_tbl.close() ui_msg_box("Status", " All done!") END error_handler: err = error_code_get() msg = error_text_get(err) ui_msg_box("Error", msg) END
Comment