Nodes/ComfyUI-JakeUpgrade/Shot Script Extractor JK๐Ÿ‰
ComfyUI Node

Shot Script Extractor JK๐Ÿ‰

Grab one shot out of a script list without breaking the rest of the graph

By jakechaiยทCreated 2 years agoยทUpdated 3 months agoยท 147
Shot Script Extractor JK๐Ÿ‰
    • element
    • element_counts
    • status
    โ—„string_inputsโ–บ
    โ—„key_or_index1โ–บ
    โ—„input_typestring_listโ–บ

    Shot Script Combiner gives you all the shots; Shot Script Extractor gives you one. It plucks a single element out of a shot list - by position, or by key if you're working with a dict - and hands you the element, a count of how many elements there were, and a status string saying what it did. It's the node you reach for when a workflow needs shot 3 specifically, or when you want to re-generate just one shot instead of the whole sequence.

    It's the more flexible of the two: where the Combiner forces everything into a list, the Extractor understands four input shapes and lets you pick which one you're feeding.

    The inputs

    • string_inputs - the shot script, in whatever form you have it.
    • key_or_index (default "1") - a key name if the input is a dict, or a position if it's a list/array/multiline. Negative indexing works: -1 is the last shot, which is genuinely useful when you only want to regenerate the final shot of a sequence.
    • input_type - tells the node what it's looking at: string_list, dict_string, array_string, or multilines. Dict strings get key-based lookup; everything else gets index-based.

    The three outputs

    • element (STRING) - the extracted shot prompt.
    • element_counts (INT) - how many elements the input contained, handy as a sanity check or to drive a loop bound.
    • status (STRING) - a human-readable note like Element 3 of 6 or Key 'subject' found. When something's wrong, this is where you'll see it, e.g. Key not found. Available keys: ... or Index out of range (1-6).

    On out-of-range indexes in string-list mode it doesn't fail hard - it returns the last element and tells you so in status. Dict lookup tries an exact key match, then a case-insensitive one, then a numeric fallback, which covers the shot01 vs shot1 vs 1 mess that LLMs love to produce.

    Install

    In the JakeUpgrade pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
    cd ComfyUI-JakeUpgrade
    pip install -r requirements.txt   # Windows standalone: install.bat
    

    Or ComfyUI Manager โ†’ "JakeUpgrade". No models.

    Where people get burned

    The node is input-is-list, so if you wire it to a true list output it processes each entry - fine, but worth knowing before you wonder why status fires multiple times. And the index field is a string, not an int, because it doubles as a dict key; typing "3" works for a list, but a stray space will fail to parse and you'll get an "Invalid index" status. When in doubt, read the status output - it's the whole point of the node having it. If you're extracting just to re-feed one shot into an image sampler, pair it with a Shot Script Combiner output and you can move shots around a graph without ever copying text by hand.

    Category๐Ÿ‰ JK/๐Ÿ Prompt

    Inputs (3)

    NameTypeDefaultDescription
    string_inputsSTRINGShot script JSON or string list to extract from
    key_or_indexSTRING1Key name for dict_string, index for other types (supports negative indexing)
    input_typeCOMBOstring_listInput type: string_list, dict_string, array_string, or multilines

    Outputs (3)

    NameTypeDescription
    elementSTRINGโ€”
    element_countsINTโ€”
    statusSTRINGโ€”