Nodes/ComfyUI-AngelosKar/πŸ“‚ AK Folder Path Picker
ComfyUI Node

πŸ“‚ AK Folder Path Picker

Stop typing Windows paths into a ComfyUI text field

By AngelosKar-codeΒ·Created 3 days agoΒ·Updated about 19 hours agoΒ· 0
πŸ“‚ AK Folder Path Picker
    • folder_path
    β—„folder_pathC:\β–Ί

    Every batch workflow in this pack starts with the same chore: telling it where the images are. Type the path by hand and you get to enjoy a canvas text widget where a single wrong backslash means "No images found in: D:\shots\raww". AK Folder Path Picker is the small fix - one string widget, one string output, and a πŸ“‚ Browse Folder button that opens the real Windows Explorer folder dialog and pastes the answer in for you.

    How it works

    The node's Python class is trivial: it takes folder_path, returns folder_path. The interesting part is the server route behind the button. The pack registers /angeloskar/choose_folder on ComfyUI's aiohttp server; the node's frontend widget POSTs to it, and the Python handler calls the Win32 IFileOpenDialog COM interface directly through ctypes - no tkinter, no third-party dialog package, nothing added to your environment. It sets the FOS_PICKFOLDERS flag, so you can only pick directories, and it creates a hidden topmost owner window before showing the dialog, which is the trick that stops the picker opening behind your browser instead of in front of it. When you confirm, the path travels back to the browser and overwrites the widget; if you cancel, the JS leaves the existing value untouched.

    It's worth knowing what this route does not do: it takes no path argument and returns only what a human clicked in a native dialog. There's no way to use it to walk a remote machine's filesystem from the web UI.

    The one caveat that matters

    It's Windows-only, and the dialog opens on the machine running ComfyUI. The handler returns an empty string immediately if sys.platform != "win32", so on Linux, macOS, or a Docker container you'll click the button and get nothing at all. And because the dialog is spawned by the server process, a headless box or a rented GPU pod gives you the same nothing - the dialog would be opening on a desktop you can't see.

    So: local Windows install, this node is a genuine convenience. Anything else, type the path yourself. It's a fair trade for a utility, and the Linux answer (a browser-side folder browser) is a much bigger piece of code with its own security story.

    Inputs and outputs

    folder_path (STRING, default C:\) and one output, folder_path (STRING). That's the whole node. It'll wire into anything expecting a folder path as a string - the AK schedulers and the AK Image List Loader all declare their path input as a string socket. For nodes whose path is a plain widget rather than a socket, right-click the widget and use Convert widget to input first, then wire this node in; that gesture is the general way you turn any baked-in value into something a wire can drive.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/AngelosKar-code/ComfyUI-AngelosKar.git
    # restart ComfyUI
    

    Or ComfyUI Manager β†’ search ComfyUI-AngelosKar β†’ Install β†’ restart. Dependencies are torch, numpy, Pillow, aiohttp - nothing you don't already have, though the pack does register server routes on startup, so a Python-side error in any of its modules prints a warning in the console. Python 3.10+.

    Troubleshooting

    Button missing. The pack ships its UI as a frontend extension in js/. Restart ComfyUI and hard-refresh the browser (Ctrl-F5); a cached app.js hides the button while the node itself still loads fine.

    Click does nothing on Linux/macOS. Expected - see above. Type the path.

    The dialog opens behind other windows, or doesn't appear at all. The topmost-owner trick fails in a few window configurations, and the handler joins its worker thread with a 120-second timeout, so a dialog you never found ends up returning an empty path. Alt-tab around before you assume it's broken.

    Nothing happened after you picked a folder. Check the folder widget on the node - the picked path replaces whatever was there, so if it looks unchanged, the dialog was cancelled or the request failed, and the browser console will have the error.

    CategoryAngelosKar/Utils

    Inputs (1)

    NameTypeDefaultDescription
    folder_pathSTRINGC:\β€”

    Outputs (1)

    NameTypeDescription
    folder_pathSTRINGβ€”