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!

EricClark's profile on WallpaperFusion.com
Need a way to get if a window exists in a more clear method.

I am trying to setup a script so that it will open a file but if the window already exists then it will not open the file but instead swtich to that window.

good for viewing photos or reference maps etc.

Current method for this could be

IntPtr win = BFS.Window.GetWindowByText("text starts with *");
if(!BFS.Window.Focus(win)){
BFS.Dialog.ShowMessageError("found window");
BFS.VoiceBotActions.OpenFile("path to file");
Jan 24, 2018 (modified Jan 24, 2018)  • #1
PabloMartinez's profile on WallpaperFusion.com
The simplest example.

Code

using System;

public static class VoiceBotScript
{
    public static void Run(IntPtr windowHandle)
    {
        // Example @"c:\MyPict\MyPict.png"
        var pathToPict = @"Your path to picture with extension";
        OpenPicture(pathToPict);
    }
    
    // For example used default Win10 picture viewer
    private static void OpenPicture(string pathToPict)
    {
        var wHnd = BFS.Window.GetWindowByText("*Photos");
        if (!wHnd.Equals(IntPtr.Zero))
            BFS.Window.Focus(wHnd);
        else
            BFS.VoiceBotActions.StartProgram(pathToPict);
    }
}
Jan 24, 2018  • #2
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)