Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
TheJackyl
2 discussion posts
I'm trying to make a script that will check if a program is running and if it is it will bring focus to it, if not then it will run it. This is what I have and i can get get either statement to run seperately or both to run at the same time. Doesn't seem the If - then is working correctly. Anyone know where i went wrong here? thank you.

Code

using System;
using System.Drawing;

public static class VoiceBotScript {
    public static void Run(IntPtr windowHandle) {
        uint appID = BFS.Application.GetAppIDByFile("*blender.exe");
        if(BFS.Application.IsAppRunningByAppID(appID)){
            BFS.Window.Focus(BFS.Window.GetWindowByText("Blender*"));
        }
           {
               BFS.VoiceBotActions.StartProgram(@"C:\Blender 2.8\blender.exe");
           }
    }
}
Jan 2, 2019  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Looks like there might be an issue with the IsAppRunningByAppID function. When it's not running the appID is 0, but that function still returns true for some reason.

I've put this on our list to fix up, in the meantime you can work around it by doing this:

Code

using System;
using System.Drawing;

public static class VoiceBotScript
{
    public static void Run(IntPtr windowHandle)
    {
        uint appID = BFS.Application.GetAppIDByFile("*notepad++.exe");
        if (appID > 0)
        {
            BFS.Window.Focus(BFS.Window.GetWindowByText("*Notepad++*"));
        }
        else
        {
            BFS.VoiceBotActions.StartProgram(@"C:\Program Files\Notepad++\notepad++.exe");
        }
    }
}
Jan 4, 2019  • #2
Keith Lammers (BFS)'s profile on WallpaperFusion.com
We've just released a new VoiceBot Beta version, and this issue should be all fixed up. Please let us know if you run into any trouble after updating.

Thanks!
May 16, 2019  • #3
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(1)  Login to Vote(-)