On Tue, Jun 01, 2010 at 06:11:28AM -0700, andrew mcintosh wrote: > I've tried Łukasz Michalik's suggestion---it does what I want, without > prompts. > > I looked at content_handlers before, and couldn't see anything there to help > me. I had hoped there would be a content_handler_save function that accepted > a default save location. I guess learning some more javascript would be > helpful! >
Oh I see.. you do want to completely automate it. Since my interest is piqued, following is how to do that with the content handler system and no external script. I think I will add this new function to Conkeror so that it will be available for everybody. If anybody else reading this thread has comments about this implementation, let me know and maybe we can make it better with tweaking. The second arg of content_handler_save_in is optional, and if present and true, the filename prompt is inhibited. The other point that this raises is that 'make_file' could be make more user-friendly if we added "~" notation for home directory. Currently, you have to provide the literal path. function content_handler_save_in (path, inhibit_prompt) { path = make_file(path); return function (ctx) { var file; var suggested_path = path.clone(); suggested_path.append(ctx.launcher.suggestedFileName); if (inhibit_prompt) file = suggested_path; else file = yield ctx.window.minibuffer.read_file_check_overwrite( $prompt = "Save to file:", $initial_value = suggested_path.path, $select); register_download(ctx.buffer, ctx.launcher.source); ctx.launcher.saveToDisk(file, false); }; } content_handlers.set("application/pdf", content_handler_save_in("/home/me/doc/", true)); -- John Foerch _______________________________________________ Conkeror mailing list Conkeror@mozdev.org https://www.mozdev.org/mailman/listinfo/conkeror