Yes, I thought about it afterwards, thanks. :) On Sunday, February 26, 2017 at 4:50:11 PM UTC+2, micmac wrote: > > Applescript can call a bash commandline statement. U can make up a > statement like rm fullpath/*.jpg > > On Feb 26, 2017 10:12 PM, "Adrian Manea" <[email protected] > <javascript:>> wrote: > >> OK, I seem to have sorted out the filePath part, but apparently >> AppleScript does not take many extensions with "or"? Or am I doing >> something wrong? >> >> Script: >> >> *tell* *application* "BBEdit" >> >> *set* w *to* *text window* 1 >> >> *set* the_file *to* *file* *of* active document *of* w *as* *text* >> >> -- set filePath to (do shell script "/usr/bin/find >> ~/Dropbox/adi_dropbox/ -name" & the_file) >> >> *set* filePath *to* POSIX path *of* the_file >> >> *end* *tell* >> >> >> *set* parentDirectory *to* *POSIX file* (*do shell script* "dirname " & >> quoted >> form *of* POSIX path *of* the_file) *as* *alias* >> >> >> >> *tell* *application* "Finder" >> >> *delete* (*every* *item* *of* *folder* parentDirectory *whose* name *does >> not* *end* *with* (".tex" *or* ".pdf" *or* ".eps" *or* ".bbprojectd" *or* >> "tags" *or* ".ist")) >> >> *display dialog* "Folder cleaned." buttons {"OK"} >> >> *beep* >> >> *end* *tell* >> >> >> >> >> On Sunday, February 26, 2017 at 3:22:47 PM UTC+2, Adrian Manea wrote: >>> >>> OK, I'm pretty sure this is an easy one, but since I have close to zero >>> experience with AppleScript, I have to ask: >>> >>> Could anyone please help me with a script that gets the path to the >>> containing folder of the current (open, frontmost) text file of BBEdit? >>> >>> Concrete use: I would then add to the script the command to delete from >>> that folder files by extension. When running pdflatex, I get lots of >>> auxiliary files that are not needed, so I intend to use such a script for >>> "cleaning up" the folder, to be left only with .tex and .pdf files in that >>> folder. >>> >>> I would add to the script something like: >>> >>> >>> *tell* *application* "Finder" >>> >>> *delete* (*every* *item* *of* *folder* (*path to* filePath) *whose* name >>> *does >>> not* *end* *with* ".tex" *or* ".pdf" *or* ".eps" *or* ".bbprojectd" *or* >>> "tags" *or* ".ist") >>> >>> *end* *tell* >>> >>> But the hardest part is getting that filePath... >>> >>> Thank you! >>> >> -- >> 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] <javascript:>" 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/bbedit. >> >
-- 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.
