So the following string works in the latest version 6.2.7 in the save node:
$FFwfJob.jobName.substring(0,10)$
This truncates the filename down to 10 characters starting at the first character and building from left to right.
I found some OLD notes that say that MANY expanded functions like this ONLY became available in version 5 Service Pack 1 (which I believe is 5.1.0 version of Core) which again is NEWER than your version - my note is from March of 2017. I am guessing it wont work with 5.0.0.5. If for some reason you are stuck with version 5, then I would at least recommend getting upgraded to 5.4.5 which was one of the more robust and stable releases in the 5.x software. This would then at least allow you to use the 'updated' substring type commands.
From what version were these functions available in? We're still on 5.0.0.5 and I can't seem to get these to work. I'm trying to shorten the output file names. So I'm looking ltrim rtrim or substring.
To get information from a file name you can create a manifest on the fly. Here is an example for a similar request. A customer would like to extract ABC and 32ex as variables from a pdf with this name:
FO146390_ABC_49180_5214_32ex_SRA3_Komplett.pdf
This PowerShell script that you need to run on a hotfolder with parameters $FFin$ and $FFout$ will create a manifest extracting the required information from the file name using two regular expressions ($regex1 and $regex2) and write those into columns in the manifest. The variables can then be used as for instance in a Watermark.
$filepath = Get-Item $args[0]
$filename = $filepath.Name
$maxfile = "C:\Temp\$filename.txt"
$regex1 = '^.*?_(.*?)_.*?_.*$'
$regex2 = '^.*?_.*?_.*?_.*?_(.*?\d*).*$'
$preset = ($filename -split $regex1)[1]
$copies = ($filename -split $regex2)[1]
Copy-Item $filepath -Destination "C:\Temp\"
Set-Content -Path $maxfile -value "C:\Temp\$filename;$preset;$copies" -NoNewLine
$outpath= $args[1].Substring(0,$args[1].Length-1)
Copy-Item -Path $maxfile -Destination $outpath
You would need to find the correct regular expression for the information you would like to extract from the file name. Here is one https://regex101.com/ or google regex tester.
For something like:
123xsomefilename210mm.pdf
\d+(?=x) would give 123 and x*(\d+)(?=mm) would give 210
/Stefan
I want to extract from filename 2 or 3 digits before "x" and before "mm", and then process as a variable. Is it posible?
The ltrim and rtrim capabilities are still present in FFCore. Unfortunately there was a problem when Help was updated. Help has been fixed for FFCore 6.0.0.
In Core 5.4.5 there is no ltrim and rtrim in help at Process Variable Operations. Did something changed?
I want to extract from filename 2 or 3 digits before "x" and before "mm", and then process as a variable. Is it posible?
You may be looking for the Process Variable Operations. Look in the FreeFlow Core Help for the details:
One option is to use the Optimize node. For the Keywords entry use $FFwfJob.jobName$. This will put the filename into the PDF metadata field for Keywords.
Is it possible to perform find/replace when setting metadata with the filename?
Eg:
Filename: "First_second_&_third".pdf
Required metadata: "First second and third"
Solved! Go to Solution.