With the new release of BBEdit a couple of Keyboard Maestro macros I rely on hiccupped. I've found a workaround and thought I'd detail here in case it helps anyone else with the same problem.
These macros all open a master text file from a master directory and save that master file in the working directory with the same name (so I don't overwrite the master text file). They call a separate macro that uses the Finder's Go to Folder command using date variables for the working directory whose name includes the current year and month.
The new version of BBEdit didn't wait for the Go to Folder macro to actually change directories. Instead, the working name was overwritten in the File Save As prompt with the working directory name.
So instead of going to "MyDisk/MyStuff/Masters/2019/02" and then displaying that directory in the File Save As dialog with the default file name "master.txt" I would see "MyDisk/MyStuff/Masters/2019/02.txt" in the dialog. (The directory name created by the Go to Folder macro replaced the selected root filename leaving the extension alone.)
The workaround was to insert a 1.5 second pause after the action that selects Save As from the BBEdit File menu and before jumping to the Go to Folder macro.
Generally when working with a master-file and copying it elsewhere I'll copy and rename the file before opening it it BBEdit โ but what you describe can easily be done with BBEdit alone.
-Chris
----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2019/03/01 14:38
# dMod: 2019/03/01 14:38
# Appl: BBEdit
# Task: Open a Master-File and Save it to a Different Path.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Open, @Master-File, @Save, @Different, @Path
----------------------------------------------------------------
set masterTextFile to expandTilde("~/test_directory/BBEdit_Test_Dir/bbedit_test_file.txt") of me
set newDocPath to expandTilde("~/Downloads/New_File_Name.txt") of me
tell application "BBEdit"
set masterDoc to open masterTextFile
save masterDoc to newDocPath
end tell
----------------------------------------------------------------
--ยป HANDLERS
----------------------------------------------------------------
on expandTilde(pathStr)
if pathStr is "~" or pathStr is "~/" then
set pathStr to POSIX path of (path to home folder as text)
else if pathStr starts with "~/" then
set pathStr to (POSIX path of (path to home folder as text)) & text 3 thru -1 of pathStr
else
error "Bad path string!"
end if
end expandTilde
----------------------------------------------------------------
Thanks, Chris. I was just hunting around for just such an AppleScript this morning because the pause (which I moved around, duplicated and otherwise tried to spiderman) wasn't working reliably.
Increasing the pause resolved the issue temporarily but not definitively. And 'Pause Until' the OK button appeared didn't work at all but the OK is on a sheet.
Your solution is much faster than the macro I had been using that worked reliably with earlier versions of BBEdit. Scary faster. But I can adapt .