<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>VoiceBot RSS: way to get mouse position?</title>
<atom:link href="https://www.voicebot.net/Discussions/RSS/?TopicID=a92515f9-8f35-4492-9eba-614228d8f00b" rel="self" type="application/rss+xml" />
<link>https://www.voicebot.net/Discussions/RSS/?TopicID=a92515f9-8f35-4492-9eba-614228d8f00b</link>
<description>VoiceBot RSS: way to get mouse position?</description>
<lastBuildDate>Fri, 01 May 2026 14:19:46 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.voicebot.net/Discussions/RSS/?TopicID=a92515f9-8f35-4492-9eba-614228d8f00b</generator>
<item>
<title>RE: way to get mouse position?</title>
<link>https://www.voicebot.net/Discussions/View/way-to-get-mouse-position/?ID=a92515f9-8f35-4492-9eba-614228d8f00b#3</link>
<pubDate>Wed, 29 Aug 2018 13:17:41 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.voicebot.net/Discussions/View/way-to-get-mouse-position/?ID=a92515f9-8f35-4492-9eba-614228d8f00b#3</guid>
<category>VoiceBot</category>
<description><![CDATA[Well, just in case, a clean script.
Code
Copy
Select All
using System;
using System.Drawing;
public static class VoiceBotScript
{
public static void Run(IntPtr windowHandle)
{
// Save current position
var posX = BFS.Input.GetMousePositionX();
var posY = BFS.Input.GetMousePositionY();...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Well, just in case, a clean script.<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code019de3e8ee8d776bbd9b556ed2dfe424" class="ClipboardCopyControl"><img src="https://www.voicebot.net/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019de3e8ee8d776bbd9b556ed2dfe424Js'); return false;"><img src="https://www.voicebot.net/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code019de3e8ee8d776bbd9b556ed2dfe424Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Drawing;

public static class VoiceBotScript
{
    public static void Run(IntPtr windowHandle)
    {
        // Save current position
        var posX = BFS.Input.GetMousePositionX();
        var posY = BFS.Input.GetMousePositionY();
        
        // Call method with mouse actions
        MouseActions();
        
        // Restore saved position
        BFS.Input.SetMousePosition(posX, posY);
    }
    public static void MouseActions()
    {
        // Here your can make all mouse actions.
    }
}</pre><textarea id="code019de3e8ee8d776bbd9b556ed2dfe424" name="code019de3e8ee8d776bbd9b556ed2dfe424" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
<item>
<title>RE: way to get mouse position?</title>
<link>https://www.voicebot.net/Discussions/View/way-to-get-mouse-position/?ID=a92515f9-8f35-4492-9eba-614228d8f00b#2</link>
<pubDate>Wed, 29 Aug 2018 12:59:47 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.voicebot.net/Discussions/View/way-to-get-mouse-position/?ID=a92515f9-8f35-4492-9eba-614228d8f00b#2</guid>
<category>VoiceBot</category>
<description><![CDATA[What causes the use of 3 scripts? Of course, their launch and works takes a long time. Everything is solved much easier.
For example this test script with 50 clicks, is executed in ~6 seconds. And 99% of this time is spent on clicks. Without clicks, but with 10ms delay it's performed for ~550ms....]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
What causes the use of 3 scripts? Of course, their launch and works takes a long time. Everything is solved much easier.<br/>
For example this test script with 50 clicks, is executed in ~6 seconds. And 99% of this time is spent on clicks. Without clicks, but with 10ms delay it's performed for ~550ms.<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code019de3e8ee9c708a83a493b5987a691e" class="ClipboardCopyControl"><img src="https://www.voicebot.net/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019de3e8ee9c708a83a493b5987a691eJs'); return false;"><img src="https://www.voicebot.net/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code019de3e8ee9c708a83a493b5987a691eJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Drawing;
using System.Linq;
using System.Diagnostics;

public static class VoiceBotScript
{
    public static void Run(IntPtr windowHandle)
    {
        // Calculate execution time
        var watch = Stopwatch.StartNew();
        
        // Save current position
        var pos = new int[] {BFS.Input.GetMousePositionX(), BFS.Input.GetMousePositionY()};
        
        // Call method with mouse actions
        MouseActions();
        
        // Restore saved position
        BFS.Input.SetMousePosition(pos[0], pos[1]);
        
        watch.Stop();
        BFS.Dialog.ShowMessageInfo("Total time elapsed: " + watch.Elapsed);
    }
    
    public static void MouseActions()
    {
        // Here your can make all mouse actions.
        
        // For example, 50 clicks with the initial coordinates of X=300, Y=500 and X offset by +10 pixels to 500.
        var posList = Enumerable.Range(300, 500).Where(x =&gt; x % 10 == 0).ToList();
        foreach (var pos in posList)
        {
            BFS.Input.SetMousePosition(pos, 500);
            //BFS.General.ThreadWait(10);
            BFS.Input.LeftClickMouse();
        }
    }
}</pre><textarea id="code019de3e8ee9c708a83a493b5987a691e" name="code019de3e8ee9c708a83a493b5987a691e" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
<item>
<title>way to get mouse position?</title>
<link>https://www.voicebot.net/Discussions/View/way-to-get-mouse-position/?ID=a92515f9-8f35-4492-9eba-614228d8f00b</link>
<pubDate>Tue, 28 Aug 2018 20:47:37 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.voicebot.net/Discussions/View/way-to-get-mouse-position/?ID=a92515f9-8f35-4492-9eba-614228d8f00b</guid>
<category>VoiceBot</category>
<description><![CDATA[Is there a quick way to get the current mouse position?
I have a command that moves the mouse and does some clicks, then returns the mouse to the position prio to any of the moves/clicks. The problem is that the script macro for getting and storing the mouse position is extremely slow (3-5 secon...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Is there a quick way to get the current mouse position?<br/>
I have a command that moves the mouse and does some clicks, then returns the mouse to the position prio to any of the moves/clicks. The problem is that the script macro for getting and storing the mouse position is extremely slow (3-5 seconds for just getting/storing the mouse position, and then another 3-5 seconds to have the follow-up script return the mouse to its previous coordinates). Add to it that it pretty much opens another window.<br/>
<br/>
1. Macro Script to get/store the mouse position<br/>
=============================================<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code019de3e8eea47582bcd86d88ec9281ff" class="ClipboardCopyControl"><img src="https://www.voicebot.net/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019de3e8eea47582bcd86d88ec9281ffJs'); return false;"><img src="https://www.voicebot.net/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code019de3e8eea47582bcd86d88ec9281ffJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Drawing;

public static class VoiceBotScript
{
    public static void Run(IntPtr windowHandle)
    {
    int mouseX = BFS.Input.GetMousePositionX();
    int mouseY = BFS.Input.GetMousePositionY();
    BFS.ScriptSettings.WriteValueInt("MouseX", mouseX);
    BFS.ScriptSettings.WriteValueInt("MouseY", mouseY);
    }
}</pre><textarea id="code019de3e8eea47582bcd86d88ec9281ff" name="code019de3e8eea47582bcd86d88ec9281ff" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
=============================================<br/>
<br/>
2. Multiple "move/click here" commands.<br/>
3. Macro Script to restore the mouse position to previously saved coordinates:<br/>
=============================================<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code019de3e8eeab709fb741f0915d9aca8d" class="ClipboardCopyControl"><img src="https://www.voicebot.net/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019de3e8eeab709fb741f0915d9aca8dJs'); return false;"><img src="https://www.voicebot.net/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code019de3e8eeab709fb741f0915d9aca8dJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Drawing;

public static class VoiceBotScript
{
    public static void Run(IntPtr windowHandle)
    {
    int mouseX = BFS.ScriptSettings.ReadValueInt("MouseX");
    int mouseY = BFS.ScriptSettings.ReadValueInt("MouseY");
    BFS.Input.SetMousePosition(mouseX , mouseY); //Moves the mouse cursor to the earlier stored values.
    }
}</pre><textarea id="code019de3e8eeab709fb741f0915d9aca8d" name="code019de3e8eeab709fb741f0915d9aca8d" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
=============================================<br/>
<br/>
Unfortunately, using these macro scripts are just too damn slow (it works, but takes up to 10 seconds just for 3 steps (get position, move mouse, and move mouse back to previous position. Other voice command software has a simpler (and much quicker) way to grab the mouse coordinates, and then recall those variables/values later-on. Is there an easier way to do this in Voicebot?<br/>
<br/>
Please advise.<br/>
<br/>
Thanks,<br/>
<br/>
Van
</div>
]]></content:encoded>
</item>
</channel>
</rss>