08-17-2017, 04:27 AM
Need more string processing.
Macro Menu of windows, with icons
Macro Menu of windows, with icons
;Shows dynamically created menu of currently open windows.
str titles
ARRAY(int) handles
GetWindowList &titles "" 1|2|4 0 0 handles
ARRAY(str) arr = titles
ARRAY(__Hicon) hicons.create(handles.len)
int i
for(i 0 arr.len)
,hicons[i]=GetWindowIcon(handles[i])
,str& r=arr[i]
,if(!r.len) r="<no name>"; continue
,r.findreplace("[9]" " ") ;;escape tab
,r.escape(1) ;;escape " etc
,if(r[0]!='[') r.replace(F"[{r[0]}]" 0 1) ;;escape first character. It can be a special character: space, tab, -, |, *.
,r.findreplace(":" "[91]58]") ;;escape :
,r.findreplace("&" "&&") ;;escape &
,r.formata(" : * %i" hicons[i])
titles=arr
int p=DynamicMenu(titles "" 1)
if(p) act handles[p-1]