I have been using this script with some modifications for two years. It was very kindly provided by Stan Matthews. I recently tried to change machines but after downloading a fresh version of A5V11 and copying the directory to the new maching I get "Couldnot open or create multi-user information file C:\Program Files (x86)\a5V11\Laprima\Laprima.MUF'. The file is there (Windows 10) with 0 bytes exactly as on the old machine (XP). So firstly can someone help me fix that? In the meantime I tried a minor change at the same time on the old XP machine, the change was to add a bcc_param to send the same pdf report elsewhere as a check that the file had been sent, you can see the two lines that I have changed. When I run the script, I get the message "File not found: "Your attached account covers the month of June". I'm not very familiar with scripting so it must be my mistake but it looks to me as though the script is looking for a file in the;
if filefind.get(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()),FILE_FIND_DIRECTORY,"PN") = ""
dir_create(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date())) part but I'm sure I haven't changed that.
I would really appreciate any help.
'Date Created: 19-Oct-2013 03:07:47 PM
'Last Updated: 04-Jun-2016 09:32:47 AM
'Created By : usuario
'Updated By : Laura Johnson
parentform.commit()
tbl = table.current()
tbl.fetch_first()
'debug(1)
while .not. tbl.fetch_eof()
query.filter = "cuscode = "+quote(alltrim(tbl.cuscode))
query.order = ""
to_param = Lookup("Clients","cuscode = "+quote(alltrim(tbl.cuscode)),"alltrim(email)")
if alltrim(to_param) > "" 'only execute this section if an email address is found
cc_param = a5_eval_expression("",local_variables())
bcc_param = a5_eval_expression("[email protected]",local_variables())
subject_param = "Monthly account from Laprima S.L."
message_param = "Your attached account covers the month of "+cmonth(date())+"."
if filefind.get(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()),FILE_FIND_DIRECTORY,"PN") = ""
dir_create(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()))
end if
:report.SaveAs("AccMonthly","PDF",query.filter,query.order,a5.get_path()+chr(92)+"Accounts "+cmonth(date())+chr(92)+" Acct "+tbl.cuscode+".pdf")
sleep(4)
email_send(to_param,bcc_param,subject_param,message_param,a5.get_path()+chr(92)+"Accounts "+cmonth(date())+chr(92)+" Acct "+tbl.cuscode+".pdf")
sleep(4)
end if 'end of section to create and send email if address found
tbl.fetch_next()
end while
fil.flush()
fil.close()
Thank you in advance,
Trevor.
if filefind.get(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()),FILE_FIND_DIRECTORY,"PN") = ""
dir_create(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date())) part but I'm sure I haven't changed that.
I would really appreciate any help.
'Date Created: 19-Oct-2013 03:07:47 PM
'Last Updated: 04-Jun-2016 09:32:47 AM
'Created By : usuario
'Updated By : Laura Johnson
parentform.commit()
tbl = table.current()
tbl.fetch_first()
'debug(1)
while .not. tbl.fetch_eof()
query.filter = "cuscode = "+quote(alltrim(tbl.cuscode))
query.order = ""
to_param = Lookup("Clients","cuscode = "+quote(alltrim(tbl.cuscode)),"alltrim(email)")
if alltrim(to_param) > "" 'only execute this section if an email address is found
cc_param = a5_eval_expression("",local_variables())
bcc_param = a5_eval_expression("[email protected]",local_variables())
subject_param = "Monthly account from Laprima S.L."
message_param = "Your attached account covers the month of "+cmonth(date())+"."
if filefind.get(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()),FILE_FIND_DIRECTORY,"PN") = ""
dir_create(a5.Get_Path()+chr(92)+"Accounts "+cmonth(date()))
end if
:report.SaveAs("AccMonthly","PDF",query.filter,query.order,a5.get_path()+chr(92)+"Accounts "+cmonth(date())+chr(92)+" Acct "+tbl.cuscode+".pdf")
sleep(4)
email_send(to_param,bcc_param,subject_param,message_param,a5.get_path()+chr(92)+"Accounts "+cmonth(date())+chr(92)+" Acct "+tbl.cuscode+".pdf")
sleep(4)
end if 'end of section to create and send email if address found
tbl.fetch_next()
end while
fil.flush()
fil.close()
Thank you in advance,
Trevor.
Comment