Thanks for your help Chris, *set* pathToRelativize *to* "/Users/jgill/Documents/Web/CHOG/CHOG1and1/Archive Photos/Juvenile-Shag.jpg" *set* referencePath *to* "/Users/jgill/Documents/Web/CHOG/CHOG1and1/Commoner Species Photos/Shag.htm"
I set up a loop to compare the characters of the image file and the html file. When they stopped matching, I knew I had come to be beginning of the parent directories (both at the same level). I took the characters from that point to the end of the image file path, stuck ../ in front and Bob's your uncle ;?) ../Archive Photos/Juvenile-Shag.jpg Dreadful hack, I know, but works for now. On Friday, December 9, 2016 at 1:11:06 PM UTC, jgill wrote: > > I am trying to automate the process of importing an image and adding a > caption, which will be parsed out of the file name. I can manage that bit, > where I am stuck is with using 'choose file' to produce the *relative* file > path to the page I am working on. I could laboriously split and subtract > elements of the POSIX file path to the .jpg file but there must be a more > elegant way? > -- This is the BBEdit Talk public discussion group. If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/bbedit.
