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?
Save up to 50% on our desktop apps during our Year End Sale!Save up to 50% on our desktop apps during our Year End Sale, including DisplayFusion, ClipboardFusion, FileSeek, LogFusion, TrayStatus, and VoiceBot!Save up to 50% on our desktop apps during our Year End Sale!

User Image
frankly16545
7 discussion posts
with firefox being the example process. i dont see why this doesnt work.

Code

using System;
using System.Drawing;
using System.Diagnostics;
using System.ComponentModel;

public static class VoiceBotScript
{
    public static void Run(IntPtr windowHandle)
    {
        // Process Name
        string windowText = "*firefox*";
        // If process is running then focus window
        if (Process.GetProcessesByName(windowText).Length > 0)
        {
            BFS.Window.Focus(BFS.Window.GetWindowByText(windowText));
        }
        // If process is not running output tts error
        else if (Process.GetProcessesByName(windowText).Length < 1)
        {
            BFS.Speech.TextToSpeech("Error");
        }
    }
}
Jun 13, 2021 (modified Jun 14, 2021)  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
I don't think Process.GetProcessByName takes a wildcard. We have a function that checks if a process is running though and does take a wildcard. Try this out:

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        // Process Name
        string windowText = "*firefox*";
        // If process is running then focus window
        if (BFS.Application.IsAppRunningByFile(windowText))
        {
            BFS.Window.Focus(BFS.Window.GetWindowByText(windowText));
        }
        // If process is not running output tts error
        else
        {
            BFS.Speech.TextToSpeech("Error");
        }
    }
}
Jun 14, 2021  • #2
User Image
frankly16545
7 discussion posts
that worked! nice! had to change static class to "VoiceBotScript"

thank you very much!
Jun 14, 2021  • #3
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)