Rich, What I’m really trying to do is to create a simple AppleScript (which I can invoke via BBEdit) to delete a file.
In the past, for other purposes, I have specified “theFile” via one of these two AppleScript options: (1) set theFile to (open file “whatever.txt") (2) set filePath to "/Users/alfredo/whatever.txt" set theFile to POSIX file filePath There may be other options to specify “theFile”, but I don’t know and I would certainly like to learn about them. I wish I knew how to do the equivalent of your "Close & Delete”, using some sort of AppleScript syntax: "Close & Delete" theFile I suspect that this can be a super-short AppleScript, but unfortunately I have no idea about the syntax. Thanks. Alfredo > On Mar 19, 2021, at 8:43 AM, Rich Siegel <[email protected]> wrote: > > On 19 Mar 2021, at 1:39, F. Alfredo Rego wrote: > >> Hi everyone, >> >> I would like to delete a file via AppleScript. >> >> I’m sure the solution is trivially simple, but so far I can’t find a way. >> >> The easy way would be to do something like this, which sadly does exactly >> what it says and it doesn’t delete the file: >> >> set theFile to (open file "whatever") >> close theFile saving no >> >> I looked around in BBEdit’s dictionary for something naively obvious >> (perhaps "close theFile deleting yes”) but no such luck. > > WAYRTTD? The "Close & Delete" command on the File menu will close a text > document and move its backing file to the trash. > > R. > > -- > Rich Siegel Bare Bones Software, Inc. > <[email protected]> <https://www.barebones.com/> > > Someday I'll look back on all this and laugh... until they sedate me. > > -- > This is the BBEdit Talk public discussion group. If you have a feature > request or need technical support, please email "[email protected]" > rather than posting here. Follow @bbedit on Twitter: > <https://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 view this discussion on the web visit > https://groups.google.com/d/msgid/bbedit/07E76664-1A07-4F8F-8775-DE3FD000D65E%40barebones.com. -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://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 view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/BB97021D-ABC9-4FA3-9FE3-0E532E8451AB%40gmail.com.
