bikenik / alfred-anki

Create New Cards into any decks with any "Note Type".
MIT License
45 stars 1 forks source link

The current value is not saved #7

Open sauron918 opened 4 years ago

sauron918 commented 4 years ago

I can't add a new card... After putting some text into "Front" or "Back" and press Enter, nothing is happening.

(1) image

(2) image [press Enter]

(3) image

Debug info:

[13:14:06.130] anki[Script Filter] Queuing argument ''
[13:14:06.886] anki[Script Filter] Script with argv '' finished
[13:14:06.887] anki[Script Filter] {
    "items": [
        {
            "title": "",
            "subtitle": "✏️ Front: ...",
            "text": {
                "largetype": ""
            },
            "icon": {
                "path": "./icons/Front.png"
            },
            "arg": "{\"Front\":\"\"}"
        }
    ]
}
[13:14:09.974] anki[Script Filter] Queuing argument 's'
[13:14:09.991] anki[Script Filter] Queuing argument 'so'
[13:14:10.165] anki[Script Filter] Queuing argument 'som'
[13:14:10.365] anki[Script Filter] Queuing argument 'some'
[13:14:10.533] anki[Script Filter] Queuing argument 'some '
[13:14:10.693] anki[Script Filter] Queuing argument 'some t'
[13:14:10.741] anki[Script Filter] Queuing argument 'some te'
[13:14:11.045] anki[Script Filter] Queuing argument 'some tex'
[13:14:11.133] anki[Script Filter] Queuing argument 'some text'
[13:14:11.900] anki[Script Filter] Script with argv 'some text' finished
[13:14:11.919] anki[Script Filter] {
    "items": [
        {
            "title": "some text",
            "subtitle": "✏️ Front: ...",
            "text": {
                "largetype": "some text"
            },
            "icon": {
                "path": "./icons/Front.png"
            },
            "arg": "{\"Front\":\"some text\"}"
        }
    ]
}
[13:14:13.214] anki[Script Filter] Processing complete
[13:14:13.237] anki[Script Filter] Passing output '{"Front":"some text"}' to Run Script
[13:14:13.239] anki[Script Filter] Passing output '{"Front":"some text"}' to Call External Trigger
[13:14:13.240] anki[External] Processing complete
[13:14:13.241] anki[External] Passing output '' to Script Filter
[13:14:13.242] anki[Script Filter] Queuing argument ''
[13:14:14.050] anki[Script Filter] Script with argv '' finished
[13:14:14.076] anki[Script Filter] {
    "items": [
        {
            "name": "intro",
            "title": "Create new card (⌘ + ↵)",
            "subtitle": "🧰 General    ⚒ Type    👤 sauron",
            "icon": {
                "path": "./icons/anki.png"
            },
            "autocomplete": "!deck default-deck ",
            "valid": false,
            "arg": "",
            "quicklookurl": "/Users/mac/Library/Application Support/Anki2/sauron/collection.media//_preview.html",
            "mods": {
                "alt": {
                    "subtitle": "❌ RESET",
                    "valid": true,
                    "variables": {
                        "action": "reset"
                    },
                    "arg": ""
                },
                "cmd": {
                    "valid": true,
                    "subtitle": "\t   Add New Card \t🎉",
                    "variables": {
                        "action": "make-new-card"
                    }
                }
            }
        },
        {
            "name": "Front",
            "valid": true,
            "sentence": "",
            "mods": {
                "ctrl": {
                    "subtitle": "toggle the option: remember last input",
                    "variables": {
                        "Front": "Front"
                    }
                },
                "cmd": {
                    "valid": true,
                    "subtitle": "\t   Add New Card \t🎉",
                    "variables": {
                        "action": "make-new-card"
                    }
                }
            },
            "title": "...",
            "autocomplete": "...",
            "subtitle": "Front",
            "arg": "",
            "quicklookurl": "/Users/mac/Library/Application Support/Anki2/sauron/collection.media//_preview.html",
            "icon": {
                "path": "./icons/Front.png"
            },
            "text": {
                "copy": "...\n\nFront",
                "largetype": "...\n\nFront"
            },
            "variables": {
                "mode": "Front",
                "action": "work",
                "currentText": ""
            }
        },
        {
            "name": "Back",
            "valid": true,
            "sentence": "",
            "mods": {
                "ctrl": {
                    "subtitle": "toggle the option: remember last input",
                    "variables": {
                        "Back": "Back"
                    }
                },
                "cmd": {
                    "valid": true,
                    "subtitle": "\t   Add New Card \t🎉",
                    "variables": {
                        "action": "make-new-card"
                    }
                }
            },
            "title": "...",
            "autocomplete": "...",
            "subtitle": "Back",
            "arg": "",
            "quicklookurl": "/Users/mac/Library/Application Support/Anki2/sauron/collection.media//_preview.html",
            "icon": {
                "path": "./icons/Back.png"
            },
            "text": {
                "copy": "...\n\nBack",
                "largetype": "...\n\nBack"
            },
            "variables": {
                "mode": "Back",
                "action": "work",
                "currentText": ""
            }
        },
        {
            "name": "Info",
            "valid": true,
            "sentence": "",
            "mods": {
                "ctrl": {
                    "subtitle": "toggle the option: remember last input",
                    "variables": {
                        "Info": "Info"
                    }
                },
                "cmd": {
                    "valid": true,
                    "subtitle": "\t   Add New Card \t🎉",
                    "variables": {
                        "action": "make-new-card"
                    }
                }
            },
            "title": "...",
            "autocomplete": "...",
            "subtitle": "Info",
            "arg": "",
            "quicklookurl": "/Users/mac/Library/Application Support/Anki2/sauron/collection.media//_preview.html",
            "icon": {
                "path": "./icons/flag.png"
            },
            "text": {
                "copy": "...\n\nInfo",
                "largetype": "...\n\nInfo"
            },
            "variables": {
                "mode": "Info",
                "action": "work",
                "currentText": ""
            }
        },
        {
            "name": "Tags",
            "valid": true,
            "sentence": "",
            "mods": {
                "ctrl": {
                    "subtitle": "toggle the option: remember last input",
                    "variables": {
                        "Tag": "Tag"
                    }
                },
                "cmd": {
                    "valid": true,
                    "subtitle": "\t   Add New Card \t🎉",
                    "variables": {
                        "action": "make-new-card"
                    }
                }
            },
            "title": "...",
            "autocomplete": "...",
            "subtitle": "Choose your tags",
            "arg": "",
            "quicklookurl": "/Users/mac/Library/Application Support/Anki2/sauron/collection.media//_preview.html",
            "icon": {
                "path": "./icons/tag.png"
            },
            "text": {
                "copy": "...\n\nChoose your tags",
                "largetype": "...\n\nChoose your tags"
            },
            "variables": {
                "mode": "Tags",
                "action": "work"
            }
        }
    ]
}

As you can see the currentText value is empty in result.

Environment: Anki Card Generator v.1.3.2 Anki Desktop for macOS v.2.1.15 (442df9d6) Qt 5.12.1 PyQt 5.11.3 macOS 10.14.6 (18G87)

sauron918 commented 4 years ago

Choosing of tag also doesn't work for me.

kerkerj commented 4 years ago

Hi @sauron918 I faced the same issue as you did, and I found a possible solution for this. I hope you can solve this as well. Below is how to solve this: Try to edit this file ~/Library/Application Support/Alfred/Workflow Data/org.bikenik.anki/header.json with {} (the original content of the file in my computer is []) Then try to use this workflow to add flashcards again, the value should be stored.

henrik-de commented 4 years ago

I already see curly brackets in the file so I can't change it to "[]". Any other idea what could be the problem? :/

BOBO-LU commented 2 years ago

I changed the [] to {} and it works. Thanks.