Skip to content

Instantly share code, notes, and snippets.

@scripting
Last active November 10, 2023 00:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scripting/36bec44af6892abb870c5fa798bf7431 to your computer and use it in GitHub Desktop.
Save scripting/36bec44af6892abb870c5fa798bf7431 to your computer and use it in GitHub Desktop.
on letsWatchThatStinkingFolder () {
«Changes
«3/7/23; 11:55:58 AM by DW
«Created.
local (prefix = "chat-gpt-");
local (sourcefolder = "Macintosh HD:Users:davewiner:Downloads:");
local (destfolder = user.prefs.publicfolder + "chatgpt:");
fileloop (f in sourcefolder) {
local (fname = file.filefrompath (f));
if fname beginswith prefix {
local (filetext = file.readwholefile (f));
local (relpath = file.getdatepath () + string.delete (fname, 1, sizeof (prefix)));
local (url = "http://scripting.com/publicfolder/chatgpt/" + string.replaceall (relpath, ":", "/"));
local (fdest = destfolder + relpath);
file.surefilepath (fdest);
file.writewholefile (fdest, filetext);
clock.waitseconds (3);
webbrowser.openurl (url);
file.delete (f)
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment