Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
Steve E Birchfield
3 discussion posts
I am trying to create a macro where if it sees the word TASK in the data it appends a comma and space. The output should look something like this: TASK0122933, where my original string was just TASK0122933

When I run the macro I get the data twice when the data is pasted and copied with the appended comma and space. TASK0122933TASK0122933,, I don't know much C# so any help would be appreciated. I have a Trigger setup to only paste the data this way in OneNote and then it is running the premade macro that I have modified for replacing and auto-paste. That's what I want but with the correct results obviously.

Code

using System;

public static class ClipboardFusionHelper
{
public static string ProcessText(string text)
{
BFS.Clipboard.CopyText(out text);
if (text.Contains("TASK"))
{
;
}

BFS.Clipboard.PasteText(text + (", "));
return null;
}
}
Oct 26, 2017  • #1
User Image
UWK-87
165 discussion posts
Hi Steve,

I just edited your macro so it will be easier for you to understand. Here is the macro. Kindly let me know if you wish for me to post it as a importable file :)

Code

using System;

public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        BFS.Clipboard.CopyText(out text);

        //!text.EndsWith(",") This will serve as a condition that if the "," already exist at the end of the text with TASK 
        //then do not put another so you don't get something like this -> TASK123,,

        //Remove && !text.EndsWith(",") from below IF statement, if you don't want the check :)

        if (text.Contains("TASK") && !text.EndsWith(","))
        {   
            text += ",";
        }

        BFS.Clipboard.PasteText(text);
        return null;
    }
}
Oct 26, 2017 (modified Oct 26, 2017)  • #2
User Image
Steve E Birchfield
3 discussion posts
That works great! Thank you. Yes you can make it importable.

ClipboardFusion works so much better for me than the other app I was using. I really appreciate your hard work and support on these apps.
Oct 27, 2017  • #3
User Image
UWK-87
165 discussion posts
You are quite welcome :). Here's how to get it into ClipboardFusion:

  • Download the file attached to this post
  • Open the ClipboardFusion Settings window
  • On the "Macros" tab, click the "Import" button
  • Select the file you downloaded in the first step
  • In the window that pops up, you can review the code and assign the Macro a HotKey
  • Click OK to close the Macro Edit window, then OK again to save and apply your changes
• Attachment: Append _,_ at end of TASK.cfmacro [1,240 bytes]
Oct 27, 2017  • #4
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)