I am trying to use a variable pulled from a pdf, and I'm getting a file rename error 123.
I have tried many different ways and I still can't get it to save with the new filename which in my example is B12345.
Any Ideas?
RosPdftxt="Y:\Data\Test\PDFS\TodaysRos.txt"
PdfData = FileGet(RosPdftxt)
TotalLines = (ItemCount(pdfdata, @LF) )
RosNum = ""
For InvoiceLine = 1 To TotalLines
ThisLine = ItemExtract(InvoiceLine, pdfdata, @LF)
if strsub(ThisLine, 1, 24) == "OF MULTIPLE NEW VEHICLES"
ThatLine = ItemExtract(InvoiceLine+1, pdfdata, @LF)
RosNum = strsub(ThatLine, 1, 7)
endif
next
message(rosnum,rosnum)
;*************************************************************
;*************************************************************
adobe = ObjectCreate("AcroExch.app") ; create an application object
PDF = ObjectCreate("AcroExch.pdDoc")
PDFFileName = "Y:\Data\Test\PDFS\a.pdf"
t1 = PDF.open(PDFFileName)
StringSave = strcat("Y:\Data\Test\PDFS\" : rosnum : ".pdf")
;message("stringsave",stringsave)
;message("stringsave",%rosnum%)
t2 = PDF.save(1,"Y:\Data\Test\PDFS\aaa.pdf")
PDF.close
adobe.exit; exit the application
adobe = "" ; close the application object
FirstPDF = "" ; close the application object
filerename ("Y:\Data\Test\PDFS\aaa.pdf" , stringsave)
exit
While not related to your problems, why are using both the concatenation operator and the StrCat function on the line:
StringSave = strcat("Y:\Data\Test\PDFS\" : rosnum : ".pdf") ?
You only need to use one or the other but not both. As is you are just wasting CPU cycles.
Assuming you mean that the 123 system error, text associated with that error is "The filename, directory name, or volume label syntax is incorrect." You can find Win32 system error description on our Tech Support site or on Microsoft's site.
The above description is kinda self-explanatory and it isn't possible to tell you what the exact syntax error is because the value of the "RosNum" variable is not discernible without running your script with your data files.
That was just the last way I tried to make it work.
StringSave = strcat("Y:\Data\Test\PDFS\", rosnum,".pdf")
StringSave = "Y:\Data\Test\PDFS\" : rosnum : ".pdf"
StringSave = strcat("Y:\Data\Test\PDFS\" : rosnum : ".pdf")
There was a stray CRLF in there which I used a...
rosnum = StrClean (rosnum, @CRLF, "", @TRUE, 1) to fix.
Works now
The problem was not how you concatenated but what you concatenated. Thanks for letting us know you figured out the what the what was.