<?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>ClipboardFusion RSS: Help with Macro Error Correction &amp; Enhancement</title>
<atom:link href="https://www.clipboardfusion.com/Discussions/RSS/?TopicID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0" rel="self" type="application/rss+xml" />
<link>https://www.clipboardfusion.com/Discussions/RSS/?TopicID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0</link>
<description>ClipboardFusion RSS: Help with Macro Error Correction &amp; Enhancement</description>
<lastBuildDate>Wed, 10 Jun 2026 18:46:48 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.clipboardfusion.com/Discussions/RSS/?TopicID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0</generator>
<item>
<title>RE: Help with Macro Error Correction &amp; Enhancement</title>
<link>https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#6</link>
<pubDate>Wed, 31 Jan 2018 19:51:06 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#6</guid>
<category>ClipboardFusion</category>
<description><![CDATA[No worries, glad to hear it!]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
No worries, glad to hear it!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Help with Macro Error Correction &amp; Enhancement</title>
<link>https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#5</link>
<pubDate>Wed, 31 Jan 2018 19:21:45 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#5</guid>
<category>ClipboardFusion</category>
<description><![CDATA[Thanks Keith worked like a charm
Thank you so much for helping out!]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Thanks Keith worked like a charm <img src="https://www.clipboardfusion.com/MediaCommon/SVGs/FontAwesome/face-laugh-squint.light.svg" alt=":D" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:16px;height:16px;" HelpButtonData=":D" HelpButtonDataAlign="BelowMiddle" /><br/>
<br/>
Thank you so much for helping out!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Help with Macro Error Correction &amp; Enhancement</title>
<link>https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#4</link>
<pubDate>Wed, 31 Jan 2018 19:11:04 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#4</guid>
<category>ClipboardFusion</category>
<description><![CDATA[Ok, try this out for the second thing
Code
Copy
Select All
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
// Copy the selected text
text = BFS.Cli...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Ok, try this out for the second thing <img src="https://www.clipboardfusion.com/MediaCommon/SVGs/FontAwesome/face-smile.light.svg" alt=":)" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:16px;height:16px;" HelpButtonData=":)" HelpButtonDataAlign="BelowMiddle" /><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="#code019eb2dbc83877b99ae3a89d0009239d" class="ClipboardCopyControl"><img src="https://www.clipboardfusion.com/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('code019eb2dbc83877b99ae3a89d0009239dJs'); return false;"><img src="https://www.clipboardfusion.com/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="code019eb2dbc83877b99ae3a89d0009239dJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        // Copy the selected text
        text = BFS.Clipboard.CopyText();
        
        // If the copied selection is a file list from Explorer, run the "Get Filenames from Clipboard" macro
        if (Clipboard.ContainsFileDropList())
        {
            BFS.ClipboardFusion.RunMacro("Get Filenames from Clipboard", text, out text);
            BFS.Clipboard.SetText(text);
        }
            
        // Launch Notepad
        uint appID = BFS.Application.Start("notepad.exe");
        
        // Wait up to 10 seconds for it to open and receive focus
        for (int i = 0; i &lt; 10; i++)
        {
            // If the newly launched Notepad window has focus, paste the text and break out of the loop
            if (BFS.Window.GetFocusedWindow() == BFS.Application.GetMainWindowByAppID(appID))
                {
                    BFS.Clipboard.Paste();
                    break;
                }
            
            // If we got here, the Notepad window doesn't yet have focus, wait 1 second before restarting the loop
            BFS.General.ThreadWait(1000);
        }
        return text;
    }
}</pre><textarea id="code019eb2dbc83877b99ae3a89d0009239d" name="code019eb2dbc83877b99ae3a89d0009239d" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Help with Macro Error Correction &amp; Enhancement</title>
<link>https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#3</link>
<pubDate>Wed, 31 Jan 2018 16:47:17 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#3</guid>
<category>ClipboardFusion</category>
<description><![CDATA[Hi Keith,
Thank you so much for helping out. Worked like a charm for the 1st issue.
Thanks,
Usama Waheed]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Hi Keith,<br/>
<br/>
Thank you so much for helping out. Worked like a charm for the 1st issue.<br/>
<br/>
Thanks,<br/>
Usama Waheed
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Help with Macro Error Correction &amp; Enhancement</title>
<link>https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#2</link>
<pubDate>Wed, 31 Jan 2018 16:09:36 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0#2</guid>
<category>ClipboardFusion</category>
<description><![CDATA[Let's solve the first problem first (verifying that the Notepad window has focus). Can you give this code a try?
Code
Copy
Select All
using System;
using System.Collections.Generic;
public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
// Copy the s...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Let's solve the first problem first (verifying that the Notepad window has focus). Can you give this code a try?<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="#code019eb2dbc84f709c923823aee2393022" class="ClipboardCopyControl"><img src="https://www.clipboardfusion.com/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('code019eb2dbc84f709c923823aee2393022Js'); return false;"><img src="https://www.clipboardfusion.com/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="code019eb2dbc84f709c923823aee2393022Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Collections.Generic;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        // Copy the selected text
        BFS.Clipboard.CopyText();
        
        // Launch Notepad
        uint appID = BFS.Application.Start("notepad.exe");
        
        // Wait up to 10 seconds for it to open and receive focus
        for (int i = 0; i &lt; 10; i++)
        {
            // If the newly launched Notepad window has focus, paste the text and break out of the loop
            if (BFS.Window.GetFocusedWindow() == BFS.Application.GetMainWindowByAppID(appID))
                {
                    BFS.Clipboard.Paste();
                    break;
                }
            
            // If we got here, the Notepad window doesn't yet have focus, wait 1 second before restarting the loop
            BFS.General.ThreadWait(1000);
        }
        return text;
    }
}</pre><textarea id="code019eb2dbc84f709c923823aee2393022" name="code019eb2dbc84f709c923823aee2393022" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
<item>
<title>Help with Macro Error Correction &amp; Enhancement</title>
<link>https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0</link>
<pubDate>Tue, 30 Jan 2018 21:43:33 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.clipboardfusion.com/Discussions/View/help-with-macro-error-correction-enhancement/?ID=95a1ee23-7d0d-4c2a-b693-de2de06d27b0</guid>
<category>ClipboardFusion</category>
<description><![CDATA[Hi Guys,
Was creating a small macro, that does the following:
Copy Selected TextOpens Notepad.exePaste the selected text
The issue is if I do the following code, sometime CF pastes before even notepad window gets focus:
Code
Copy
Select All
using System;
using System.Collections.Generic;...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Hi Guys,<br/>
<br/>
Was creating a small macro, that does the following:<br/>
<br/>
<ul class="ListBullet"><li>Copy Selected Text</li><li>Opens Notepad.exe</li><li>Paste the selected text</li></ul>
<br/>
The issue is if I do the following code, sometime CF pastes before even notepad window gets focus:<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="#code019eb2dbc85576e6a75da78599eb9d29" class="ClipboardCopyControl"><img src="https://www.clipboardfusion.com/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('code019eb2dbc85576e6a75da78599eb9d29Js'); return false;"><img src="https://www.clipboardfusion.com/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="code019eb2dbc85576e6a75da78599eb9d29Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Collections.Generic;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        
        BFS.Clipboard.CopyText();
        BFS.Application.Start("notepad.exe");
        BFS.Clipboard.Paste();
        return text;
    }
}</pre><textarea id="code019eb2dbc85576e6a75da78599eb9d29" name="code019eb2dbc85576e6a75da78599eb9d29" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
I resolved that issue by using ThreadWait in between application start and paste, however, I believe that is not a proper method so I wanted to use the WindowFocus and that is where I get the error. Below is the code and the error:<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="#code019eb2dbc85674088a0a7a228ef8e49c" class="ClipboardCopyControl"><img src="https://www.clipboardfusion.com/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('code019eb2dbc85674088a0a7a228ef8e49cJs'); return false;"><img src="https://www.clipboardfusion.com/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="code019eb2dbc85674088a0a7a228ef8e49cJs" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Collections.Generic;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        
        BFS.Clipboard.CopyText();
        BFS.Application.Start("notepad.exe");
        IntPtr mainWindow = BFS.Application.GetAppIDByWindow("Untitled - Notepad"); 
        BFS.Window.Focus(mainWindow);
        //BFS.General.ThreadWait(500);
        BFS.Clipboard.Paste();
        return text;
    }
}</pre><textarea id="code019eb2dbc85674088a0a7a228ef8e49c" name="code019eb2dbc85674088a0a7a228ef8e49c" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<b><span style="text-decoration:underline;">ERROR:</span></b><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="#code019eb2dbc858746caa6bb7d3388c0342" class="ClipboardCopyControl"><img src="https://www.clipboardfusion.com/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('code019eb2dbc858746caa6bb7d3388c0342Js'); return false;"><img src="https://www.clipboardfusion.com/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="code019eb2dbc858746caa6bb7d3388c0342Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">The best overloaded method match for 'BFS.Application.GetAppIDByWindow(System.IntPtr)' has some invalid arguments
 Argument 1: cannot convert from 'string' to 'System.IntPtr'</pre><textarea id="code019eb2dbc858746caa6bb7d3388c0342" name="code019eb2dbc858746caa6bb7d3388c0342" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div><br/>
<br/>
Can someone kindly help with the above code. Also is there is another Macro that Thomas created "Get Filenames from Clipboard". Is it possible to achieve the following:<br/>
<ul class="ListBullet"><li>Check Selected Data, If text proceed to next step. If files then get result from "Get Filenames from Clipbpard Macro"</li><li>Open Notepad</li><li>Make sure the focus command makes it active (Is it possible to handle a case where multiple notepad files are open then focus on the newly created process?)</li><li>Paste either the Filenames or Text</li></ul>
<br/>
Thanks is advance guys.
</div>
]]></content:encoded>
</item>
</channel>
</rss>