<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[LA/QM forum - Help (QM)]]></title>
		<link>https://www.libreautomate.com/forum/</link>
		<description><![CDATA[LA/QM forum - https://www.libreautomate.com/forum]]></description>
		<pubDate>Mon, 27 Apr 2026 05:58:53 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Get the main window handle by PID]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7935</link>
			<pubDate>Mon, 02 Mar 2026 10:35:59 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1516">Davider</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7935</guid>
			<description><![CDATA[I would like to obtain the main window handle using a PID. Is there a simple way to achieve this in QM?<br />
The following code does not work.<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">T</span> <span/><br />
 <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='t'>int</span> i<span class='o'>=</span><span class='n'>4696</span><br />
<span class='fq'>out</span> <span class='fq'>win</span><span class='p'>(</span><span class='s'>""</span> <span class='s'>""</span> <span class='s'>""</span> <span class='n'>0</span> <span class='o'>F</span><span class='s'>"threadId={</span>i<span class='s'>}"</span><span class='p'>)</span></code></div></div> <br />
PowerShell implementation code: <br />
<blockquote class="mycode_quote"><cite>Quote:</cite>(Get-Process -Id 4696).MainWindowHandle</blockquote>
]]></description>
			<content:encoded><![CDATA[I would like to obtain the main window handle using a PID. Is there a simple way to achieve this in QM?<br />
The following code does not work.<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">T</span> <span/><br />
 <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='t'>int</span> i<span class='o'>=</span><span class='n'>4696</span><br />
<span class='fq'>out</span> <span class='fq'>win</span><span class='p'>(</span><span class='s'>""</span> <span class='s'>""</span> <span class='s'>""</span> <span class='n'>0</span> <span class='o'>F</span><span class='s'>"threadId={</span>i<span class='s'>}"</span><span class='p'>)</span></code></div></div> <br />
PowerShell implementation code: <br />
<blockquote class="mycode_quote"><cite>Quote:</cite>(Get-Process -Id 4696).MainWindowHandle</blockquote>
]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[_s.beg("_")]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7933</link>
			<pubDate>Sun, 01 Mar 2026 13:32:40 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1516">Davider</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7933</guid>
			<description><![CDATA[Why does the following code return 0?<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">Macro51</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>_s<span class='o'>=</span><span class='s'>"_54001"</span><span class='p'>;</span> <span class='fq'>out</span> _s.<span class='fq'>beg</span><span class='p'>(</span><span class='s'>"﻿_"</span><span class='p'>)</span></code></div></div>]]></description>
			<content:encoded><![CDATA[Why does the following code return 0?<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">Macro51</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>_s<span class='o'>=</span><span class='s'>"_54001"</span><span class='p'>;</span> <span class='fq'>out</span> _s.<span class='fq'>beg</span><span class='p'>(</span><span class='s'>"﻿_"</span><span class='p'>)</span></code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Long press trigger]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7929</link>
			<pubDate>Sat, 31 Jan 2026 11:27:26 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=152">don_AC64</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7929</guid>
			<description><![CDATA[Is it possible to set a long press key as a trigger? For example, I would like a macro to be executed only if I keep the "a" key pressed for one second or more.]]></description>
			<content:encoded><![CDATA[Is it possible to set a long press key as a trigger? For example, I would like a macro to be executed only if I keep the "a" key pressed for one second or more.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[ap._getactive not working anymore]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7877</link>
			<pubDate>Sun, 28 Sep 2025 11:51:06 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=102">artuur9</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7877</guid>
			<description><![CDATA[I have a macro that connects to powerpoint, first lines are:<br />
<br />
Function <span style="font-weight: bold;" class="mycode_b">pp_run_macro_direct</span> <span/><br />
 <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='c'>;/exe 1</span><br />
<br />
<span class='fq'>typelib</span> PowerPoint <span class='s'>"&#36;program files&#36;&#92;Microsoft Office&#92;Office15&#92;MSPPT.OLB"</span><br />
PowerPoint.Application ap._getactive<span class='p'>;</span> <span class='fq'>err</span> <span class='fq'>end</span> <span class='s'>"failed to connect to PowerPoint. Try to run this macro in separate process as User."</span></code></div></div><br />
<br />
It used to work on my old laptop with windows 10. On my new laptop with windows 11 the macro compiles fine, and the exe is created, but running it triggers the 'failed to connect to powerpoint' message (and powerpoint is running). The typelib line does point to the right OLB file (it is powerpoint 2013). <br />
<br />
How can I find out what the problem is?]]></description>
			<content:encoded><![CDATA[I have a macro that connects to powerpoint, first lines are:<br />
<br />
Function <span style="font-weight: bold;" class="mycode_b">pp_run_macro_direct</span> <span/><br />
 <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='c'>;/exe 1</span><br />
<br />
<span class='fq'>typelib</span> PowerPoint <span class='s'>"&#36;program files&#36;&#92;Microsoft Office&#92;Office15&#92;MSPPT.OLB"</span><br />
PowerPoint.Application ap._getactive<span class='p'>;</span> <span class='fq'>err</span> <span class='fq'>end</span> <span class='s'>"failed to connect to PowerPoint. Try to run this macro in separate process as User."</span></code></div></div><br />
<br />
It used to work on my old laptop with windows 10. On my new laptop with windows 11 the macro compiles fine, and the exe is created, but running it triggers the 'failed to connect to powerpoint' message (and powerpoint is running). The typelib line does point to the right OLB file (it is powerpoint 2013). <br />
<br />
How can I find out what the problem is?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[processing keystrokes without missing any]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7871</link>
			<pubDate>Wed, 10 Sep 2025 19:30:20 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=102">artuur9</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7871</guid>
			<description><![CDATA[I have a macro that performs an incremental search in a predefined list. It starts like this:<br />
<br />
<br />
rep<br />
    int vk=wait(5 KF)<br />
    ;;processing of pressed key (adding it to the search string, finding the search string in predefined list, <br />
    ;;displaying the found items via onscreendisplay, etc.<br />
    <br />
<br />
The macro works, but the problem is that when the user types too fast, not all pressed keys are registered by the vk=wait(5 KF) instruction, probably because the processing part takes longer than it takes for a fast typist to type the next keystroke. <br />
<br />
How can I prevent this and make sure all keys pressed by the user are registered?]]></description>
			<content:encoded><![CDATA[I have a macro that performs an incremental search in a predefined list. It starts like this:<br />
<br />
<br />
rep<br />
    int vk=wait(5 KF)<br />
    ;;processing of pressed key (adding it to the search string, finding the search string in predefined list, <br />
    ;;displaying the found items via onscreendisplay, etc.<br />
    <br />
<br />
The macro works, but the problem is that when the user types too fast, not all pressed keys are registered by the vk=wait(5 KF) instruction, probably because the processing part takes longer than it takes for a fast typist to type the next keystroke. <br />
<br />
How can I prevent this and make sure all keys pressed by the user are registered?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Adobe Extend Script Toolkit Help]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7864</link>
			<pubDate>Sun, 31 Aug 2025 21:58:10 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=738">pctechtv</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7864</guid>
			<description><![CDATA[To use this with a *.jsx file you have to stop at VSCode every time. Is there any way to connect to this via Quick Macros and send the debug code to the “hostAppSpecifier” of choice directly? This way It can be fully automated.<br />
<br />
<a href="https://marketplace.visualstudio.com/items?itemName=Adobe.extendscript-debug" target="_blank" rel="noopener" class="mycode_url">https://marketplace.visualstudio.com/ite...ript-debug</a><br />
<br />
Thanks]]></description>
			<content:encoded><![CDATA[To use this with a *.jsx file you have to stop at VSCode every time. Is there any way to connect to this via Quick Macros and send the debug code to the “hostAppSpecifier” of choice directly? This way It can be fully automated.<br />
<br />
<a href="https://marketplace.visualstudio.com/items?itemName=Adobe.extendscript-debug" target="_blank" rel="noopener" class="mycode_url">https://marketplace.visualstudio.com/ite...ript-debug</a><br />
<br />
Thanks]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[multiple string and variable replacements]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7862</link>
			<pubDate>Wed, 27 Aug 2025 23:52:48 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1516">Davider</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7862</guid>
			<description><![CDATA[I would like to implement multiple string and variable replacements using a custom member function <span style="font-weight: bold;" class="mycode_b">str.findreplaces</span>. Is this possible?<br />
I noticed that the member function <span style="font-weight: bold;" class="mycode_b">str.fromn</span> has similar characteristics.<br />
Thanks in advance for any suggestions and help!<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">Macro38</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='t'>str</span> ss<span class='o'>=</span><br />
<span class='s'>;_a_b_c_d</span><br />
<br />
<span class='t'>str</span> a<span class='o'>=</span><span class='s'>"hello"</span><br />
<span class='t'>str</span> b<span class='o'>=</span><span class='s'>" "</span><br />
<span class='t'>str</span> c<span class='o'>=</span><span class='s'>"world"</span><br />
<span class='t'>str</span> d<span class='o'>=</span><span class='s'>"!"</span><br />
<br />
ss.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"_a"</span> a<span class='p'>);</span> ss.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"_b"</span> b<span class='p'>);</span> ss.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"_c"</span> c<span class='p'>);</span> ss.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"_d"</span> d<span class='p'>)</span><br />
<span class='fq'>out</span> ss<br />
<br />
ss.<span class='fu'>findreplaces</span><span class='p'>(</span><span class='s'>"_a"</span> a <span class='s'>"_b"</span> b <span class='s'>"_c"</span> c <span class='s'>"_d"</span> d<span class='p'>)</span> <span class='c2'>;;???</span><br />
<span class='fq'>out</span> ss</code></div></div>]]></description>
			<content:encoded><![CDATA[I would like to implement multiple string and variable replacements using a custom member function <span style="font-weight: bold;" class="mycode_b">str.findreplaces</span>. Is this possible?<br />
I noticed that the member function <span style="font-weight: bold;" class="mycode_b">str.fromn</span> has similar characteristics.<br />
Thanks in advance for any suggestions and help!<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">Macro38</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='t'>str</span> ss<span class='o'>=</span><br />
<span class='s'>;_a_b_c_d</span><br />
<br />
<span class='t'>str</span> a<span class='o'>=</span><span class='s'>"hello"</span><br />
<span class='t'>str</span> b<span class='o'>=</span><span class='s'>" "</span><br />
<span class='t'>str</span> c<span class='o'>=</span><span class='s'>"world"</span><br />
<span class='t'>str</span> d<span class='o'>=</span><span class='s'>"!"</span><br />
<br />
ss.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"_a"</span> a<span class='p'>);</span> ss.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"_b"</span> b<span class='p'>);</span> ss.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"_c"</span> c<span class='p'>);</span> ss.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"_d"</span> d<span class='p'>)</span><br />
<span class='fq'>out</span> ss<br />
<br />
ss.<span class='fu'>findreplaces</span><span class='p'>(</span><span class='s'>"_a"</span> a <span class='s'>"_b"</span> b <span class='s'>"_c"</span> c <span class='s'>"_d"</span> d<span class='p'>)</span> <span class='c2'>;;???</span><br />
<span class='fq'>out</span> ss</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[restart the exe]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7859</link>
			<pubDate>Wed, 13 Aug 2025 13:19:32 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1516">Davider</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7859</guid>
			<description><![CDATA[For generating an exe file, if the QM code contains some registry operations, they only take effect after restarting the exe.<br />
<br />
How can restarting the exe be implemented elegantly?<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">Macro33</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='fq'>if</span> <span class='o'>!</span><span class='fq'>rget</span><span class='p'>(</span>_s <span class='s'>"DisabledComponents"</span> <span class='s'>"SYSTEM&#92;CurrentControlSet&#92;Services&#92;Tcpip6&#92;Parameters"</span> <span class='d'>HKEY_LOCAL_MACHINE</span><span class='p'>)</span><br />
<span class='i'>,</span><span class='fq'>out</span> _s<br />
<span class='i'>,</span><span class='fq'>rset</span> <span class='n'>32</span> <span class='s'>"DisabledComponents"</span> <span class='s'>"SYSTEM&#92;CurrentControlSet&#92;Services&#92;Tcpip6&#92;Parameters"</span> <span class='d'>HKEY_LOCAL_MACHINE</span><br />
<span class='i'>,</span><span class='c'>;need restart !!!</span><br />
<br />
<span class='fq'>mes</span> <span class='n'>666</span></code></div></div>]]></description>
			<content:encoded><![CDATA[For generating an exe file, if the QM code contains some registry operations, they only take effect after restarting the exe.<br />
<br />
How can restarting the exe be implemented elegantly?<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">Macro33</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='fq'>if</span> <span class='o'>!</span><span class='fq'>rget</span><span class='p'>(</span>_s <span class='s'>"DisabledComponents"</span> <span class='s'>"SYSTEM&#92;CurrentControlSet&#92;Services&#92;Tcpip6&#92;Parameters"</span> <span class='d'>HKEY_LOCAL_MACHINE</span><span class='p'>)</span><br />
<span class='i'>,</span><span class='fq'>out</span> _s<br />
<span class='i'>,</span><span class='fq'>rset</span> <span class='n'>32</span> <span class='s'>"DisabledComponents"</span> <span class='s'>"SYSTEM&#92;CurrentControlSet&#92;Services&#92;Tcpip6&#92;Parameters"</span> <span class='d'>HKEY_LOCAL_MACHINE</span><br />
<span class='i'>,</span><span class='c'>;need restart !!!</span><br />
<br />
<span class='fq'>mes</span> <span class='n'>666</span></code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[simple toggle macro]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7858</link>
			<pubDate>Tue, 12 Aug 2025 15:59:10 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1591">lumenant</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7858</guid>
			<description><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.libreautomate.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=1374" target="_blank" title="">Screenshot 2025-08-12 115724.png</a> (Size: 118.9 KB / Downloads: 110)
<!-- end: postbit_attachments_attachment -->im trying to create a code that when i press a key, i did 't' in this case, as a placeholder, it will continuously press it 100 times per second until i press the key again, a toggle. this is what i wrote so far, just based off my limited knowledge of coding C# but i am very new to this program and so i dont know any intricacies of this program that are not present in normal C#. there are 2 errors i got which are here and after is my code:  <img src="https://www.libreautomate.com/forum/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" /><br />
<br />
errors:<br />
<br />
Compilation: 2 errors<br />
Script1.cs(10,6): error CS0117: 'keys' does not contain a definition for 'onKeyDown'<br />
Script1.cs(25,9): error CS0165: Use of unassigned local variable 'cts'<br />
<br />
script:<br />
<br />
// Toggle spam of "T" key at 100 presses per second in LibreAutomate<br />
// Press T once to start, press T again to stop.<br />
<br />
using System;<br />
using System.Threading;<br />
<br />
bool spamming = false;<br />
CancellationTokenSource cts;<br />
<br />
keys.onKeyDown(KKey.T, k =&gt; {<br />
    if (!spamming) {<br />
        // Start spamming<br />
        spamming = true;<br />
        cts = new CancellationTokenSource();<br />
        Task.Run(() =&gt; {<br />
            while (!cts.Token.IsCancellationRequested) {<br />
                keys.send("T");<br />
                Thread.Sleep(10); // 10 ms delay = ~100 presses/sec<br />
            }<br />
        });<br />
        print.it("T spam started.");<br />
    } else {<br />
        // Stop spamming<br />
        spamming = false;<br />
        cts.Cancel();<br />
        print.it("T spam stopped.");<br />
    }<br />
});]]></description>
			<content:encoded><![CDATA[<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://www.libreautomate.com/forum/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=1374" target="_blank" title="">Screenshot 2025-08-12 115724.png</a> (Size: 118.9 KB / Downloads: 110)
<!-- end: postbit_attachments_attachment -->im trying to create a code that when i press a key, i did 't' in this case, as a placeholder, it will continuously press it 100 times per second until i press the key again, a toggle. this is what i wrote so far, just based off my limited knowledge of coding C# but i am very new to this program and so i dont know any intricacies of this program that are not present in normal C#. there are 2 errors i got which are here and after is my code:  <img src="https://www.libreautomate.com/forum/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" /><br />
<br />
errors:<br />
<br />
Compilation: 2 errors<br />
Script1.cs(10,6): error CS0117: 'keys' does not contain a definition for 'onKeyDown'<br />
Script1.cs(25,9): error CS0165: Use of unassigned local variable 'cts'<br />
<br />
script:<br />
<br />
// Toggle spam of "T" key at 100 presses per second in LibreAutomate<br />
// Press T once to start, press T again to stop.<br />
<br />
using System;<br />
using System.Threading;<br />
<br />
bool spamming = false;<br />
CancellationTokenSource cts;<br />
<br />
keys.onKeyDown(KKey.T, k =&gt; {<br />
    if (!spamming) {<br />
        // Start spamming<br />
        spamming = true;<br />
        cts = new CancellationTokenSource();<br />
        Task.Run(() =&gt; {<br />
            while (!cts.Token.IsCancellationRequested) {<br />
                keys.send("T");<br />
                Thread.Sleep(10); // 10 ms delay = ~100 presses/sec<br />
            }<br />
        });<br />
        print.it("T spam started.");<br />
    } else {<br />
        // Stop spamming<br />
        spamming = false;<br />
        cts.Cancel();<br />
        print.it("T spam stopped.");<br />
    }<br />
});]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Code in variables or resources]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7856</link>
			<pubDate>Sun, 03 Aug 2025 13:50:45 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1516">Davider</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7856</guid>
			<description><![CDATA[I've always had a confusion: between the following two types of code, which one is relatively safer?<br />
My thought is: script c1.<br />
 <br />
Reason:<br />
The code of script c1 is stored in a variable, while the code of script c2 is stored in a resource.<br />
Can it be directly viewed using a resource viewer tool?<br />
 <br />
Is the above understanding correct?<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">c1</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='t'>str</span> code<span class='o'>=</span><br />
<span class='s'>;public class Class1</span><br />
<span class='s'>;{</span><br />
<span class='s'>;;;;;public static string StaticFunc(string s)</span><br />
<span class='s'>;;;;;{</span><br />
<span class='s'>;;;;;;;;;return s;</span><br />
<span class='s'>;;;;;}</span><br />
<span class='s'>;}</span><br />
<span class='t'>str</span> R<span class='o'>=</span><span class='fu'>CsFunc</span><span class='p'>(</span>code <span class='s'>"hello"</span><span class='p'>)</span><br />
<span class='fq'>out</span> R</code></div></div><br />
Macro <span style="font-weight: bold;" class="mycode_b">c2</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='t'>str</span> R<span class='o'>=</span><span class='fu'>CsFunc</span><span class='p'>(</span><span class='s'>""</span> <span class='s'>"hello"</span><span class='p'>)</span><br />
<span class='fq'>out</span> R<br />
<br />
<span class='dir'>#ret</span><br />
public <span class='fq'>class</span> Class1<br />
{<br />
<span class='c'>;;;;public static string StaticFunc(string s)</span><br />
<span class='c'>;;;;{</span><br />
<span class='c'>;;;;;;;;return s;</span><br />
<span class='c'>;;;;}</span><br />
}</code></div></div>]]></description>
			<content:encoded><![CDATA[I've always had a confusion: between the following two types of code, which one is relatively safer?<br />
My thought is: script c1.<br />
 <br />
Reason:<br />
The code of script c1 is stored in a variable, while the code of script c2 is stored in a resource.<br />
Can it be directly viewed using a resource viewer tool?<br />
 <br />
Is the above understanding correct?<br />
<br />
Macro <span style="font-weight: bold;" class="mycode_b">c1</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='t'>str</span> code<span class='o'>=</span><br />
<span class='s'>;public class Class1</span><br />
<span class='s'>;{</span><br />
<span class='s'>;;;;;public static string StaticFunc(string s)</span><br />
<span class='s'>;;;;;{</span><br />
<span class='s'>;;;;;;;;;return s;</span><br />
<span class='s'>;;;;;}</span><br />
<span class='s'>;}</span><br />
<span class='t'>str</span> R<span class='o'>=</span><span class='fu'>CsFunc</span><span class='p'>(</span>code <span class='s'>"hello"</span><span class='p'>)</span><br />
<span class='fq'>out</span> R</code></div></div><br />
Macro <span style="font-weight: bold;" class="mycode_b">c2</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<br />
<span class='t'>str</span> R<span class='o'>=</span><span class='fu'>CsFunc</span><span class='p'>(</span><span class='s'>""</span> <span class='s'>"hello"</span><span class='p'>)</span><br />
<span class='fq'>out</span> R<br />
<br />
<span class='dir'>#ret</span><br />
public <span class='fq'>class</span> Class1<br />
{<br />
<span class='c'>;;;;public static string StaticFunc(string s)</span><br />
<span class='c'>;;;;{</span><br />
<span class='c'>;;;;;;;;return s;</span><br />
<span class='c'>;;;;}</span><br />
}</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Font of text in the output panel]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7855</link>
			<pubDate>Sun, 03 Aug 2025 03:59:00 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1516">Davider</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7855</guid>
			<description><![CDATA[When I press the F1 hotkey to view function help text, the font used is not the one I set in the options. The display looks a bit strange.<br />
<br />
Is there a way to set the font?<br />
<br />
Demo: <a href="https://i.ibb.co/pvQ0BFyr/demo.gif" target="_blank" rel="noopener" class="mycode_url">https://i.ibb.co/pvQ0BFyr/demo.gif</a>]]></description>
			<content:encoded><![CDATA[When I press the F1 hotkey to view function help text, the font used is not the one I set in the options. The display looks a bit strange.<br />
<br />
Is there a way to set the font?<br />
<br />
Demo: <a href="https://i.ibb.co/pvQ0BFyr/demo.gif" target="_blank" rel="noopener" class="mycode_url">https://i.ibb.co/pvQ0BFyr/demo.gif</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Can QM or La use UI automation to control the TK GUI?]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7852</link>
			<pubDate>Mon, 28 Jul 2025 03:36:58 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=810">conanjou</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7852</guid>
			<description><![CDATA[I've tried using QM or LA to control a Tkinter GUI button via UI automation in Python, but it always fails. Has anyone successfully used UI automation to interact with Tkinter GUIs this way?<br />
<br />
python code:<br />
<br />
import tkinter as tk<br />
<br />
def on_click():<br />
    label.config(text="test ok！")<br />
<br />
root = tk.Tk()<br />
root.title("MyTkWindow")<br />
root.geometry("300x200")<br />
<br />
entry = tk.Entry(root, name="myentry")<br />
entry.pack(pady=10)<br />
<br />
btn = tk.Button(root, text="Button", name="mybutton", command=on_click)<br />
btn.pack(pady=10)<br />
<br />
label = tk.Label(root, text="", name="mylabel")<br />
label.pack(pady=10)<br />
<br />
root.mainloop()]]></description>
			<content:encoded><![CDATA[I've tried using QM or LA to control a Tkinter GUI button via UI automation in Python, but it always fails. Has anyone successfully used UI automation to interact with Tkinter GUIs this way?<br />
<br />
python code:<br />
<br />
import tkinter as tk<br />
<br />
def on_click():<br />
    label.config(text="test ok！")<br />
<br />
root = tk.Tk()<br />
root.title("MyTkWindow")<br />
root.geometry("300x200")<br />
<br />
entry = tk.Entry(root, name="myentry")<br />
entry.pack(pady=10)<br />
<br />
btn = tk.Button(root, text="Button", name="mybutton", command=on_click)<br />
btn.pack(pady=10)<br />
<br />
label = tk.Label(root, text="", name="mylabel")<br />
label.pack(pady=10)<br />
<br />
root.mainloop()]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Http Listener]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7849</link>
			<pubDate>Fri, 11 Jul 2025 00:02:07 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1516">Davider</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7849</guid>
			<description><![CDATA[I want to implement a <span style="font-weight: bold;" class="mycode_b">port listening</span> function similar to the PowerShell code below using the <span style="font-weight: bold;" class="mycode_b">HttpListener</span> function,<br />
but I haven't succeeded.<br />
After executing the function, I am unable to <span style="font-weight: bold;" class="mycode_b">stop the listening service</span> and <span style="font-weight: bold;" class="mycode_b">return the Code</span> value.  <br />
<br />
Thank you in advance for any suggestions and help.<br />
<br />
Function <span style="font-weight: bold;" class="mycode_b">HttpListener_T</span> <span/><br />
 <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span> <br />
<br />
<span class='c'>;https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade</span><br />
<span class='c'>;After registering the application from the above link, obtain the following parameters:</span><br />
<span class='t'>str</span> clientID     <span class='o'>=</span> <span class='s'>"a6eb8463-d6d9-4466-b774-29b5f2bb66"</span><br />
<span class='t'>str</span> clientSecret <span class='o'>=</span> <span class='s'>"r.I8Q~O5UKQU~9RZNn7~uCinjnDR~Z2hagY5Ob"</span><br />
<span class='t'>str</span> redirectUri  <span class='o'>=</span> <span class='s'>"http://localhost:7654/"</span><br />
<br />
<span class='t'>str</span> uri <span class='o'>=</span><br />
<span class='o'>F</span><br />
<span class='s'>;https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id={</span>clientID<span class='s'>}</span><br />
<span class='s'>;scope=offline_access files.readwrite</span><br />
<span class='s'>;response_type=code</span><br />
<span class='s'>;redirect_uri={</span>redirectUri<span class='s'>}</span><br />
uri.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"[]"</span> <span class='s'>"&amp;"</span><span class='p'>)</span><br />
<br />
<span class='fq'>run</span> uri<br />
<br />
<span class='fq'>out</span> <span class='fu'>HttpListener</span><span class='p'>(</span><span class='n'>7654</span><span class='p'>)</span></code></div></div><br />
Function <span style="font-weight: bold;" class="mycode_b">HttpListener</span> <span/><br />
 <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>function</span><span class='o'>~</span> port<br />
<br />
<span class='fq'>if</span><span class='p'>(</span><span class='fq'>getopt</span><span class='p'>(</span>nthreads<span class='p'>)</span><span class='o'>&gt;</span><span class='n'>1</span><span class='p'>)</span> <span class='fq'>ret</span><br />
<br />
<span class='dir'>#compile</span> <span class='s'>"__TcpSocket"</span><br />
<br />
<span class='fu'>AddTrayIcon</span> <span class='s'>"close.ico"</span> <span class='s'>"TcpSocket_server[]Ctrl+click to end."</span><br />
<span class='t'>str</span> code<br />
<span class='t'>TcpSocket</span> x.<span class='fu'>ServerStart</span><span class='p'>(</span>port <span class='o'>&amp;</span><span class='fu'>sub.OnClientConnected</span> <span class='o'>&amp;</span>code<span class='p'>)</span><br />
<br />
x.<span class='fu'>Close</span><br />
<span class='fq'>ret</span> code<br />
<br />
<span class='dir'>#sub</span> OnClientConnected<br />
<span class='fq'>function</span> <span class='t'>TcpSocket</span><span class='o'>&amp;</span>client <span class='o'>&#36;</span>clientIp <span class='t'>str</span><span class='o'>&amp;</span>code <span class='o'>!*</span>reserved<br />
<br />
<span class='t'>str</span> method path headers<br />
<span class='fq'>if</span><span class='p'>(</span><span class='o'>!</span>client.<span class='fu'>HttpRead</span><span class='p'>(</span>method path headers<span class='p'>))</span> <span class='fq'>ret</span><br />
<br />
<span class='fq'>out</span> <span class='s'>"method:[]%s"</span>method<br />
<span class='fq'>out</span> <span class='s'>"path:[]%s"</span>path<br />
<br />
<span class='fq'>if</span> method<span class='o'>=</span><span class='s'>"GET"</span> <span class='fq'>and</span> <span class='o'>!</span><span class='fq'>empty</span><span class='p'>(</span>path<span class='p'>)</span><br />
<span class='i'>,</span>_s.<span class='fq'>get</span><span class='p'>(</span>path <span class='fq'>find</span><span class='p'>(</span>path <span class='s'>"="</span><span class='p'>)</span><span class='o'>+</span><span class='n'>1</span><span class='p'>)</span><br />
<span class='i'>,</span>code<span class='o'>=</span>_s</code></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Powershell Code:</span><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code># -- https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade<br />
# -- After registering the application from the above link, obtain the following parameters:<br />
&#36;clientID&nbsp;&nbsp;&nbsp;&nbsp; = 'a6eb8463-d6d9-4466-b774-29b5f2bb66'<br />
&#36;clientSecret = 'r.I8Q~O5UKQU~9RZNn7~uCinjnDR~Z2hagY5Ob'<br />
&#36;redirectUri&nbsp;&nbsp;= 'http://localhost:7654/'<br />
<br />
# -- Microsoft Graph OAuth2.0 Authorization Code Flow<br />
&#36;uri = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id={0}&amp;scope=offline_access files.readwrite&amp;response_type=code&amp;redirect_uri={1}' -f &#36;clientID, &#36;redirectUri<br />
<br />
start &#36;uri<br />
<br />
#################################################### Implement the following functionality in the HttpListener function of qm.<br />
&#36;listener = New-Object 'System.Net.HttpListener'<br />
&#36;listener.Prefixes.Add(&#36;redirectUri)<br />
&#36;listener.Start()<br />
&#36;ctx&nbsp;&nbsp;= &#36;listener.GetContext()<br />
&#36;code = &#36;ctx.Request.QueryString.GetValues('code') | select -First 1<br />
if(&#36;code -eq &#36;null){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#36;bytes = [Text.Encoding]::Default.GetBytes('Authorization Failed')<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#36;bytes = [Text.Encoding]::Default.GetBytes('Authorization Successful, Please Close the Current Page')<br />
}<br />
&#36;ctx.Response.ContentLength64 = &#36;bytes.Length<br />
&#36;ctx.Response.OutputStream.Write(&#36;bytes, 0, &#36;bytes.Length)<br />
&#36;listener.Stop()<br />
&#36;ctx.Response.Close()<br />
&#36;listener.Dispose()</code></div></div>]]></description>
			<content:encoded><![CDATA[I want to implement a <span style="font-weight: bold;" class="mycode_b">port listening</span> function similar to the PowerShell code below using the <span style="font-weight: bold;" class="mycode_b">HttpListener</span> function,<br />
but I haven't succeeded.<br />
After executing the function, I am unable to <span style="font-weight: bold;" class="mycode_b">stop the listening service</span> and <span style="font-weight: bold;" class="mycode_b">return the Code</span> value.  <br />
<br />
Thank you in advance for any suggestions and help.<br />
<br />
Function <span style="font-weight: bold;" class="mycode_b">HttpListener_T</span> <span/><br />
 <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span> <br />
<br />
<span class='c'>;https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade</span><br />
<span class='c'>;After registering the application from the above link, obtain the following parameters:</span><br />
<span class='t'>str</span> clientID     <span class='o'>=</span> <span class='s'>"a6eb8463-d6d9-4466-b774-29b5f2bb66"</span><br />
<span class='t'>str</span> clientSecret <span class='o'>=</span> <span class='s'>"r.I8Q~O5UKQU~9RZNn7~uCinjnDR~Z2hagY5Ob"</span><br />
<span class='t'>str</span> redirectUri  <span class='o'>=</span> <span class='s'>"http://localhost:7654/"</span><br />
<br />
<span class='t'>str</span> uri <span class='o'>=</span><br />
<span class='o'>F</span><br />
<span class='s'>;https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id={</span>clientID<span class='s'>}</span><br />
<span class='s'>;scope=offline_access files.readwrite</span><br />
<span class='s'>;response_type=code</span><br />
<span class='s'>;redirect_uri={</span>redirectUri<span class='s'>}</span><br />
uri.<span class='fq'>findreplace</span><span class='p'>(</span><span class='s'>"[]"</span> <span class='s'>"&amp;"</span><span class='p'>)</span><br />
<br />
<span class='fq'>run</span> uri<br />
<br />
<span class='fq'>out</span> <span class='fu'>HttpListener</span><span class='p'>(</span><span class='n'>7654</span><span class='p'>)</span></code></div></div><br />
Function <span style="font-weight: bold;" class="mycode_b">HttpListener</span> <span/><br />
 <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>function</span><span class='o'>~</span> port<br />
<br />
<span class='fq'>if</span><span class='p'>(</span><span class='fq'>getopt</span><span class='p'>(</span>nthreads<span class='p'>)</span><span class='o'>&gt;</span><span class='n'>1</span><span class='p'>)</span> <span class='fq'>ret</span><br />
<br />
<span class='dir'>#compile</span> <span class='s'>"__TcpSocket"</span><br />
<br />
<span class='fu'>AddTrayIcon</span> <span class='s'>"close.ico"</span> <span class='s'>"TcpSocket_server[]Ctrl+click to end."</span><br />
<span class='t'>str</span> code<br />
<span class='t'>TcpSocket</span> x.<span class='fu'>ServerStart</span><span class='p'>(</span>port <span class='o'>&amp;</span><span class='fu'>sub.OnClientConnected</span> <span class='o'>&amp;</span>code<span class='p'>)</span><br />
<br />
x.<span class='fu'>Close</span><br />
<span class='fq'>ret</span> code<br />
<br />
<span class='dir'>#sub</span> OnClientConnected<br />
<span class='fq'>function</span> <span class='t'>TcpSocket</span><span class='o'>&amp;</span>client <span class='o'>&#36;</span>clientIp <span class='t'>str</span><span class='o'>&amp;</span>code <span class='o'>!*</span>reserved<br />
<br />
<span class='t'>str</span> method path headers<br />
<span class='fq'>if</span><span class='p'>(</span><span class='o'>!</span>client.<span class='fu'>HttpRead</span><span class='p'>(</span>method path headers<span class='p'>))</span> <span class='fq'>ret</span><br />
<br />
<span class='fq'>out</span> <span class='s'>"method:[]%s"</span>method<br />
<span class='fq'>out</span> <span class='s'>"path:[]%s"</span>path<br />
<br />
<span class='fq'>if</span> method<span class='o'>=</span><span class='s'>"GET"</span> <span class='fq'>and</span> <span class='o'>!</span><span class='fq'>empty</span><span class='p'>(</span>path<span class='p'>)</span><br />
<span class='i'>,</span>_s.<span class='fq'>get</span><span class='p'>(</span>path <span class='fq'>find</span><span class='p'>(</span>path <span class='s'>"="</span><span class='p'>)</span><span class='o'>+</span><span class='n'>1</span><span class='p'>)</span><br />
<span class='i'>,</span>code<span class='o'>=</span>_s</code></div></div><br />
<span style="font-weight: bold;" class="mycode_b">Powershell Code:</span><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code># -- https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade<br />
# -- After registering the application from the above link, obtain the following parameters:<br />
&#36;clientID&nbsp;&nbsp;&nbsp;&nbsp; = 'a6eb8463-d6d9-4466-b774-29b5f2bb66'<br />
&#36;clientSecret = 'r.I8Q~O5UKQU~9RZNn7~uCinjnDR~Z2hagY5Ob'<br />
&#36;redirectUri&nbsp;&nbsp;= 'http://localhost:7654/'<br />
<br />
# -- Microsoft Graph OAuth2.0 Authorization Code Flow<br />
&#36;uri = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id={0}&amp;scope=offline_access files.readwrite&amp;response_type=code&amp;redirect_uri={1}' -f &#36;clientID, &#36;redirectUri<br />
<br />
start &#36;uri<br />
<br />
#################################################### Implement the following functionality in the HttpListener function of qm.<br />
&#36;listener = New-Object 'System.Net.HttpListener'<br />
&#36;listener.Prefixes.Add(&#36;redirectUri)<br />
&#36;listener.Start()<br />
&#36;ctx&nbsp;&nbsp;= &#36;listener.GetContext()<br />
&#36;code = &#36;ctx.Request.QueryString.GetValues('code') | select -First 1<br />
if(&#36;code -eq &#36;null){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#36;bytes = [Text.Encoding]::Default.GetBytes('Authorization Failed')<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#36;bytes = [Text.Encoding]::Default.GetBytes('Authorization Successful, Please Close the Current Page')<br />
}<br />
&#36;ctx.Response.ContentLength64 = &#36;bytes.Length<br />
&#36;ctx.Response.OutputStream.Write(&#36;bytes, 0, &#36;bytes.Length)<br />
&#36;listener.Stop()<br />
&#36;ctx.Response.Close()<br />
&#36;listener.Dispose()</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Running qm code in pip?]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7848</link>
			<pubDate>Wed, 09 Jul 2025 00:51:20 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1516">Davider</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7848</guid>
			<description><![CDATA[Version 1.13 of LA added the functionality to run scripts in pip, which is very useful. Is there a simple way to enable qm to use this feature as well?]]></description>
			<content:encoded><![CDATA[Version 1.13 of LA added the functionality to run scripts in pip, which is very useful. Is there a simple way to enable qm to use this feature as well?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[create global hotkeys for a tray app]]></title>
			<link>https://www.libreautomate.com/forum/showthread.php?tid=7844</link>
			<pubDate>Wed, 02 Jul 2025 10:34:48 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://www.libreautomate.com/forum/member.php?action=profile&uid=1516">Davider</a>]]></dc:creator>
			<guid isPermaLink="false">https://www.libreautomate.com/forum/showthread.php?tid=7844</guid>
			<description><![CDATA[I want to create global hotkeys for a tray application, for example, as shown in the code below.  <br />
When I press the hotkey F12, the subroutine sub.hk_F12 will be executed.  <br />
When I press the hotkey Ctrl+F12, the subroutine sub.hk_Ctrl_F12 will be executed.  <br />
<br />
I haven't found any useful information on the forums.  <br />
Thanks in advance for any suggestions and help.<br />
<br />
Function <span style="font-weight: bold;" class="mycode_b">TcpServer2</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<span class='fq'>if</span><span class='p'>(</span><span class='fq'>getopt</span><span class='p'>(</span>nthreads<span class='p'>)</span><span class='o'>&gt;</span><span class='n'>1</span><span class='p'>)</span> <span class='fq'>ret</span> <span class='c2'>;;allow single instance</span><br />
<span class='fu'>AddTrayIcon</span> <span class='s'>"cut.ico"</span> <span class='s'>"test_TcpSocket_server[]Ctrl+click to end."</span><br />
<br />
<span class='dir'>#compile</span> <span class='s'>"__TcpSocket"</span><br />
<span class='t'>TcpSocket</span> x.<span class='fu'>ServerStart</span><span class='p'>(</span><span class='n'>5032</span> <span class='o'>&amp;</span><span class='fu'>sub.OnClientConnected</span><span class='p'>)</span><br />
<br />
<span class='dir'>#sub</span> OnClientConnected<br />
<span class='fq'>function</span> <span class='t'>TcpSocket</span><span class='o'>&amp;</span>client <span class='o'>&#36;</span>clientIp param <span class='o'>!*</span>reserved<br />
<br />
client.<span class='fu'>Receive</span><span class='p'>(</span>_s <span class='n'>1000</span><span class='p'>)</span><br />
<span class='fq'>out</span> <span class='o'>F</span><span class='s'>"SERVER: client request: {</span>_s<span class='s'>}"</span><br />
<br />
client.<span class='fu'>Send</span><span class='p'>(</span><span class='s'>"response 1"</span><span class='p'>)</span><br />
<br />
<span class='dir'>#sub</span> hk_F12<br />
<span class='fq'>mes</span> <span class='s'>"hk_F12"</span><br />
<br />
<span class='dir'>#sub</span> hk_Ctrl_F12<br />
<span class='fq'>mes</span> <span class='s'>"hk_Ctrl_F12"</span></code></div></div>]]></description>
			<content:encoded><![CDATA[I want to create global hotkeys for a tray application, for example, as shown in the code below.  <br />
When I press the hotkey F12, the subroutine sub.hk_F12 will be executed.  <br />
When I press the hotkey Ctrl+F12, the subroutine sub.hk_Ctrl_F12 will be executed.  <br />
<br />
I haven't found any useful information on the forums.  <br />
Thanks in advance for any suggestions and help.<br />
<br />
Function <span style="font-weight: bold;" class="mycode_b">TcpServer2</span> <span/><br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code><span class='fq'>out</span><br />
<span class='fq'>if</span><span class='p'>(</span><span class='fq'>getopt</span><span class='p'>(</span>nthreads<span class='p'>)</span><span class='o'>&gt;</span><span class='n'>1</span><span class='p'>)</span> <span class='fq'>ret</span> <span class='c2'>;;allow single instance</span><br />
<span class='fu'>AddTrayIcon</span> <span class='s'>"cut.ico"</span> <span class='s'>"test_TcpSocket_server[]Ctrl+click to end."</span><br />
<br />
<span class='dir'>#compile</span> <span class='s'>"__TcpSocket"</span><br />
<span class='t'>TcpSocket</span> x.<span class='fu'>ServerStart</span><span class='p'>(</span><span class='n'>5032</span> <span class='o'>&amp;</span><span class='fu'>sub.OnClientConnected</span><span class='p'>)</span><br />
<br />
<span class='dir'>#sub</span> OnClientConnected<br />
<span class='fq'>function</span> <span class='t'>TcpSocket</span><span class='o'>&amp;</span>client <span class='o'>&#36;</span>clientIp param <span class='o'>!*</span>reserved<br />
<br />
client.<span class='fu'>Receive</span><span class='p'>(</span>_s <span class='n'>1000</span><span class='p'>)</span><br />
<span class='fq'>out</span> <span class='o'>F</span><span class='s'>"SERVER: client request: {</span>_s<span class='s'>}"</span><br />
<br />
client.<span class='fu'>Send</span><span class='p'>(</span><span class='s'>"response 1"</span><span class='p'>)</span><br />
<br />
<span class='dir'>#sub</span> hk_F12<br />
<span class='fq'>mes</span> <span class='s'>"hk_F12"</span><br />
<br />
<span class='dir'>#sub</span> hk_Ctrl_F12<br />
<span class='fq'>mes</span> <span class='s'>"hk_Ctrl_F12"</span></code></div></div>]]></content:encoded>
		</item>
	</channel>
</rss>