08-06-2014, 03:16 PM
Hello Gintaras,
I tried out your code and it works really well. Although I am a novice with some of the programming. I have been working on editing the macro so it searches the already created directory on my system. Trouble is I can't seem to figure out why it isn't working. Here are the changes I made to the code and I am getting the following error message.
Error (RT) in Attached Quote: cannot open or create file: Access is denied. (5).
As you can see I haven't made much for changes other than to point to the actual folder on my system. Any help you can give me with the error code would be appreciated.
Best Regards,
Paul
I tried out your code and it works really well. Although I am a novice with some of the programming. I have been working on editing the macro so it searches the already created directory on my system. Trouble is I can't seem to figure out why it isn't working. Here are the changes I made to the code and I am getting the following error message.
Error (RT) in Attached Quote: cannot open or create file: Access is denied. (5).
out
str files.searchpath("J:\Quotes\2014")
/;C:\Quotes\2014\08-05 Smith - Johnson - Gen $4500 Monthly 6yrs Shared 3% Comp.pdf
/;C:\Quotes\2014\08-05 Smith - Johnson - Comparison.pdf
/;C:\Quotes\2014\08-05 Smith-Johnson-Thrivent $4500 Monthly 6yrs Shared 3% Comp.pdf
/;C:\Quotes\2014\08-05 Somebody - Else - Gen $5000 Monthly 8yrs Shared 3% Comp.pdf
/;C:\Quotes\2014\08-05 Somebody - Else - Comparison.pdf
/mkdir "C:\Quotes\2014"
str _s1 _s2="test"
foreach(_s1 files) _s2.setfile(_s1)
/08-05 Zepper - King -
;--------------
str s.getsel
str attachmentsList
str rx=" *- *"
s.replacerx(rx "-")
;out s
ARRAY(str) a; int i
GetFilesInFolder a "J:\Quotes\2014" "*.pdf"
for i 0 a.len
,;out "----"; out a[i]
,str s2
,if(findrx(a[i] "\\Quotes\\20\d\d\\(\d\d-\d\d [^-]+-[^-]+-).+\.pdf" 0 1 s2 1)<0) end F"incorrect filename format: {a[i]}"
,s2.replacerx(rx "-")
,;out s2
,if(!(s2~s)) continue
,;out a[i]
,attachmentsList.addline(a[i])
out attachmentsList
As you can see I haven't made much for changes other than to point to the actual folder on my system. Any help you can give me with the error code would be appreciated.
Best Regards,
Paul