Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Regarding the Mouse Information Output Bar
#1
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
#2
2. Right-click the splitter and check Bottom fixed.
#3
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.
#4
Can the hotkey for this function be customized, for example: Alt+F9?
Currently, I have been using Alt+F8 in QM for this function
#5
To capture the same info can be used Ctrl+Shift+Q.
I rarely use the Mouse panel, and never want to capture its text.

Code:
Copy      Help
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);
#6
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
#7
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.
#8
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

Code:
Copy      Help
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);
#9
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.  Smile
#10
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.
#11
Adds new panel. Edit the text formatting code to make 2 lines.

Code:
Copy      Help
// 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);
        //}

    }
}
#12
thank you!


Forum Jump:


Users browsing this thread: 2 Guest(s)