Posts: 1,031
Threads: 246
Joined: Jul 2022
Suggestion 1: Maintain consistency with QM's display. It would be more appropriate to divide the information into two lines as shown below, because the current position is not fixed and it is inconvenient to locate.
Mouse ......... in windows ......... Control id ......... cn ......... name .........
Program ......... Window ......... cn .........
Suggestion 2: Keep the height of the mouse information bar unchanged when adjusting the frame height, as shown in the image below.
https://i.ibb.co/zbmmxJn/A.gif
Posts: 12,073
Threads: 140
Joined: Dec 2002
2. Right-click the splitter and check Bottom fixed.
Posts: 1,031
Threads: 246
Joined: Jul 2022
07-06-2024, 05:14 AM
(This post was last modified: 07-06-2024, 05:34 AM by Davider.)
thank you!
It would be great if the panel layout could be saved or switched. For example, it could also switch to the layout style of QM as shown in the image below.
https://www.quickmacros.com/forum/showth...p?tid=7639
QM layout style:
https://i.ibb.co/hYTXM9f/A.png
How can I display the text from the mouse info bar into the input field(like QM Alt+F8)? I’ve tried before but haven’t had any luck.
Posts: 1,031
Threads: 246
Joined: Jul 2022
08-06-2024, 11:56 AM
(This post was last modified: 08-06-2024, 11:57 AM by Davider.)
Can the hotkey for this function be customized, for example: Alt+F9?
Currently, I have been using Alt+F8 in QM for this function
Posts: 12,073
Threads: 140
Joined: Dec 2002
To capture the same info can be used Ctrl+Shift+Q.
I rarely use the Mouse panel, and never want to capture its text.
var w1 = ScriptEditor.MainWindow();
if (!w1.IsVisible) return;
var e1 = w1.Elm["TEXT", "Mouse_info", "class=Scintilla"].Find();
if (e1 is null) return;
var text = e1.Value;
print.it(text);
Posts: 1,031
Threads: 246
Joined: Jul 2022
In most cases, displaying two lines of text is sufficient to show all the information, similar to the display in QM. When the text is not fully visible, you can use the hotkey Alt+F8 to display it in the output panel. The single-line text display, compared to QM's display, is not as intuitive
Posts: 1,031
Threads: 246
Joined: Jul 2022
08-07-2024, 12:26 AM
(This post was last modified: 08-07-2024, 12:44 AM by Davider.)
Quote:I rarely use the Mouse panel, and never want to capture its text.
I'm not using the panel very frequently, but it's essential. Sometimes, I use it to integrate certain information with third-party software.
Using the above code #5,
if the output is a single line of text, the information isn't very intuitive. It seems more appropriate to output two or three lines.
Additionally, after formatting the code, no indentation was added, as shown in the image below.
https://i.ibb.co/Dp7yRsr/A.gif
How display text in the output bar with the same bold effect as in the mouse info bar? This would make the visual effect more intuitive.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Instead of getting text from the Mouse panel, copy function _MouseInfo from its source code. Remove or replace some lines.
https://github.com/qgindi/LibreAutomate/...elMouse.cs
var p = mouse.xy;
var c = wnd.fromXY(p);
var w = c.Window;
string wName = w.Name;
string lineSep = "\r\n";
int limit = 10000;
var b = new StringBuilder("<>");
var cn = w.ClassName;
if (cn != null) {
var pc = p; w.MapScreenToClient(ref pc);
b.AppendFormat("<b>Mouse</b> {0,5} {1,5} . <b>in window</b> {2,5} {3,5} .. <b>Program</b> {4}",
p.x, p.y, pc.x, pc.y, w.ProgramName?.Escape(limit));
if (c.UacAccessDenied) b.Append(" <c red>(admin)<>");
b.AppendFormat("{0}<b>Window ", lineSep);
var name = wName?.Escape(limit); if (!name.NE()) b.AppendFormat("</b>{0} . <b>", name);
b.Append("cn</b> ").Append(cn.Escape(limit));
if (c != w) {
b.AppendFormat("{0}<b>Control id</b> {1} . <b>cn</b> {2}",
lineSep, c.ControlId, c.ClassName?.Escape(limit));
var ct = c.Name;
if (!ct.NE()) b.Append(" . <b>name</b> ").Append(ct.Escape(limit));
} else if (cn == "#32768") {
var m = MenuItemInfo.FromXY(p, w, 50);
if (m != null) {
b.AppendFormat("{0}<b>Menu id</b> {1}", lineSep, m.ItemId);
if (m.IsSystem) b.Append(" (system)");
//print.it(m.GetText(true, true));
}
}
//rejected. Makes this func 5 times slower.
//var color = CaptureScreen.Pixel(p);
}
var s = b.ToString();
print.it(s);
Posts: 1,031
Threads: 246
Joined: Jul 2022
08-07-2024, 05:01 AM
(This post was last modified: 08-07-2024, 05:02 AM by Davider.)
I'm very grateful for your sharing.
Sorry, I didn't clearly describe my needs. I actually want the output bar to display the text style shown in the image when the Alt+F7 hotkey is pressed.
https://i.ibb.co/pywpQ1N/S.jpg
However, when displaying text in the mouse info panel, three lines are too tall, one line is too short, and two lines are just right (like QM).
P.S.: I haven't installed VS. Can I use LA to compile LA's source code? I want to try modifying the mouse panel's code and then recompiling.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Add Alt+F7 trigger and move the code to the trigger action.
Quote:I haven't installed VS. Can I use LA to compile LA's source code?
Yes, but probably it isn't the best way.
You can create a new panel, like in the Cookbook article "Editor extension - modify UI". And display any text etc in it.
But I don't think the Mouse panel is so useful to be visible all the time. Let it live as a tab, hidden most of the time, which is the default. Then there is no problem with 3 lines.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Adds new panel. Edit the text formatting code to make 2 lines.
// script "Editor extension - modify UI.cs"
/*/
role editorExtension;
testInternal Au.Editor;
r Au.Editor.dll;
r Au.Controls.dll;
/*/
using Au.Controls;
using System.Windows;
using System.Windows.Controls;
EditorExtension.WindowLoaded += () => _Load();
static void _Load() {
// Add panel.
const string epName = "Mouse2";
var ep = Panels.PanelManager[epName];
if (ep == null) {
ep = Panels.PanelManager.AddNewExtension(false, epName);
}
var panel = new PanelMouse2();
ep.Content = panel.P;
}
class PanelMouse2 {
KScintilla _sci;
POINT _prevXY;
wnd _prevWnd;
string _prevWndName;
int _prevCounter;
public PanelMouse2() {
//P.UiaSetName("Mouse panel"); //no UIA element for Panel
_sci = new KScintilla_(this) { Name = "Mouse_info2" };
P.Children.Add(_sci);
}
public Grid P { get; } = new();
void _MouseInfo() {
//using var p1 = perf.local();
if (!P.IsVisible) return;
var p = mouse.xy;
if (p == _prevXY && ++_prevCounter < 4) return; _prevCounter = 0; //use less CPU. c and wName rarely change when same p.
var c = wnd.fromXY(p);
//p1.Next();
var w = c.Window;
string wName = w.Name;
if (p == _prevXY && c == _prevWnd && wName == _prevWndName) return;
_prevXY = p;
_prevWnd = c;
_prevWndName = wName;
string lineSep = App.Settings.mouse_singleLine ? " .. " : "\r\n";
int limit = Math.Clamp(App.Settings.mouse_limitText, 20, 10000);
//p1.Next();
var b = new StringBuilder();
var cn = w.ClassName;
if (cn != null) {
//TODO: edit this code to make 2 lines.
var pc = p; w.MapScreenToClient(ref pc);
b.AppendFormat("<b>Mouse</b> {0,5} {1,5} . <b>in window</b> {2,5} {3,5} .. <b>Program</b> {4}",
p.x, p.y, pc.x, pc.y, w.ProgramName?.Escape(limit));
if (c.UacAccessDenied) b.Append(" <c red>(admin)<>");
b.AppendFormat("{0}<b>Window ", lineSep);
var name = wName?.Escape(limit); if (!name.NE()) b.AppendFormat("</b>{0} . <b>", name);
b.Append("cn</b> ").Append(cn.Escape(limit));
if (c != w) {
b.AppendFormat("{0}<b>Control id</b> {1} . <b>cn</b> {2}",
lineSep, c.ControlId, c.ClassName?.Escape(limit));
var ct = c.Name;
if (!ct.NE()) b.Append(" . <b>name</b> ").Append(ct.Escape(limit));
} else if (cn == "#32768") {
var m = MenuItemInfo.FromXY(p, w, 50);
if (m != null) {
b.AppendFormat("{0}<b>Menu id</b> {1}", lineSep, m.ItemId);
if (m.IsSystem) b.Append(" (system)");
//print.it(m.GetText(true, true));
}
}
//rejected. Makes this func 5 times slower.
//var color = CaptureScreen.Pixel(p);
}
var s = b.ToString();
//p1.Next();
_sci.aaaSetText(s);
}
//public void SetMouseInfoText(string text)
//{
// if(Dispatcher.Thread == Thread.CurrentThread) _SetMouseInfoText(text);
// else Dispatcher.InvokeAsync(() => _SetMouseInfoText(text));
//
// void _SetMouseInfoText(string text) { _sci.aaaSetText(text); }
//}
internal class KScintilla_ : KScintilla {
PanelMouse2 _p;
internal KScintilla_(PanelMouse2 panel) {
_p = panel;
AaInitReadOnlyAlways = true;
AaInitTagsStyle = KScintilla.AaTagsStyle.AutoAlways;
}
protected override void AaOnHandleCreated() {
aaaStyleBackColor(Sci.STYLE_DEFAULT, 0xF0F0F0);
aaaStyleFont(Sci.STYLE_DEFAULT, App.Wmain);
aaaMarginSetWidth(1, 4);
aaaStyleClearAll();
Call(Sci.SCI_SETHSCROLLBAR);
Call(Sci.SCI_SETVSCROLLBAR);
Call(Sci.SCI_SETWRAPMODE, Sci.SC_WRAP_WORD);
App.Timer025sWhenVisible += _p._MouseInfo;
}
//protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) {
// //WndUtil.PrintMsg(out var s, default, msg, wParam, lParam); print.qm2.write(s);
// switch (msg) {
// //case Api.WM_CONTEXTMENU:
// // var m = new popupMenu();
// // m.AddCheck("Single line", App.Settings.mouse_singleLine, o => { App.Settings.mouse_singleLine = o.IsChecked; });
// // m["Text length..."] = o => { if (dialog.showInputNumber(out int i, "Mouse panel", "Maximal length of name, cn and program strings.", editText: App.Settings.mouse_limitText, owner: Handle)) App.Settings.mouse_limitText = i > 0 ? i : 100; };
// // m.Show(owner: Handle);
// // return default;
// }
// return base.WndProc(hwnd, msg, wParam, lParam, ref handled);
//}
}
}
Posts: 1,031
Threads: 246
Joined: Jul 2022
|