<?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: Only Run macro is an app has focus</title>
<atom:link href="https://www.clipboardfusion.com/Discussions/RSS/?TopicID=2d4d7e09-d1f9-491d-b7b1-5e771429609a" rel="self" type="application/rss+xml" />
<link>https://www.clipboardfusion.com/Discussions/RSS/?TopicID=2d4d7e09-d1f9-491d-b7b1-5e771429609a</link>
<description>ClipboardFusion RSS: Only Run macro is an app has focus</description>
<lastBuildDate>Tue, 07 Apr 2026 19:39:00 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.clipboardfusion.com/Discussions/RSS/?TopicID=2d4d7e09-d1f9-491d-b7b1-5e771429609a</generator>
<item>
<title>RE: Only Run macro is an app has focus</title>
<link>https://www.clipboardfusion.com/Discussions/View/only-run-macro-is-an-app-has-focus/?ID=2d4d7e09-d1f9-491d-b7b1-5e771429609a#2</link>
<pubDate>Tue, 07 May 2019 13:57:31 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.clipboardfusion.com/Discussions/View/only-run-macro-is-an-app-has-focus/?ID=2d4d7e09-d1f9-491d-b7b1-5e771429609a#2</guid>
<category>ClipboardFusion</category>
<description><![CDATA[After an all-nighter I managed to solve this
Code
Copy
Select All
using System;
using System.Collections.Generic;
public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
// Checking that Chrome os active
IntPtr windowHandle = BFS.Window.GetFocusedWin...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
After an all-nighter I managed to solve this<br/>
<div id="" 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="#code019d697492c274d8afe7ff2791237d9d" class="ClipboardCopyControl"><img src="https://www.clipboardfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019d697492c274d8afe7ff2791237d9dJs'); return false;"><img src="https://www.clipboardfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;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="code019d697492c274d8afe7ff2791237d9dJs" 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)
    {
        // Checking that Chrome os active
                
        IntPtr windowHandle = BFS.Window.GetFocusedWindow();
        string file = BFS.Application.GetMainFileByWindow(windowHandle);
        //BFS.Dialog.ShowMessageInfo(file);      
        if (file.Contains("chrome.exe") == true)
        {
        
        //If Chrome is active ... do your stuff here
            
        }
        
        return text;
    }
}</pre><textarea id="code019d697492c274d8afe7ff2791237d9d" name="code019d697492c274d8afe7ff2791237d9d" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
<item>
<title>Only Run macro is an app has focus</title>
<link>https://www.clipboardfusion.com/Discussions/View/only-run-macro-is-an-app-has-focus/?ID=2d4d7e09-d1f9-491d-b7b1-5e771429609a</link>
<pubDate>Mon, 06 May 2019 20:18:07 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.clipboardfusion.com/Discussions/View/only-run-macro-is-an-app-has-focus/?ID=2d4d7e09-d1f9-491d-b7b1-5e771429609a</guid>
<category>ClipboardFusion</category>
<description><![CDATA[Simple script in ClipboardFusion to replace text.
But I need the macro to only run if Chrome is the focused application.
Had a look at GetMainFileByWindow and other functions but can't get them implemented into the code.
Here's a sample of the current code, and help to add a statement if a win...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Simple script in ClipboardFusion to replace text.<br/>
But I need the macro to only run if Chrome is the focused application.<br/>
Had a look at GetMainFileByWindow and other functions but can't get them implemented into the code.<br/>
Here's a sample of the current code, and help to add a statement if a window (chrome) is the focused app will be appreciated. <br/>
<div id="" 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="#code019d697492cb77ceb994949323017d69" class="ClipboardCopyControl"><img src="https://www.clipboardfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code019d697492cb77ceb994949323017d69Js'); return false;"><img src="https://www.clipboardfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;vertical-align:middle !important;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="code019d697492cb77ceb994949323017d69Js" contenteditable="true" spellcheck="true" class="skiptranslate" style="width:100%; min-height:75px;">using System;
using System.Text.RegularExpressions;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        //use the Regex class to replace any matched text with an empty string
    if (text.Contains("**"))
    {
    text = text.Replace ("**","");
    text = Regex.Replace (text, @"(.*),.*- (.*),.*(\(.*)", "$1 vs $2 $3");
    }    
    else
    {
        text = Regex.Replace (text, @"\n", "");
        text = Regex.Replace (text, @".*\[Date ""([1-2][0-9][0-9][0-9]).*\[White ""(.*)"".*\[Black ""(.*)"".*\[Result.*", "**$2 - $3** ($1)");
    }
        
        BFS.Clipboard.PasteText(text);
        //get ClipboardFusion to replace the text on the clipboard with the text variable
        return text;
    }
}</pre><textarea id="code019d697492cb77ceb994949323017d69" name="code019d697492cb77ceb994949323017d69" style="position:absolute; top:0; left:-999999px; width:1px; height:1px;"></textarea></div>
</div></div></div>
</div>
]]></content:encoded>
</item>
</channel>
</rss>