Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
8-Whispered-8
3 discussion posts
Could anyone help me with this?
I couldn't quite get the following Macro script to pay a sound on successful copy to Clipboardfusion:

NOTE: I have tried the play sound on clipboard change option in settings, but it often bugged out when I copy a lot of items rapidly and keep playing the sound repeatedly until I forcefully close the Clipboardfusion app. Also, the option plays sound on other clipboard activities instead of only when the Macro is complete (which is what I really needed).

Macro:
"Copy Text to Local Pinned Slot 01"

Code

using System;
using System.Collections.Generic;

// The 'text' parameter will contain the text from the:
//   - Current Clipboard when run by HotKey
//   - History Item when run from the History Menu
// The returned string will be:
//   - Placed directly on the Clipboard
//   - Ignored by ClipboardFusion if it is 'null'
public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        int localPinnedItemCount = BFS.ClipboardFusion.GetLocalPinnedItemCount();
        if (localPinnedItemCount < 24)
        {
            for (int i = localPinnedItemCount; i < 24; i++)
            {
                BFS.ClipboardFusion.AddLocalPinnedText("--placeholder--");
            }
        }    
        BFS.ClipboardFusion.SetLocalPinnedText(0, BFS.Clipboard.CopyText());
        return null;
    }
}
20 days ago  • #1
User Image
8-Whispered-8
3 discussion posts
Just throught I should post for anyone else having a simmilar problem.
PS. Still can't find a workable code to just play a mp3 audio file when the Macro is succesful.

Got a workaround for this by triggering one of Windows system audio and changing the sound on Windows setting to something more pleasant to the ears:

Code

System.Media.SystemSounds.Asterisk.Play();


Thus the Macro code becomes:

Code

using System;
using System.Collections.Generic;

// The 'text' parameter will contain the text from the:
//   - Current Clipboard when run by HotKey
//   - History Item when run from the History Menu
// The returned string will be:
//   - Placed directly on the Clipboard
//   - Ignored by ClipboardFusion if it is 'null'
public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        int localPinnedItemCount = BFS.ClipboardFusion.GetLocalPinnedItemCount();
        if (localPinnedItemCount < 24)
        {
            for (int i = localPinnedItemCount; i < 24; i++)
            {
                BFS.ClipboardFusion.AddLocalPinnedText("--placeholder--");
            }
        }    
        BFS.ClipboardFusion.SetLocalPinnedText(0, BFS.Clipboard.CopyText());
        System.Media.SystemSounds.Asterisk.Play();
        return null;
    }
}
19 days ago  • #2
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
I just tested it with this code and it worked:

Code

using System;
using System.Collections.Generic;

// The 'text' parameter will contain the text from the:
//   - Current Clipboard when run by HotKey
//   - History Item when run from the History Menu
// The returned string will be:
//   - Placed directly on the Clipboard
//   - Ignored by ClipboardFusion if it is 'null'
public static class ClipboardFusionHelper
{
    public static string ProcessText(string text)
    {
        int localPinnedItemCount = BFS.ClipboardFusion.GetLocalPinnedItemCount();
        if (localPinnedItemCount < 24)
        {
            for (int i = localPinnedItemCount; i < 24; i++)
            {
                BFS.ClipboardFusion.AddLocalPinnedText("--placeholder--");
            }
        }    
        BFS.ClipboardFusion.SetLocalPinnedText(0, BFS.Clipboard.CopyText());
        BFS.Audio.PlayFile("C:\\Users\\test\\Downloads\\sample-3s.mp3");
        return null;
    }
}
19 days ago  • #3
User Image
8-Whispered-8
3 discussion posts
Works properly.

Thank you for the assistance.
12 days ago  • #4
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)