Add-on by gpt4 to change main windows' deck into a browser selected card's deck!

I have asked this Q for 1000+ times, In Browser I cant select a deck and "change" into it in the "deck" is it correct?
because i tend to stay in browser’s window to edit, and when press ctrl-E to add card, the working deck could be different from the main windows’ deck, and in browser you have NO WAY to let main window change into the deck you are working in the browser!

but thank God Americans, there is GPT4, for a single Q and a single reply, it wrote a python code to do that.
but the way it told to install is wrong, it say just copy the .py into the addon’s folder.

then i open my browser and read the website, found that there is a demo of addon using
this demo worked.

then I simply copy gpt4’s code into such files.

YES, it ran! it worked!

I am a complete 0% newbie to anki addon writing.

i dont know how to publish it and make codes for download whatever.


i am going to:

  1. post the main prompt and reply between me and gpt4
  2. post the code here
  3. later, may be very later, i’ll make it available in the normal way.

thank you.

ps: i tried on a blank new portable anki 2.1.54 qt6 on win10, it works.

1 problem:

the deck in the browser MUST have existing cards,
gpt4 say it could only know the deck by obtaining a selected card’s deck.

and for simplicity, this new command is under the “edit” in menu.
this is my “first time”, so adding a menu command is much easier than making a right click menu function.

i am ok /w the menu command.

yet if have time, i am sure gpt4 could move it into the click menu.

btw, i try gpt4 for this today because gpt4 helped me made a complete GUI launcher from autohotkey.

gpt4 is a tool, to use, not to play with.

ps, since there is already a “change deck” build in,

i asked gpt4 to rename it “switch to deck”:

(code deleted)

just edit line 21 into what you wish.

I"ll myself call it SwitchMainWinDeck

i cant believe no one interested,
i have used it for a period,
and when preparing the note/cards, i now dont need to leave the browser. (unless you add/move the deck or the deck is empty)
i have modified it somehow since,
i’ll put it onto github.
but i am not gonna go thru the “make into addon and let you dnld as a number” sequences as i think it will take more time than to just put into the addon folder.
it will be dual licensed so people who interested could use the open source license to improve it.