Finding text of a folder

Scenario

I have a database that contains some info… I use this info to create a folder… Part number-description. However if the description changes it creates a new folder. I want to first check if the part number exists… SO I would need to be able to count up to a dash in the folder name and return back everything before it to get a value if that value matches the variable passed into the applescript them rename that folder vs create a new one… I know how to do everything except for count characters until the dash… There maybe a better way to do this like if AS treats words broken by dashes as separates words…


set folderName to "abcd-efg"
set eforeDash to text 1 thru ((offset of "-" in folderName) - 1) of folderName

Yvan KOENIG (VALLAURIS, France) jeudi 27 février 2014 14:01:10