autohotkey - Saving specific areas of a filename -


i have list of pdf files in format "123 - test - english.pdf". want able set "111", "test" , "english.pdf" in own individual variables. tried running code below don't think accounts multiple dashes "-". how can this? please in advance.

    loop,c:\my documents\notes\*.pdf, 0, 0     {     newvariable = trim(substr(a_loopfilename,1, instr(a_loopfilename, "-")-1)) 

i recommend using parse loop variables. following loops through values between dashes , removes whitespace.

filename = test - file - name.pdf loop, parse, filename, `-     myvar%a_index% := regexreplace(a_loopfield, a_space, "")  msgbox % myvar1 "`n" myvar2 "`n" myvar3 

Comments