Adding to a built in popup submenu
gsb
I wrote a little code to put the rgb "colorString" (as in modifygraph rgb=[colorString]) of a trace on the clipboard (in the same manner as right clicking a trace to put its full path on the clipboard, etc.). I had expected my submenu option to be in the "Copy" submenu, but it instead creates a second "Copy" submenu in the trace popup. Is there a way to put it in the built-in submenu? Thanks in advance!
Menu "TracePopup"
Submenu "Copy"
"ModifyGraph RGB(A)", /Q, traceColorToClip()
end
End
Function traceColorToClip()
GetLastUserMenuInfo
String info = traceinfo(S_graphname,S_tracename,0)
String easyInfo = "dummy~" + replacestring("RECREATION:",info,"|RECREATION~",1) + "|"
String recreation = Stringbykey("RECREATION",easyInfo,"~","|",1) //recreation is the last key, so put in a nonsense sepStr to get the entirety of the string from RECREATION: on
String rgb = StringByKey("rgb(x)", recreation,"=")
putscraptext rgb
End
Submenu "Copy"
"ModifyGraph RGB(A)", /Q, traceColorToClip()
end
End
Function traceColorToClip()
GetLastUserMenuInfo
String info = traceinfo(S_graphname,S_tracename,0)
String easyInfo = "dummy~" + replacestring("RECREATION:",info,"|RECREATION~",1) + "|"
String recreation = Stringbykey("RECREATION",easyInfo,"~","|",1) //recreation is the last key, so put in a nonsense sepStr to get the entirety of the string from RECREATION: on
String rgb = StringByKey("rgb(x)", recreation,"=")
putscraptext rgb
End
To make my question a little more concrete, here's a picture of the trace popup menu the code above produces. There are two "Copy" submenus. I'd like to combine them into one (retaining all the built-in submenu items).
July 16, 2019 at 09:20 am - Permalink
Appending user menu items to the TracePopup's Copy submenu is not possible in the current version(s) of Igor, sorry.
July 16, 2019 at 10:31 am - Permalink
In reply to Appending user menu items to… by JimProuty
I see. Good to know. Thanks for the reply!
July 16, 2019 at 10:48 am - Permalink