Beele 3 Posted March 19, 2020 Report Share Posted March 19, 2020 Hi @all, i have a folder with some .pdf documents like 19-0215458-test.pdf or 20-0357896.pdf Now i want to scrape the first 10 digits from each document name. Can someone help me please ? Quote Link to post Share on other sites
HelloInsomnia 1103 Posted March 19, 2020 Report Share Posted March 19, 2020 Here is a function with an example: clear list(%files)add list to list(%files,$list from text("19-0215458-test.pdf20-0357896.pdf20-035789620-035789620-035789620-0357896.pdf",$new line),"Delete","Global")loop($list total(%files)) { set(#file,$next list item(%files),"Global") alert($GetFirstTenDigits(#file))}define $GetFirstTenDigits(#_text) { comment("Get all digits") set(#_digits,$replace regular expression(#_text,"[^0-9]+",$nothing),"Local") if($comparison($text length(#_digits),"< Less than",11)) { then { comment("If less than 11 then return") return(#_digits) } else { comment("Else return first 10 only") return($substring(#_digits,0,10)) } }} 1 Quote Link to post Share on other sites
pash 504 Posted March 20, 2020 Report Share Posted March 20, 2020 set(#Debug,"19-0215458-test.pdf","Global") alert($find regular expression(#Debug,"[\\d\\-]\{10,10\}")) 2 Quote Link to post Share on other sites
Beele 3 Posted March 20, 2020 Author Report Share Posted March 20, 2020 You are great, thx !!! Quote Link to post Share on other sites
Beele 3 Posted March 20, 2020 Author Report Share Posted March 20, 2020 only here i can´t find a solution: "$list from text" is no problem, but never before scraped dokument names from a folder. navigate("D:\\Dokumente\\Desktop\\list","Wait")add list to list(%file,$scrape attribute(<??>,"??"),"Delete","Global") Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.