08-17-2017, 01:36 AM
I have 3 problems (propably related to eachother?)
Macro Menu of windows, with icons
The above code is from the archive.
Problem 1
The : is not correctly replaced (or this was done purposely?)
Should this line
be like this (?):
It then replaces the : properly.
But the problem is, when I modify it like above then when selecting a window that has a path (eg. c:\test) in the window title, then I get an error.
"Windows can not find..."
After you press "Ok" on the error pop-up it properly activates the correct window.
I think it has to do with
Problem 2
Another problem is with windows titles that begin with a *
Example, in notepad++ you can set the window title to show path.
When you edit an document, notepad++ adds a * in the window title (in the beginning) to indicate the document has been changed.
Example, you end up with the following in the title:
* c:\test.txt
When you run the above example script, the popup contains greyed out items which has those troublesome window titles (example: * c:\test.txt).
(Question) Possible problem 3
Do pipes in windows titles also cause problems with this script?
When I leave the script like above, problem 1 is resolved. Problem 2 persists.
Macro Menu of windows, with icons
;Shows dynamically created menu of currently open windows.
str titles exe ico
ARRAY(int) handles
GetWindowList &titles "" 1|2|4 0 0 handles
ARRAY(str) arr = titles
ARRAY(int) hicons.create(handles.len)
int i
for(i 0 arr.len)
,hicons[i]=GetWindowIcon(handles[i])
,arr[i].findreplace(":" "[91[58]") ;;escape :
,arr[i].escape(1) ;;escape "
,arr[i].formata(" : * %i" hicons[i])
,
titles=arr
int p=DynamicMenu(titles "" 1)
for(i 0 arr.len) DestroyIcon(hicons[i])
if(p)act handles[p-1]
The above code is from the archive.
Problem 1
The : is not correctly replaced (or this was done purposely?)
Should this line
be like this (?):
It then replaces the : properly.
But the problem is, when I modify it like above then when selecting a window that has a path (eg. c:\test) in the window title, then I get an error.
"Windows can not find..."
After you press "Ok" on the error pop-up it properly activates the correct window.
I think it has to do with
Problem 2
Another problem is with windows titles that begin with a *
Example, in notepad++ you can set the window title to show path.
When you edit an document, notepad++ adds a * in the window title (in the beginning) to indicate the document has been changed.
Example, you end up with the following in the title:
* c:\test.txt
When you run the above example script, the popup contains greyed out items which has those troublesome window titles (example: * c:\test.txt).
(Question) Possible problem 3
Do pipes in windows titles also cause problems with this script?
When I leave the script like above, problem 1 is resolved. Problem 2 persists.