Thank you!! i was now able to compile successfully after using the new library that you gave and then win + n menu doesn't show up at all.
attached Code , json.ahk and actual json
{
"Mainmenu1": {
"What is the Queston 1": [
"The answer can be anything -it --rm aks-ssh --especially blah <> --image"
],
"can you type this": [
"yes i can type \"anything\" you want me to",
"i can also write anything that is gibberish"
],
"Good Morning": [
"very good morning",
"morning is ok -- with so many ideas like , :' and also anything ",
"Thank you"
]
},
"Mainmenu2": {
"Random Query": [
"Some random command -it --rm --image=randomimage:latest"
],
"Lorem Ipsum": [
"Lorem ipsum dolor sit amet, consectetur adipiscing elit",
"Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"
],
"Gibberish Text": [
"Flibber flabber blibber blabber",
"Blah blah blah -- with symbols like @#$%&*()!",
"Thank you for using gibberish"
]
}
}
attached Code , json.ahk and actual json
CODE:
#include C:\hotkey\json.ahk
; Read the JSON file
jsonContent := FileRead("C:\hotkey\myjson1.json")
; Parse the JSON content
jsonObj := JSON.Load(jsonContent)
m := Menu()
objToMenu(jsonObj, m)
objToMenu(obj, menuObj?) {
if !IsSet(menuObj)
menuObj := Menu()
for itemName, menuItem in (obj is Array ? obj : obj.OwnProps()) {
if IsObject(menuItem) {
menuObj.Add(itemName, objToMenu(menuItem))
} else {
menuObj.Add(menuItem, MenuHandler)
}
}
return menuObj
MenuHandler(item, *) {
A_Clipboard := item
Send('^v')
}
}
; Hotkey to show the menu
#n::m.Show() ; i.e. press the Win-N hotkey to show the menu.
{
"Mainmenu1": {
"What is the Queston 1": [
"The answer can be anything -it --rm aks-ssh --especially blah <> --image"
],
"can you type this": [
"yes i can type \"anything\" you want me to",
"i can also write anything that is gibberish"
],
"Good Morning": [
"very good morning",
"morning is ok -- with so many ideas like , :' and also anything ",
"Thank you"
]
},
"Mainmenu2": {
"Random Query": [
"Some random command -it --rm --image=randomimage:latest"
],
"Lorem Ipsum": [
"Lorem ipsum dolor sit amet, consectetur adipiscing elit",
"Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua"
],
"Gibberish Text": [
"Flibber flabber blibber blabber",
"Blah blah blah -- with symbols like @#$%&*()!",
"Thank you for using gibberish"
]
}
}
Statistics: Posted by sanneedshelp — 56 minutes ago